From 08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Mon, 12 Aug 2013 09:28:15 +0200 Subject: Update to MediaWiki 1.21.1 --- maintenance/deleteArchivedFiles.inc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'maintenance/deleteArchivedFiles.inc') diff --git a/maintenance/deleteArchivedFiles.inc b/maintenance/deleteArchivedFiles.inc index e638b17c..792ee6c6 100644 --- a/maintenance/deleteArchivedFiles.inc +++ b/maintenance/deleteArchivedFiles.inc @@ -27,7 +27,7 @@ * @ingroup Maintenance */ class DeleteArchivedFilesImplementation { - static public function doDelete( $output, $force ) { + public static function doDelete( $output, $force ) { # Data should come off the master, wrapped in a transaction $dbw = wfGetDB( DB_MASTER ); $dbw->begin( __METHOD__ ); @@ -35,14 +35,19 @@ class DeleteArchivedFilesImplementation { $repo = RepoGroup::singleton()->getLocalRepo(); # Get "active" revisions from the filearchive table $output->handleOutput( "Searching for and deleting archived files...\n" ); - $res = $dbw->query( "SELECT fa_id,fa_storage_group,fa_storage_key FROM $tbl_arch" ); + $res = $dbw->query( "SELECT fa_id,fa_storage_group,fa_storage_key,fa_sha1 FROM $tbl_arch" ); $count = 0; foreach ( $res as $row ) { $key = $row->fa_storage_key; $group = $row->fa_storage_group; $id = $row->fa_id; $path = $repo->getZonePath( 'deleted' ) . '/' . $repo->getDeletedHashPath( $key ) . $key; - $sha1 = substr( $key, 0, strcspn( $key, '.' ) ); + if( isset( $row->fa_sha1 ) ) { + $sha1 = $row->fa_sha1; + } else { + // old row, populate from key + $sha1 = LocalRepo::getHashFromKey( $key ); + } // Check if the file is used anywhere... $inuse = $dbw->selectField( 'oldimage', '1', array( 'oi_sha1' => $sha1, -- cgit v1.2.3-54-g00ecf