/** * Goes through the 'JLD/' folder hierarchy */ public static function initFromFileSystem() { $pear = JLD_Directory::getPearIncludePath(); if (empty($pear)) { die(__CLASS__ . ': pear include path not found.'); } $dirs = JLD_Directory::getDirectoryInformation($pear . '/JLD', $pear, true, true); self::$cList = self::getFiles($pear, $dirs); }
/** * Reads all the categories from the directory structure * in the REST channel. */ public function readAll() { $path = $this->buildFileSystemRestPath(self::$baseCategories); // no need to get resursive here. $raw = JLD_Directory::getDirectoryInformation($path, $path, true, true); // strip off leading / foreach ($raw as &$e) { $e['name'] = substr($e['name'], 1); $this->cats[] = $e['name']; } }
/** */ protected function readAll() { // no need to get resursive here. $raw = JLD_Directory::getDirectoryInformation($this->restPathC, $this->restPathC, true, true); // strip off leading / foreach ($raw as &$e) { $e['name'] = substr($e['name'], 1); $this->cats[] = $e['name']; } return $raw; }
/** * Gets all the directory names from the base /p REST structure. */ public function getAllDirsFromRest() { $path = $this->buildFileSystemRestPath(self::$basePackages); $raw = JLD_Directory::getDirectoryInformation($path, $path, true, true); return $raw; }
echo "Requires a directory path as input!\n"; die(0); } $sdir = $argv[1]; if (!is_dir($sdir)) { echo "Requires a valid directory path as input!\n"; die(0); } // we need the parent directory path too in order to properly // place the source files in the local PEAR directory. $pdir = dirname($sdir); $pearDir = JLD_Directory::getPearIncludePath(); echo 'Source directory: ' . $sdir . "\n"; echo 'Parent directory: ' . $pdir . "\n"; echo 'PEAR directory: ' . $pearDir . "\n"; $files = JLD_Directory::getDirectoryInformationRecursive(&$sdir, &$pdir, true); #var_dump( $files ); #die; $bpname = basename($pdir); // push target directory on the stack top; $bname = basename($sdir); array_unshift($files, array('name' => $bname, 'type' => 'dir')); foreach ($files as $file) { $dir = $pearDir . '/' . $bpname . '/' . $file['name']; // create target directory if necessary. if ($file['type'] == 'dir') { if (!is_dir($dir)) { echo 'Creating directory: ' . $dir . " ... "; $result = mkdir($dir); echo $result ? 'success' : 'failure'; echo "\n";
/** * */ public function getAllFilesFromRest() { $path = $this->buildFileSystemRestPath(self::$baseReleases) . '/' . $this->package_name; $raw = JLD_Directory::getDirectoryInformation($path, $path, true, false); return $raw; }