X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FpopulateArchiveRevId.php;h=84b962af3719ae49b4fafa6781a65b712e4abd58;hb=13832025a46df3e0edd658dfb756159c2c5ac722;hp=96fcebf40973fb909d3a88ddd029301124ebdc1b;hpb=9d8759327a0285b7f2e85678e71961bc28a321a2;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/populateArchiveRevId.php b/maintenance/populateArchiveRevId.php index 96fcebf409..84b962af37 100644 --- a/maintenance/populateArchiveRevId.php +++ b/maintenance/populateArchiveRevId.php @@ -43,6 +43,15 @@ class PopulateArchiveRevId extends LoggedUpdateMaintenance { $this->setBatchSize( 100 ); } + /** + * @param IDatabase $dbw + * @return bool + */ + public static function isNewInstall( IDatabase $dbw ) { + return $dbw->selectRowCount( 'archive' ) === 0 && + $dbw->selectRowCount( 'revision' ) === 1; + } + protected function getUpdateKey() { return __CLASS__; } @@ -113,7 +122,7 @@ class PopulateArchiveRevId extends LoggedUpdateMaintenance { $dbw->doAtomicSection( __METHOD__, function ( IDatabase $dbw, $fname ) { $dbw->insert( 'revision', self::$dummyRev, $fname ); $id = $dbw->insertId(); - $toDelete[] = $id; + $toDelete = [ $id ]; $maxId = max( (int)$dbw->selectField( 'archive', 'MAX(ar_rev_id)', [], $fname ),