private function traveller($directory, Intent $intent = null) { if (!($dirOpen = opendir($directory))) { return false; } $files = []; while ($fileName = readdir($dirOpen)) { if ($fileName === "." || $fileName === "..") { continue; } $fileIns = new File($directory . "/" . $fileName); if ($fileIns->isDirectory() === true && $fileIns->isReadable() === true) { $this->traveller($fileIns->getPath(), $intent); $this->callback->onCallback(pathinfo($fileIns->getPath()), $intent); } elseif ($fileIns->isFile()) { if ($this->mode == self::MODE_SAMETIME) { $this->callback->onCallback(pathinfo($fileIns->getPath()), $intent); } elseif ($this->mode == self::MODE_SEPERATE_FILES) { $this->files[] = $fileIns; continue; } elseif ($fileIns->isReadable() === false) { $this->errorStack->putError(self::TAG, self::ERROR_CANNOT_BE_READ); } } } closedir($dirOpen); return true; }
public static function getPattenFromFile(File $file) { if (!$file->isFile() || !$file->isReadable()) { return false; } return new Pattern($file->getIndex()); }
public function getParLibraryIndex($fileName) { $parFile = new File($fileName); if (!$parFile->isFile()) { return false; } $Zip = new ZipArchive(); if (!$Zip->open($fileName)) { return false; } for ($i = 0; $i < $Zip->numFiles; $i++) { $Name = $Zip->statIndex($i)['name']; if (substr($Name, -1) == "/") { continue; } $filesArray[$Name] = $i; } $this->getCache()->makeCacheFromFile($parFile->getPath(), json_encode($filesArray)); return true; }
function deleteCache($cacheName) { $file = new File($this->cacheDirectory . "/" . $cacheName); if (!$file->isWritable() || !$file->isFile()) { return false; } return $file->deleteFile(); }