X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FpopulateArchiveRevId.php;h=84b962af3719ae49b4fafa6781a65b712e4abd58;hb=93d9da40d3153ee8f63ffbd7bc72f08d62e11efd;hp=96fcebf40973fb909d3a88ddd029301124ebdc1b;hpb=956ffb9cd77bb9748cf7bc425d50f0eea7e3abdd;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 ),