You are here

protected function elFinderVolumeDrupal::CheckFolderCount in elFinder file manager 7.2

Same name and namespace in other branches
  1. 8.2 src/Controller/elFinderVolumeDrupal.php \elFinderVolumeDrupal::CheckFolderCount()
  2. 6.2 inc/elfinder.drupalfs.driver.inc \elFinderVolumeDrupal::CheckFolderCount()
  3. 7.3 inc/elfinder.drupalfs.driver.inc \elFinderVolumeDrupal::CheckFolderCount()
1 call to elFinderVolumeDrupal::CheckFolderCount()
elFinderVolumeDrupal::_save in inc/elfinder.drupalfs.driver.inc
Create new file and write into it from file pointer. Return new file path or false on error.

File

inc/elfinder.drupalfs.driver.inc, line 326
elFinder driver for Drupal filesystem.

Class

elFinderVolumeDrupal
@file

Code

protected function CheckFolderCount($dir) {
  $max_allowed = variable_get('elfinder_settings_filesystem_maxfilecount', 0);
  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;
}