X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FpopulateFilearchiveSha1.php;h=942f3f2b906c6c381eb71d32df7620db0572eb86;hb=df2ef5194e88514081511302da45ebf19afcb248;hp=a3099f961543052a64275ff0b5978cf9f7a92a28;hpb=18ec10a358b08931e27f0eb44daf8ccd26159b18;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/populateFilearchiveSha1.php b/maintenance/populateFilearchiveSha1.php index a3099f9615..942f3f2b90 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() { @@ -45,9 +45,9 @@ class PopulateFilearchiveSha1 extends LoggedUpdateMaintenance { public function doDBUpdates() { $startTime = microtime( true ); - $dbw = wfGetDB( DB_MASTER ); + $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;