From 8200b504427836957ee677afdb4fcf4c3c1ef133 Mon Sep 17 00:00:00 2001 From: Reedy Date: Thu, 25 Oct 2012 14:27:49 +0100 Subject: [PATCH] Seems we have error conditions where fa_storage_key == '' continue! Change-Id: I28a06bf6a806fd4db44af6822ca3cd93747481fb --- maintenance/populateFilearchiveSha1.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/maintenance/populateFilearchiveSha1.php b/maintenance/populateFilearchiveSha1.php index e9baef9aa0..6c57fde622 100644 --- a/maintenance/populateFilearchiveSha1.php +++ b/maintenance/populateFilearchiveSha1.php @@ -49,7 +49,7 @@ class PopulateFilearchiveSha1 extends LoggedUpdateMaintenance { $table = 'filearchive'; $conds = array( 'fa_sha1' => '', 'fa_storage_key IS NOT NULL' ); $this->output( "Populating fa_sha1 field from fa_storage_key\n" ); - $endId = $dbw->selectField( $table, 'MAX(fa_id)', false, __METHOD__ ); + $endId = $dbw->selectField( $table, 'MAX(fa_id)', false, __METHOD__ ); $batchSize = $this->mBatchSize; $done = 0; @@ -65,6 +65,10 @@ class PopulateFilearchiveSha1 extends LoggedUpdateMaintenance { $i = 0; foreach ( $res as $row ) { + if ( $row->fa_storage_key == '' ) { + // Revision was missing pre-deletion + continue; + } $sha1 = LocalRepo::getHashFromKey( $row->fa_storage_key ); $dbw->update( $table, array( 'fa_sha1' => $sha1 ), -- 2.20.1