/** * 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); }
*/ // PEAR dependancy require 'JLD/Directory/Directory.php'; if (!isset($argv[1])) { 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)) {