X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FpopulateFilearchiveSha1.php;h=27e692d156b8a712f3d3e2e14187a1c89c5a4115;hb=b9e092fa4bfece804ef1f444a98fe7f045dfca1f;hp=e9baef9aa0161f9b0a37d92f9dcfc0aa795ba967;hpb=881c1d30e418ebf85c24ae739ed22de397634932;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/populateFilearchiveSha1.php b/maintenance/populateFilearchiveSha1.php index e9baef9aa0..27e692d156 100644 --- a/maintenance/populateFilearchiveSha1.php +++ b/maintenance/populateFilearchiveSha1.php @@ -48,8 +48,14 @@ class PopulateFilearchiveSha1 extends LoggedUpdateMaintenance { $dbw = wfGetDB( DB_MASTER ); $table = 'filearchive'; $conds = array( 'fa_sha1' => '', 'fa_storage_key IS NOT NULL' ); + + if ( !$dbw->fieldExists( $table, 'fa_sha1', __METHOD__ ) ) { + $this->output( "fa_sha1 column does not exist\n\n", true ); + return false; + } + $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 +71,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 ),