Changeset 6657
- Timestamp:
- 12/21/07 07:46:45 (1 year ago)
- Files:
-
- plugins/sfLucenePlugin/branches/1.1/CHANGELOG (modified) (1 diff)
- plugins/sfLucenePlugin/branches/1.1/lib/addon/Zend/Search/Lucene/sfLuceneDirectoryStorage.class.php (modified) (2 diffs)
- plugins/sfLucenePlugin/branches/1.1/lib/addon/Zend/Search/Lucene/sfLuceneFileStorage.class.php (modified) (1 diff)
- plugins/sfLucenePlugin/branches/1.1/lib/indexer/sfLuceneActionIndexer.class.php (modified) (3 diffs)
- plugins/sfLucenePlugin/branches/1.1/lib/indexer/sfLuceneIndexer.class.php (modified) (1 diff)
- plugins/sfLucenePlugin/branches/1.1/lib/indexer/sfLucenePropelIndexer.class.php (modified) (3 diffs)
- plugins/sfLucenePlugin/branches/1.1/lib/storage/sfLuceneStorageFilesystem.class.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfLucenePlugin/branches/1.1/CHANGELOG
r6525 r6657 13 13 * Minor refactoring of sfLucene class to move to sfParameterHolder 14 14 * Upgraded forms to sfForm 15 * Fixed sfLucene does not handle changed categories (closes #2687) 15 16 16 17 Version 0.1.1 Beta plugins/sfLucenePlugin/branches/1.1/lib/addon/Zend/Search/Lucene/sfLuceneDirectoryStorage.class.php
r6384 r6657 23 23 parent::__construct($path); 24 24 25 if (is_dir($path) && substr(sprintf('%o', fileperms($path)), -4) != '0777') 26 { 27 if (!@chmod($path, 0777)) 28 { 29 ini_set('track_errors', $trackErrors); 30 throw new sfException(sprintf('Unable to chmod file "%s". Permissions are already %o', $path, fileperms($path))); 31 } 32 } 25 sfLuceneStorageFilesystem::chmod($path, 0777); 33 26 } 34 27 … … 50 43 $trackErrors = ini_get('track_errors'); ini_set('track_errors', '1'); 51 44 52 if (file_exists($this->_dirPath . '/' . $filename) && substr(sprintf('%o', fileperms($this->_dirPath . '/' . $filename)), -4) != '0777') 53 { 54 if (!@chmod($this->_dirPath . '/' . $filename, 0777)) 55 { 56 ini_set('track_errors', $trackErrors); 57 throw new sfException(sprintf('Unable to chmod file "%s". Permissions are already %o', $this->_dirPath . '/' . $filename, fileperms($this->_dirPath . '/' . $filename))); 58 } 59 } 45 sfLuceneStorageFilesystem::chmod($this->_dirPath, 0777); 60 46 61 47 ini_set('track_errors', $trackErrors); plugins/sfLucenePlugin/branches/1.1/lib/addon/Zend/Search/Lucene/sfLuceneFileStorage.class.php
r6384 r6657 22 22 parent::__construct($filename, $mode); 23 23 24 if (file_exists($filename) && substr(sprintf('%o', fileperms($filename)), -4) != '0777') 25 { 26 if (!@chmod($filename, 0777)) 27 { 28 throw new sfException(sprintf('Unable to chmod file "%s". Permissions are already %o', $filename, fileperms($filename))); 29 } 30 } 24 sfLuceneStorageFilesystem::chmod($filename, 0777); 31 25 } 32 26 } plugins/sfLucenePlugin/branches/1.1/lib/indexer/sfLuceneActionIndexer.class.php
r6489 r6657 50 50 extract($this->getActionProperties()); 51 51 52 if ( $this->deleteGuid( $this->getGuid($params) ) && $this->shouldLog())52 if ( $this->deleteGuid( $this->getGuid($params) ) ) 53 53 { 54 54 $formatter = new sfAnsiColorFormatter(); … … 59 59 )) 60 60 ); 61 62 $categories = $this->getModelCategories();63 64 foreach ($categories as $category)65 {66 $this->removeCategory($category);67 }68 61 } 69 62 … … 108 101 $doc->addField( $this->getLuceneField('text', 'sfl_category', implode(', ', $categories)) ); 109 102 } 103 104 $doc->addField( $this->getLuceneField('unindexed', 'sfl_categories_cache', serialize($categories)) ); 110 105 111 106 $guid = $this->getGuid($params); plugins/sfLucenePlugin/branches/1.1/lib/indexer/sfLuceneIndexer.class.php
r6579 r6657 129 129 foreach ($hits as $hit) 130 130 { 131 $timer = sfTimerManager::getTimer('Zend Search Lucene'); 131 $categories = unserialize($hit->sfl_categories_cache); 132 133 foreach ($categories as $category) 134 { 135 $this->removeCategory($category); 136 } 137 132 138 $this->getLucene()->delete($hit->id); 133 $timer->addTime();134 139 } 135 140 plugins/sfLucenePlugin/branches/1.1/lib/indexer/sfLucenePropelIndexer.class.php
r6583 r6657 130 130 } 131 131 132 $doc->addField( $this->getLuceneField('text', 'sfl_category', implode(', ', $categories)) ); 133 } 132 $doc->addField( $this->getLuceneField('text', 'sfl_category', implode(' ', $categories)) ); 133 } 134 135 $doc->addField( $this->getLuceneField('unindexed', 'sfl_categories_cache', serialize($categories)) ); 134 136 135 137 $doc->addField($this->getLuceneField('unindexed', 'sfl_model', $this->getModelName())); … … 140 142 $this->addDocument($doc, $this->getModelGuid()); 141 143 142 $formatter = new sfAnsiColorFormatter(); 143 144 $this->getContext()->getEventDispatcher()->notify( 145 new sfEvent($this, 'command.log', array( 146 $formatter->formatSection('indexer', sprintf('Inserted model "%s" with PK = %s', $this->getModelName(), $this->getModel()->getPrimaryKey())) 147 )) 148 ); 144 // Intentional regression: this needs major clean up! 145 // $formatter = new sfAnsiColorFormatter(); 146 // 147 // $this->getContext()->getEventDispatcher()->notify( 148 // new sfEvent($this, 'command.log', array( 149 // $formatter->formatSection('indexer', sprintf('Inserted model "%s" with PK = %s', $this->getModelName(), $this->getModel()->getPrimaryKey())) 150 // )) 151 // ); 149 152 150 153 // restore culture in symfony i18n detection … … 166 169 { 167 170 // TODO: Clean this up 168 $formatter = new sfAnsiColorFormatter(); 169 170 $this->getContext()->getEventDispatcher()->notify( 171 new sfEvent($this, 'command.log', array( 172 $formatter->formatSection('indexer', sprintf('Deleted model "%s" with PK = %s', $this->getModelName(), $this->getModel()->getPrimaryKey())) 173 )) 174 ); 175 176 $categories = $this->getModelCategories(); 177 178 foreach ($categories as $category) 179 { 180 $this->removeCategory($category); 181 } 171 // Intentional regression: this needs major clean up! 172 // $formatter = new sfAnsiColorFormatter(); 173 // 174 // $this->getContext()->getEventDispatcher()->notify( 175 // new sfEvent($this, 'command.log', array( 176 // $formatter->formatSection('indexer', sprintf('Deleted model "%s" with PK = %s', $this->getModelName(), $this->getModel()->getPrimaryKey())) 177 // )) 178 // ); 182 179 } 183 180 plugins/sfLucenePlugin/branches/1.1/lib/storage/sfLuceneStorageFilesystem.class.php
r6489 r6657 20 20 protected $file; 21 21 22 public function __construct($file) 22 protected $mode; 23 24 public function __construct($file, $mode = 0777) 23 25 { 24 26 $this->file = $file; 27 $this->mode = $mode; 25 28 } 26 29 … … 39 42 $this->mkdir(dirname($this->file)); 40 43 41 return file_put_contents($this->file, $data); 44 $retval = file_put_contents($this->file, $data); 45 46 self::chmod($this->file, $this->mode); 47 48 return $retval; 42 49 } 43 50 … … 54 61 } 55 62 56 return mkdir($dir, 0777, true); 63 return mkdir($dir, $this->mode, true); 64 } 65 66 static public function chmod($file, $mode) 67 { 68 if (file_exists($file) && substr(sprintf('%o', fileperms($file)), -4) != sprintf('%o', $mode)) 69 { 70 chmod($file, 0777); 71 } 57 72 } 58 73 }