mirror of
https://github.com/getgrav/grav.git
synced 2026-07-13 16:42:47 +02:00
Backported folder::countChildren() from 1.7
This commit is contained in:
@@ -508,4 +508,19 @@ abstract class Folder
|
||||
|
||||
return $include_target ? @rmdir($folder) : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does a directory contain children
|
||||
*
|
||||
* @param string $directory
|
||||
* @return int|false
|
||||
*/
|
||||
public static function countChildren($directory) {
|
||||
if (!is_dir($directory)) {
|
||||
return false;
|
||||
}
|
||||
$directories = glob($directory . '/*', GLOB_ONLYDIR);
|
||||
|
||||
return count($directories);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user