Пример #1
0
 /**
  * Recursive deletes path.
  * @param  string
  * @return void
  */
 private function purge($path, $onlyContent = FALSE)
 {
     static $counter;
     echo str_pad(str_repeat('.', $counter++ % 40), 40), "\r";
     if (!$onlyContent && $this->ftp->tryDelete($path)) {
         return;
     }
     foreach ((array) $this->ftp->nlist($path) as $file) {
         if ($file != NULL && !preg_match('#(^|/)\\.+$#', $file)) {
             // intentionally ==
             $file = strpos($file, '/') === FALSE ? "{$path}/{$file}" : $file;
             if ($file !== $path) {
                 $this->purge($file);
             }
         }
     }
     if (!$onlyContent) {
         $this->ftp->tryRmdir($path);
     }
 }