X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FpopulateFilearchiveSha1.php;h=7557a42ff4344b4ccc2509a33cdc276ebbc6beb2;hb=f43fa6f4f0e2cb60b8543daad661b48a3e0653a9;hp=5a67262b68de55bfa1ed2997b275a26216097409;hpb=13e788862bc4349d732286970d57cd8375a7d774;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/populateFilearchiveSha1.php b/maintenance/populateFilearchiveSha1.php index 5a67262b68..7557a42ff4 100644 --- a/maintenance/populateFilearchiveSha1.php +++ b/maintenance/populateFilearchiveSha1.php @@ -32,7 +32,7 @@ require_once __DIR__ . '/Maintenance.php'; class PopulateFilearchiveSha1 extends LoggedUpdateMaintenance { public function __construct() { parent::__construct(); - $this->mDescription = "Populate the fa_sha1 field from fa_storage_key"; + $this->addDescription( 'Populate the fa_sha1 field from fa_storage_key' ); } protected function getUpdateKey() { @@ -47,7 +47,7 @@ class PopulateFilearchiveSha1 extends LoggedUpdateMaintenance { $startTime = microtime( true ); $dbw = $this->getDB( DB_MASTER ); $table = 'filearchive'; - $conds = array( 'fa_sha1' => '', 'fa_storage_key IS NOT NULL' ); + $conds = [ '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 ); @@ -64,10 +64,10 @@ class PopulateFilearchiveSha1 extends LoggedUpdateMaintenance { do { $res = $dbw->select( $table, - array( 'fa_id', 'fa_storage_key' ), + [ 'fa_id', 'fa_storage_key' ], $conds, __METHOD__, - array( 'LIMIT' => $batchSize ) + [ 'LIMIT' => $batchSize ] ); $i = 0; @@ -78,8 +78,8 @@ class PopulateFilearchiveSha1 extends LoggedUpdateMaintenance { } $sha1 = LocalRepo::getHashFromKey( $row->fa_storage_key ); $dbw->update( $table, - array( 'fa_sha1' => $sha1 ), - array( 'fa_id' => $row->fa_id ), + [ 'fa_sha1' => $sha1 ], + [ 'fa_id' => $row->fa_id ], __METHOD__ ); $lastId = $row->fa_id; @@ -91,7 +91,7 @@ class PopulateFilearchiveSha1 extends LoggedUpdateMaintenance { break; } - // print status and let slaves catch up + // print status and let replica DBs catch up $this->output( sprintf( "id %d done (up to %d), %5.3f%% \r", $lastId, $endId, $lastId / $endId * 100 ) ); wfWaitForSlaves();