title: PHP File Manager Crashes When Reading Large Directory
body: <p>It looks like scandir() is causing issues here and if i could set a depth limit it might work better, but im not too sure.</p>
  
  <p>My website has a large images directory (25gb) that is very well organised. Im using tinyMCE with the file manager Roxy Fileman. When i try to load the root folder "images" it just keeps loading and eventually crashes. If i hardcode it to open "images/posts" it loads up fine. I have checked the source code and it looks like this function is doing the reading of directories.</p>
  
  <pre><code>function listDirectory($path){
    $ret = @scandir($path);
    if($ret === false){
      $ret = array();
      $d = opendir($path);
      if($d){
        while(($f = readdir($d)) !== false){
          $ret[] = $f;
        }
        closedir($d);
      }
    }
  
    return $ret;
  }
  </code></pre>
  
  <p>One directory in particular contains about 99% of the images and i do not need to access this using the file manager, but i cannot move the directory either. "images/games" is the cause. Is there either a way for me to ignore this directory or only scan to a certain depth.</p>