$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__;
}
$ok = false;
while ( !$ok ) {
try {
- $dbw->doAtomicSection( __METHOD__, function ( $dbw, $fname ) {
+ $dbw->doAtomicSection( __METHOD__, function ( IDatabase $dbw, $fname ) {
$dbw->insert( 'revision', self::$dummyRev, $fname );
$id = $dbw->insertId();
$toDelete[] = $id;
$maxId = max(
- (int)$dbw->selectField( 'archive', 'MAX(ar_rev_id)', [], __METHOD__ ),
- (int)$dbw->selectField( 'slots', 'MAX(slot_revision_id)', [], __METHOD__ )
+ (int)$dbw->selectField( 'archive', 'MAX(ar_rev_id)', [], $fname ),
+ (int)$dbw->selectField( 'slots', 'MAX(slot_revision_id)', [], $fname )
);
if ( $id <= $maxId ) {
$dbw->insert( 'revision', [ 'rev_id' => $maxId + 1 ] + self::$dummyRev, $fname );
self::$dummyRev = self::makeDummyRevisionRow( $dbw );
}
- $updates = $dbw->doAtomicSection( __METHOD__, function ( $dbw, $fname ) use ( $arIds ) {
+ $updates = $dbw->doAtomicSection( __METHOD__, function ( IDatabase $dbw, $fname ) use ( $arIds ) {
// Create new rev_ids by inserting dummy rows into revision and then deleting them.
$dbw->insert( 'revision', array_fill( 0, count( $arIds ), self::$dummyRev ), $fname );
$revIds = $dbw->selectFieldValues(
$rev = null;
$mainPage = Title::newMainPage();
- $pageId = $mainPage ? $mainPage->getArticleId() : null;
+ $pageId = $mainPage ? $mainPage->getArticleID() : null;
if ( $pageId ) {
$rev = $dbw->selectRow(
'revision',