コード例 #1
0
ファイル: StreamWrapper.php プロジェクト: filicious/core
 /**
  * Open directory handle
  *
  * @param string $path
  * @param int    $options
  *
  * @return boolean
  */
 public function dir_opendir($path, $options)
 {
     $this->openFile($path);
     if ($this->file->isDirectory()) {
         $this->directoryIterator = $this->file->getIterator();
         return true;
     }
     return false;
 }
コード例 #2
0
ファイル: FTPFilesystem.php プロジェクト: filicious/ftp
 /**
  * Delete a file or directory.
  *
  * @param File $file the file
  *
  * @param bool $recursive
  *
  * @return bool
  */
 public function delete($file, $recursive = false, $force = false)
 {
     // TODO: invalidate cache after delete?
     if ($file->isDirectory()) {
         if ($recursive) {
             /** @var File $file */
             foreach ($file->ls() as $file) {
                 if (!$file->delete(true, $force)) {
                     return false;
                 }
             }
         } else {
             if ($file->count() > 0) {
                 return false;
             }
         }
         return $this->ftpDelete($file);
     } else {
         if (!$file->isWritable()) {
             if ($force) {
                 $file->setMode(0666);
             } else {
                 return false;
             }
         }
         return $this->ftpDelete($file);
     }
 }
コード例 #3
0
ファイル: PathnameIterator.php プロジェクト: filicious/core
 /**
  * Apply bitmask filters on current file.
  *
  * @param \Filicious\File $file
  *
  * @return bool
  */
 protected function applyBitmaskFilters(File $file)
 {
     $basename = $file->getBasename();
     if (!($this->bitmask & File::LIST_HIDDEN) && $basename[0] == '.' || !($this->bitmask & File::LIST_VISIBLE) && $basename[0] != '.' || !($this->bitmask & File::LIST_FILES) && $file->isFile() || !($this->bitmask & File::LIST_DIRECTORIES) && $file->isDirectory() || !($this->bitmask & File::LIST_LINKS) && $file->isLink() || !($this->bitmask & File::LIST_OPAQUE) && !$file->isLink()) {
         return false;
     }
     return true;
 }