Index: trunk/phase3/maintenance/rebuildImages.php |
— | — | @@ -148,8 +148,7 @@ |
149 | 149 | } |
150 | 150 | |
151 | 151 | function buildOldImage() { |
152 | | - $this->buildTable( 'oldimage', 'oi_archive_name', |
153 | | - array( $this, 'oldimageCallback' ) ); |
| 152 | + $this->buildTable( 'oldimage', 'oi_archive_name', array( $this, 'oldimageCallback' ) ); |
154 | 153 | } |
155 | 154 | |
156 | 155 | function oldimageCallback( $row, $copy ) { |
— | — | @@ -164,42 +163,33 @@ |
165 | 164 | } |
166 | 165 | |
167 | 166 | function crawlMissing() { |
168 | | - $repo = RepoGroup::singleton()->getLocalRepo(); |
169 | | - $repo->enumFilesInFS( array( $this, 'checkMissingImage' ) ); |
| 167 | + $this->getRepo()->enumFiles( array( $this, 'checkMissingImage' ) ); |
170 | 168 | } |
171 | 169 | |
172 | 170 | function checkMissingImage( $fullpath ) { |
173 | 171 | $filename = wfBaseName( $fullpath ); |
174 | | - if ( is_dir( $fullpath ) ) { |
175 | | - return; |
176 | | - } |
177 | | - if ( is_link( $fullpath ) ) { |
178 | | - $this->output( "skipping symlink at $fullpath\n" ); |
179 | | - return; |
180 | | - } |
181 | 172 | $row = $this->dbw->selectRow( 'image', |
182 | 173 | array( 'img_name' ), |
183 | 174 | array( 'img_name' => $filename ), |
184 | 175 | __METHOD__ ); |
185 | 176 | |
186 | | - if ( $row ) { |
187 | | - // already known, move on |
188 | | - return; |
189 | | - } else { |
| 177 | + if ( !$row ) { // file not registered |
190 | 178 | $this->addMissingImage( $filename, $fullpath ); |
191 | 179 | } |
192 | 180 | } |
193 | 181 | |
194 | 182 | function addMissingImage( $filename, $fullpath ) { |
195 | | - $timestamp = $this->dbw->timestamp( filemtime( $fullpath ) ); |
196 | | - |
197 | 183 | global $wgContLang; |
| 184 | + |
| 185 | + $timestamp = $this->dbw->timestamp( $this->getRepo()->getFileTimestamp( $fullpath ) ); |
| 186 | + |
198 | 187 | $altname = $wgContLang->checkTitleEncoding( $filename ); |
199 | 188 | if ( $altname != $filename ) { |
200 | 189 | if ( $this->dryrun ) { |
201 | 190 | $filename = $altname; |
202 | 191 | $this->output( "Estimating transcoding... $altname\n" ); |
203 | 192 | } else { |
| 193 | + # @FIXME: create renameFile() |
204 | 194 | $filename = $this->renameFile( $filename ); |
205 | 195 | } |
206 | 196 | } |
Index: trunk/phase3/includes/filerepo/backend/FileBackend.php |
— | — | @@ -318,6 +318,7 @@ |
319 | 319 | |
320 | 320 | /** |
321 | 321 | * Check if a file exists at a storage path in the backend. |
| 322 | + * This returns false if only a directory exists at the path. |
322 | 323 | * |
323 | 324 | * $params include: |
324 | 325 | * src : source storage path |
— | — | @@ -489,7 +490,13 @@ |
490 | 491 | /** |
491 | 492 | * Base class for all single-write backends. |
492 | 493 | * This class defines the methods as abstract that subclasses must implement. |
| 494 | + * Callers outside of FileBackend and its helper classes, such as FileOp, |
| 495 | + * should only call functions that are present in FileBackendBase. |
493 | 496 | * |
| 497 | + * The FileBackendBase operations are implemented using primitive functions |
| 498 | + * such as storeInternal(), copyInternal(), deleteInternal() and the like. |
| 499 | + * This class is also responsible for path resolution and sanitization. |
| 500 | + * |
494 | 501 | * @ingroup FileBackend |
495 | 502 | * @since 1.19 |
496 | 503 | */ |
Index: trunk/phase3/includes/filerepo/FileRepo.php |
— | — | @@ -1214,7 +1214,8 @@ |
1215 | 1215 | } |
1216 | 1216 | |
1217 | 1217 | /** |
1218 | | - * Call a callback function for every public file in the repository. |
| 1218 | + * Call a callback function for every public regular file in the repository. |
| 1219 | + * This only acts on the current version of files, not any old versions. |
1219 | 1220 | * May use either the database or the filesystem. |
1220 | 1221 | * |
1221 | 1222 | * @param $callback Array|string |
Index: trunk/phase3/includes/AutoLoader.php |
— | — | @@ -485,6 +485,7 @@ |
486 | 486 | 'TempFSFile' => 'includes/filerepo/file/TempFSFile.php', |
487 | 487 | |
488 | 488 | # includes/filerepo/backend |
| 489 | + 'ContainerShardListIterator' => 'includes/filerepo/backend/FileBackend.php', |
489 | 490 | 'FileBackendGroup' => 'includes/filerepo/backend/FileBackendGroup.php', |
490 | 491 | 'FileBackendBase' => 'includes/filerepo/backend/FileBackend.php', |
491 | 492 | 'FileBackend' => 'includes/filerepo/backend/FileBackend.php', |