// 1.19
array( 'addIndex', 'logging', 'type_action', 'patch-logging-type-action-index.sql'),
+ array( 'addField', 'revision', 'rev_sha1', 'patch-rev_sha1.sql' ),
array( 'doMigrateUserOptions' ),
array( 'dropField', 'user', 'user_options', 'patch-drop-user_options.sql' ),
- array( 'addField', 'revision', 'rev_sha1', 'patch-rev_sha1.sql' ),
array( 'addField', 'archive', 'ar_sha1', 'patch-ar_sha1.sql' ),
array( 'addIndex', 'page', 'page_redirect_namespace_len', 'patch-page_redirect_namespace_len.sql' ),
array( 'addField', 'uploadstash', 'us_chunk_inx', 'patch-uploadstash_chunk.sql' ),
return true;
}
- $tableName = $this->db->tableName( $table );
- $res = $this->db->query( "SELECT $field FROM $tableName LIMIT 0", __METHOD__ );
- $flags = explode( ' ', mysql_field_flags( $res->result, 0 ) );
-
- if ( in_array( 'binary', $flags ) ) {
+ $fieldInfo = $this->db->fieldInfo( $table, $field );
+ if ( $fieldInfo->isBinary() ) {
$this->output( "...$table table has correct $field encoding.\n" );
} else {
$this->applyPatch( $patchFile, false, "Fixing $field encoding on $table table" );
foreach ( $info as $row ) {
if ( $row->Column_name == $field ) {
$this->output( "...index $index on table $table includes field $field.\n" );
+
return true;
}
}
}
$this->output( "...index $index on table $table has no field $field; added.\n" );
+
return false;
}
if ( $this->db->tableExists( "interwiki", __METHOD__ ) ) {
$this->output( "...already have interwiki table\n" );
+
return;
}
}
if ( $meta->isMultipleKey() ) {
$this->output( "...indexes seem up to 20031107 standards.\n" );
+
return;
}
$info = $this->db->fieldInfo( 'imagelinks', 'il_from' );
if ( !$info || $info->type() !== 'string' ) {
$this->output( "...il_from OK\n" );
+
return;
}
$nontalk = $this->db->selectField( 'watchlist', 'count(*)', 'NOT (wl_namespace & 1)', __METHOD__ );
if ( $talk == $nontalk ) {
$this->output( "...watchlist talk page rows already present.\n" );
+
return;
}
function doSchemaRestructuring() {
if ( $this->db->tableExists( 'page', __METHOD__ ) ) {
$this->output( "...page table already exists.\n" );
+
return;
}
$this->output( sprintf( "<b> %-60s %3s %5s</b>\n", 'Title', 'NS', 'Count' ) );
$duplicate = array();
foreach ( $rows as $row ) {
- if ( ! isset( $duplicate[$row->cur_namespace] ) ) {
+ if ( !isset( $duplicate[$row->cur_namespace] ) ) {
$duplicate[$row->cur_namespace] = array();
}
$duplicate[$row->cur_namespace][] = $row->cur_title;
protected function doPagelinksUpdate() {
if ( $this->db->tableExists( 'pagelinks', __METHOD__ ) ) {
$this->output( "...already have pagelinks table.\n" );
+
return;
}
$duper = new UserDupes( $this->db, array( $this, 'output' ) );
if ( $duper->hasUniqueIndex() ) {
$this->output( "...already have unique user_name index.\n" );
+
return;
}
} else {
$this->output( "...user_groups table exists and is in current format.\n" );
}
+
return;
}
$this->output( "*** WARNING: couldn't locate user_rights table or field for upgrade.\n" );
$this->output( "*** You may need to manually configure some sysops by manipulating\n" );
$this->output( "*** the user_groups table.\n" );
+
return;
}
}
}
if ( $info->isNullable() ) {
$this->output( "...wl_notificationtimestamp is already nullable.\n" );
+
return;
}
protected function doTemplatelinksUpdate() {
if ( $this->db->tableExists( 'templatelinks', __METHOD__ ) ) {
$this->output( "...templatelinks table already exists\n" );
+
return;
}
'tl_title' => $row->pl_title,
), __METHOD__
);
-
}
} else {
// Fast update
protected function doBacklinkingIndicesUpdate() {
if ( !$this->indexHasField( 'pagelinks', 'pl_namespace', 'pl_from' ) ||
!$this->indexHasField( 'templatelinks', 'tl_namespace', 'tl_from' ) ||
- !$this->indexHasField( 'imagelinks', 'il_to', 'il_from' ) )
- {
+ !$this->indexHasField( 'imagelinks', 'il_to', 'il_from' )
+ ) {
$this->applyPatch( 'patch-backlinkindexes.sql', false, "Updating backlinking indices" );
}
}
protected function doRestrictionsUpdate() {
if ( $this->db->tableExists( 'page_restrictions', __METHOD__ ) ) {
$this->output( "...page_restrictions table already exists.\n" );
+
return;
}
protected function doCategoryPopulation() {
if ( $this->updateRowExists( 'populate category' ) ) {
$this->output( "...category table already populated.\n" );
+
return;
}
return true;
}
- if ( $wgProfileToDatabase === true && ! $this->db->tableExists( 'profiling', __METHOD__ ) ) {
+ if ( $wgProfileToDatabase === true && !$this->db->tableExists( 'profiling', __METHOD__ ) ) {
$this->applyPatch( 'patch-profiling.sql', false, 'Add profiling table' );
}
}
return true;
} elseif ( $this->db->fieldExists( 'profiling', 'pf_memory', __METHOD__ ) ) {
$this->output( "...profiling table has pf_memory field.\n" );
+
return true;
}
+
return $this->applyPatch( 'patch-profiling-memory.sql', false, "Adding pf_memory field to table profiling" );
}
if ( !$info ) {
$this->applyPatch( 'patch-filearchive-user-index.sql', false, "Updating filearchive indices" );
}
+
return true;
}
$info = $this->db->indexInfo( 'pagelinks', 'pl_namespace' );
if ( is_array( $info ) && !$info[0]->Non_unique ) {
$this->output( "...pl_namespace, tl_namespace, il_to indices are already UNIQUE.\n" );
+
return true;
}
if ( $this->skipSchema ) {
$this->output( "...skipping schema change (making pl_namespace, tl_namespace and il_to indices UNIQUE).\n" );
+
return false;
}
protected function doUpdateMimeMinorField() {
if ( $this->updateRowExists( 'mime_minor_length' ) ) {
$this->output( "...*_mime_minor fields are already long enough.\n" );
+
return;
}
protected function doClFieldsUpdate() {
if ( $this->updateRowExists( 'cl_fields_update' ) ) {
$this->output( "...categorylinks up-to-date.\n" );
+
return;
}
}
if ( $info->isNullable() ) {
$this->output( "...user_last_timestamp is already nullable.\n" );
+
return;
}
$info = $this->db->indexInfo( 'iwlinks', 'iwl_prefix_title_from' );
if ( is_array( $info ) && $info[0]->Non_unique ) {
$this->output( "...iwl_prefix_title_from index is already non-UNIQUE.\n" );
+
return true;
}
if ( $this->skipSchema ) {
$this->output( "...skipping schema change (making iwl_prefix_title_from index non-UNIQUE).\n" );
+
return false;
}