/**
* Mysql update list and mysql-specific update functions.
- *
+ *
* @ingroup Deployment
* @since 1.17
*/
class MysqlUpdater extends DatabaseUpdater {
-
+
protected function getCoreUpdateList() {
return array(
// 1.2
array( 'doCollationUpdate' ),
array( 'addTable', 'msg_resource', 'patch-msg_resource.sql' ),
array( 'addTable', 'module_deps', 'patch-module_deps.sql' ),
+ array( 'dropIndex', 'archive', 'ar_page_revid', 'patch-archive_kill_ar_page_revid.sql' ),
+ array( 'addIndex', 'archive', 'ar_revid', 'patch-archive_ar_revid.sql' ),
);
}
$this->output( "...$table table has correct $field encoding.\n" );
} else {
$this->output( "Fixing $field encoding on $table table... " );
- $this->db->applyPatch( $patchFile );
+ $this->applyPatch( $patchFile );
$this->output( "ok\n" );
}
}
}
protected function doOldLinksUpdate() {
- $cl = new ConvertLinks();
+ $cl = $this->maintenance->runChild( 'ConvertLinks' );
$cl->execute();
}
$this->output( wfTimestamp( TS_DB ) );
$this->output( "......<b>Found duplicate entries</b>\n" );
$this->output( sprintf( "<b> %-60s %3s %5s</b>\n", 'Title', 'NS', 'Count' ) );
+ $duplicate = array();
foreach ( $rows as $row ) {
if ( ! isset( $duplicate[$row->cur_namespace] ) ) {
$duplicate[$row->cur_namespace] = array();
$prev_namespace = $row->cur_namespace;
}
$sql = "DELETE FROM $cur WHERE cur_id IN ( " . join( ',', $deleteId ) . ')';
- $rows = $this->db->query( $sql, __METHOD__ );
+ $this->db->query( $sql, __METHOD__ );
$this->output( wfTimestamp( TS_DB ) );
$this->output( "......<b>Deleted</b> " . $this->db->affectedRows() . " records.\n" );
}
$likeprefix = str_replace( '_', '\\_', $prefix );
$sql = "UPDATE $pagelinks
- SET pl_namespace=$ns,
- pl_title=TRIM(LEADING '$prefix:' FROM pl_title)
- WHERE pl_namespace=0
- AND pl_title LIKE '$likeprefix:%'";
+ SET pl_namespace=$ns,
+ pl_title=TRIM(LEADING '$prefix:' FROM pl_title)
+ WHERE pl_namespace=0
+ AND pl_title LIKE '$likeprefix:%'";
$this->db->query( $sql, __METHOD__ );
$this->output( "ok\n" );
}
protected function doUserUniqueUpdate() {
- $duper = new UserDupes( $this->db );
+ $duper = new UserDupes( $this->db, array( $this, 'output' ) );
if ( $duper->hasUniqueIndex() ) {
$this->output( "...already have unique user_name index.\n" );
return;
*/
protected function doWatchlistNull() {
$info = $this->db->fieldInfo( 'watchlist', 'wl_notificationtimestamp' );
- if ( $info->nullable() ) {
+ if ( $info->isNullable() ) {
$this->output( "...wl_notificationtimestamp is already nullable.\n" );
return;
}
* @see bug 3946
*/
protected function doPageRandomUpdate() {
- $this->output( "Setting page_random to a random value on rows where it equals 0..." );
-
$page = $this->db->tableName( 'page' );
$this->db->query( "UPDATE $page SET page_random = RAND() WHERE page_random = 0", __METHOD__ );
$rows = $this->db->affectedRows();
- $this->output( "changed $rows rows\n" );
+ if( $rows ) {
+ $this->output( "Set page_random to a random value on $rows rows where it was set to 0\n" );
+ } else {
+ $this->output( "...no page_random rows needed to be set\n" );
+ }
}
protected function doTemplatelinksUpdate() {
$this->output( "...page_restrictions table already exists.\n" );
return;
}
-
+
$this->output( "Creating page_restrictions table..." );
$this->applyPatch( 'patch-page_restrictions.sql' );
$this->applyPatch( 'patch-page_restrictions_sortkey.sql' );
$this->output( "ok\n" );
$this->output( "Migrating old restrictions to new table...\n" );
- $task = new UpdateRestrictions();
+ $task = $this->maintenance->runChild( 'UpdateRestrictions' );
$task->execute();
}
"may want to hit Ctrl-C and do this manually with maintenance/\n" .
"populateCategory.php.\n"
);
- $task = new PopulateCategory();
+ $task = $this->maintenance->runChild( 'PopulateCategory' );
$task->execute();
$this->output( "Done populating category table.\n" );
}
return;
}
- $task = new PopulateParentId();
+ $task = $this->maintenance->runChild( 'PopulateParentId' );
$task->execute();
}
return;
}
- $task = new PopulateRevisionLength();
+ $task = $this->maintenance->runChild( 'PopulateRevisionLength' );
$task->execute();
}