From 702fb4a66d473fb1ee98aaa81cd26b4813279ef8 Mon Sep 17 00:00:00 2001 From: wei <> Date: Tue, 9 May 2006 11:39:11 +0000 Subject: Remove duplicate --- .../Search/Lucene/Storage/Directory/Filesystem.php | 269 --------------------- 1 file changed, 269 deletions(-) delete mode 100644 buildscripts/texbuilder/Zend/Search/Lucene/Storage/Directory/Filesystem.php (limited to 'buildscripts/texbuilder/Zend/Search/Lucene/Storage/Directory') diff --git a/buildscripts/texbuilder/Zend/Search/Lucene/Storage/Directory/Filesystem.php b/buildscripts/texbuilder/Zend/Search/Lucene/Storage/Directory/Filesystem.php deleted file mode 100644 index 73d10659..00000000 --- a/buildscripts/texbuilder/Zend/Search/Lucene/Storage/Directory/Filesystem.php +++ /dev/null @@ -1,269 +0,0 @@ - Zend_Search_Lucene_Storage_File object - * - * @var array - * @throws Zend_Search_Lucene_Exception - */ - private $_fileHandlers; - - - /** - * Utility function to recursive directory creation - * - * @param string $dir - * @param integer $mode - * @param boolean $recursive - * @return boolean - */ - - static public function mkdirs($dir, $mode = 0777, $recursive = true) - { - if (is_null($dir) || $dir === '') { - return false; - } - if (is_dir($dir) || $dir === '/') { - return true; - } - if (self::mkdirs(dirname($dir), $mode, $recursive)) { - return mkdir($dir, $mode); - } - return false; - } - - - /** - * Object constructor - * Checks if $path is a directory or tries to create it. - * - * @param string $path - * @throws Zend_Search_Lucene_Exception - */ - public function __construct($path) - { - if (!is_dir($path)) { - if (file_exists($path)) { - throw new Zend_Search_Lucene_Exception('Path exists, but it\'s not a directory'); - } else { - if (!self::mkdirs($path)) { - throw new Zend_Search_Lucene_Exception("Can't create directory '$path'."); - } - } - } - $this->_dirPath = $path; - $this->_fileHandlers = array(); - } - - - /** - * Closes the store. - * - * @return void - */ - public function close() - { - foreach ($this->_fileHandlers as $fileObject) { - $fileObject->close(); - } - - unset($this->_fileHandlers); - } - - - /** - * Returns an array of strings, one for each file in the directory. - * - * @return array - */ - public function fileList() - { - $result = array(); - - $dirContent = opendir( $this->_dirPath ); - while ($file = readdir($dirContent)) { - if (($file == '..')||($file == '.')) continue; - - $fullName = $this->_dirPath . '/' . $file; - - if( !is_dir($this->_dirPath . '/' . $file) ) { - $result[] = $file; - } - } - - return $result; - } - - /** - * Creates a new, empty file in the directory with the given $filename. - * - * @param string $filename - * @return Zend_Search_Lucene_Storage_File - */ - public function createFile($filename) - { - if (isset($this->_fileHandlers[$filename])) { - $this->_fileHandlers[$filename]->close(); - } - unset($this->_fileHandlers[$filename]); - $this->_fileHandlers[$filename] = new Zend_Search_Lucene_Storage_File_Filesystem($this->_dirPath . '/' . $filename, 'w+b'); - return $this->_fileHandlers[$filename]; - } - - - /** - * Removes an existing $filename in the directory. - * - * @param string $filename - * @return void - */ - public function deleteFile($filename) - { - if (isset($this->_fileHandlers[$filename])) { - $this->_fileHandlers[$filename]->close(); - } - unset($this->_fileHandlers[$filename]); - unlink($this->_dirPath .'/'. $filename); - } - - - /** - * Returns true if a file with the given $filename exists. - * - * @param string $filename - * @return boolean - */ - public function fileExists($filename) - { - return file_exists($this->_dirPath .'/'. $filename); - } - - - /** - * Returns the length of a $filename in the directory. - * - * @param string $filename - * @return integer - */ - public function fileLength($filename) - { - if (isset( $this->_fileHandlers[$filename] )) { - return $this->_fileHandlers[$filename]->size(); - } - return filesize($this->_dirPath .'/'. $filename); - } - - - /** - * Returns the UNIX timestamp $filename was last modified. - * - * @param string $filename - * @return integer - */ - public function fileModified($filename) - { - return filemtime($this->_dirPath .'/'. $filename); - } - - - /** - * Renames an existing file in the directory. - * - * @param string $from - * @param string $to - * @return void - */ - public function renameFile($from, $to) - { - if ($this->_fileHandlers[$from] !== null) { - $this->_fileHandlers[$from]->close(); - } - unset($this->_fileHandlers[$from]); - - if ($this->_fileHandlers[$to] !== null) { - $this->_fileHandlers[$to]->close(); - } - unset($this->_fileHandlers[$to]); - - if (file_exists($this->_dirPath . '/' . $to)) { - unlink($this->_dirPath . '/' . $to); - } - - return @rename($this->_dirPath . '/' . $from, $this->_dirPath . '/' . $to); - } - - - /** - * Sets the modified time of $filename to now. - * - * @param string $filename - * @return void - */ - public function touchFile($filename) - { - return touch($this->_dirPath .'/'. $filename); - } - - - /** - * Returns a Zend_Search_Lucene_Storage_File object for a given $filename in the directory. - * - * @param string $filename - * @return Zend_Search_Lucene_Storage_File - */ - public function getFileObject($filename) - { - if (isset( $this->_fileHandlers[$filename] )) { - $this->_fileHandlers[$filename]->seek(0); - return $this->_fileHandlers[$filename]; - } - - $this->_fileHandlers[$filename] = new Zend_Search_Lucene_Storage_File_Filesystem($this->_dirPath . '/' . $filename, 'rb'); - return $this->_fileHandlers[$filename]; - } -} - -- cgit v1.2.3