/** * Return a list of all files in the CVS repository * * This function is like {@link parent::dirList()} except * that instead of retrieving a regular filelist, it first * retrieves a listing of all the CVS/Entries files in * $directory and all of the subdirectories. Then, it * reads the Entries file, and creates a listing of files * that are a part of the CVS repository. No check is * made to see if they have been modified, but newly * added or removed files are ignored. * @return array list of files in a directory * @param string $directory full path to the directory you want the list of * @uses _recurDirList() * @uses _readCVSEntries() */ function dirList($directory) { static $in_recursion = false; if (!$in_recursion) { // include only CVS/Entries files $this->_setupIgnore(array('*/CVS/Entries'), 0); $this->_setupIgnore(array(), 1); $in_recursion = true; $entries = parent::dirList($directory); $in_recursion = false; } else { return parent::dirList($directory); } if (!$entries || !is_array($entries)) { return PEAR_PackageFileManager::raiseError(PEAR_PACKAGEFILEMANAGER_NOCVSENTRIES, $directory); } return $this->_readCVSEntries($entries); }
/** * Build a list of files based on the output of the 'p4 have' command. * * @param string $directory The directory in which to list the files. * * @return mixed An array of full filenames or a PEAR_Error value if * $directory does not exist. */ function dirList($directory) { /* Return an error if the directory does not exist. */ if (@is_dir($directory) === false) { return PEAR_PackageFileManager::raiseError(PEAR_PACKAGEFILEMANAGER_DIR_DOESNT_EXIST, $directory); } /* List the files below $directory that are under Perforce control. */ exec("p4 have {$directory}/...", $output); /* Strip off everything except the filename from each line of output. */ $files = preg_replace('/^.* \\- /', '', $output); /* If we have a list of files to include, remove all other entries. */ if ($this->ignore[0]) { $files = array_filter($files, array($this, '_includeFilter')); } /* If we have a list of files to ignore, remove them from the array. */ if ($this->ignore[1]) { $files = array_filter($files, array($this, '_ignoreFilter')); } return $files; }
/** * Return a list of all files in the CVS repository * * This function is like {@link parent::dirList()} except * that instead of retrieving a regular filelist, it first * retrieves a listing of all the .svn/entries files in * $directory and all of the subdirectories. Then, it * reads the entries file, and creates a listing of files * that are a part of the Subversion checkout. No check is * made to see if they have been modified, but removed files * are ignored. * * @access protected * @return array list of files in a directory * @param string $directory full path to the directory you want the list of * @uses _recurDirList() * @uses _readSVNEntries() */ function dirList($directory) { static $in_recursion = false; if (!$in_recursion) { // include only .svn/entries files // since subversion keeps its data in a hidden // directory we must force PackageFileManager to // consider hidden directories. $this->_options['addhiddenfiles'] = true; $this->_setupIgnore(array('*/.svn/entries'), 0); $this->_setupIgnore(array(), 1); $in_recursion = true; $entries = parent::dirList($directory); $in_recursion = false; } else { return parent::dirList($directory); } if (!$entries || !is_array($entries)) { return PEAR_PackageFileManager::raiseError(PEAR_PACKAGEFILEMANAGER_NOSVNENTRIES, $directory); } return $this->_readSVNEntries($entries); }
/** * Retrieve a listing of every file in $directory and * all subdirectories. * * The return format is an array of full paths to files * @access protected * @return array list of files in a directory * @param string $directory full path to the directory you want the list of * @throws PEAR_PACKAGEFILEMANAGER_DIR_DOESNT_EXIST */ function dirList($directory) { $ret = false; if (@is_dir($directory)) { $ret = array(); $d = @dir($directory); // thanks to Jason E Sweat (jsweat@users.sourceforge.net) for fix while ($d && false !== ($entry = $d->read())) { if ($this->_testFile($directory, $entry)) { if (is_file($directory . '/' . $entry)) { // if include option was set, then only pass included files if ($this->ignore[0]) { if ($this->_checkIgnore($entry, $directory . '/' . $entry, 0)) { continue; } } // if ignore option was set, then only pass included files if ($this->ignore[1]) { if ($this->_checkIgnore($entry, $directory . '/' . $entry, 1)) { continue; } } $ret[] = $directory . '/' . $entry; } if (is_dir($directory . '/' . $entry)) { $tmp = $this->dirList($directory . '/' . $entry); if (is_array($tmp)) { foreach ($tmp as $ent) { $ret[] = $ent; } } } } } if ($d) { $d->close(); } } else { return PEAR_PackageFileManager::raiseError(PEAR_PACKAGEFILEMANAGER_DIR_DOESNT_EXIST, $directory); } return $ret; }