X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FpopulateRevisionLength.php;h=10408ec7cb501c46ca01afb18ba11a0bd6687bcd;hb=df2ef5194e88514081511302da45ebf19afcb248;hp=b73ac7f270da219b956756f6398a7a16f10ae023;hpb=cf8adc462e623a0a101ddfdf3de4fc7d7e891e60;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/populateRevisionLength.php b/maintenance/populateRevisionLength.php index b73ac7f270..10408ec7cb 100644 --- a/maintenance/populateRevisionLength.php +++ b/maintenance/populateRevisionLength.php @@ -33,7 +33,7 @@ require_once __DIR__ . '/Maintenance.php'; class PopulateRevisionLength extends LoggedUpdateMaintenance { public function __construct() { parent::__construct(); - $this->mDescription = "Populates the rev_len and ar_len fields"; + $this->addDescription( 'Populates the rev_len and ar_len fields' ); $this->setBatchSize( 200 ); } @@ -92,22 +92,22 @@ class PopulateRevisionLength extends LoggedUpdateMaintenance { $res = $db->select( $table, $fields, - array( + [ "$idCol >= $blockStart", "$idCol <= $blockEnd", "{$prefix}_len IS NULL" - ), + ], __METHOD__ ); - $db->begin( __METHOD__ ); + $this->beginTransaction( $db, __METHOD__ ); # Go through and update rev_len from these rows. foreach ( $res as $row ) { if ( $this->upgradeRow( $row, $table, $idCol, $prefix ) ) { $count++; } } - $db->commit( __METHOD__ ); + $this->commitTransaction( $db, __METHOD__ ); $blockStart += $this->mBatchSize; $blockEnd += $this->mBatchSize; @@ -142,8 +142,8 @@ class PopulateRevisionLength extends LoggedUpdateMaintenance { # Update the row... $db->update( $table, - array( "{$prefix}_len" => $content->getSize() ), - array( $idCol => $row->$idCol ), + [ "{$prefix}_len" => $content->getSize() ], + [ $idCol => $row->$idCol ], __METHOD__ );