You are here

protected function elFinderVolumeDrupal::CheckFolderCount in elFinder file manager 6.2

Same name and namespace in other branches
  1. 8.2 src/Controller/elFinderVolumeDrupal.php \elFinderVolumeDrupal::CheckFolderCount()
  2. 7.3 inc/elfinder.drupalfs.driver.inc \elFinderVolumeDrupal::CheckFolderCount()
  3. 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 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 323

Class

elFinderVolumeDrupal
elFinder driver for Drupal 6 filesystem.

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, '/.*\\..*/', array(), 0, FALSE);
    if (count($files) >= $max_allowed) {
      $this
        ->setError(t('Max directory file count of %count reached', array(
        '%count' => $max_allowed,
      )));
      return FALSE;
    }
  }
  return TRUE;
}