summaryrefslogtreecommitdiff
path: root/maintenance/deleteArchivedFiles.inc
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2014-12-27 15:41:37 +0100
committerPierre Schmitz <pierre@archlinux.de>2014-12-31 11:43:28 +0100
commitc1f9b1f7b1b77776192048005dcc66dcf3df2bfb (patch)
tree2b38796e738dd74cb42ecd9bfd151803108386bc /maintenance/deleteArchivedFiles.inc
parentb88ab0086858470dd1f644e64cb4e4f62bb2be9b (diff)
Update to MediaWiki 1.24.1
Diffstat (limited to 'maintenance/deleteArchivedFiles.inc')
-rw-r--r--maintenance/deleteArchivedFiles.inc14
1 files changed, 11 insertions, 3 deletions
diff --git a/maintenance/deleteArchivedFiles.inc b/maintenance/deleteArchivedFiles.inc
index d58e9a40..0c0b34a3 100644
--- a/maintenance/deleteArchivedFiles.inc
+++ b/maintenance/deleteArchivedFiles.inc
@@ -39,6 +39,10 @@ class DeleteArchivedFilesImplementation {
$count = 0;
foreach ( $res as $row ) {
$key = $row->fa_storage_key;
+ if ( !strlen( $key ) ) {
+ $output->handleOutput( "Entry with ID {$row->fa_id} has empty key, skipping\n" );
+ continue;
+ }
$group = $row->fa_storage_group;
$id = $row->fa_id;
$path = $repo->getZonePath( 'deleted' ) . '/' . $repo->getDeletedHashPath( $key ) . $key;
@@ -49,9 +53,13 @@ class DeleteArchivedFilesImplementation {
$sha1 = LocalRepo::getHashFromKey( $key );
}
// Check if the file is used anywhere...
- $inuse = $dbw->selectField( 'oldimage', '1',
- array( 'oi_sha1' => $sha1,
- 'oi_deleted & ' . File::DELETED_FILE => File::DELETED_FILE ),
+ $inuse = $dbw->selectField(
+ 'oldimage',
+ '1',
+ array(
+ 'oi_sha1' => $sha1,
+ 'oi_deleted & ' . File::DELETED_FILE => File::DELETED_FILE
+ ),
__METHOD__,
array( 'FOR UPDATE' )
);