protected function elFinderVolumeDrupal::CheckFolderCount in elFinder file manager 8.2
Same name and namespace in other branches
- 6.2 inc/elfinder.drupalfs.driver.inc \elFinderVolumeDrupal::CheckFolderCount()
- 7.3 inc/elfinder.drupalfs.driver.inc \elFinderVolumeDrupal::CheckFolderCount()
- 7.2 inc/elfinder.drupalfs.driver.inc \elFinderVolumeDrupal::CheckFolderCount()
Check file count in the folder
@author Oliver Polden (oliverpolden)
Parameters
string $dir check path:
Return value
bool
1 call to elFinderVolumeDrupal::CheckFolderCount()
- elFinderVolumeDrupal::_save in src/
Controller/ elFinderVolumeDrupal.php - Create new file and write into it from file pointer. Return new file path or false on error.
File
- src/
Controller/ elFinderVolumeDrupal.php, line 294 - elFinder driver for Drupal filesystem.
Class
- elFinderVolumeDrupal
- @file
Code
protected function CheckFolderCount($dir) {
$max_allowed = \Drupal::config('elfinder.settings')
->get('filesystem.maxfilecount');
if ($max_allowed > 0) {
$options = array(
'recurse' => FALSE,
);
// Match name.extension. This won't count files with no extension.
$files = file_scan_directory($dir, '/.*\\..*/', $options);
if (count($files) >= $max_allowed) {
$this
->setError(t('Max directory file count of %count reached', array(
'%count' => $max_allowed,
)));
return FALSE;
}
}
return TRUE;
}