Merge "Clean up applyPatch() usage in the installer."
This commit is contained in:
commit
21238992a5
5 changed files with 71 additions and 155 deletions
|
|
@ -253,9 +253,9 @@ abstract class DatabaseUpdater {
|
|||
|
||||
/**
|
||||
* Add a maintenance script to be run after the database updates are complete.
|
||||
*
|
||||
*
|
||||
* @since 1.19
|
||||
*
|
||||
*
|
||||
* @param $class string Name of a Maintenance subclass
|
||||
*/
|
||||
public function addPostDatabaseUpdateMaintenance( $class ) {
|
||||
|
|
@ -273,7 +273,7 @@ abstract class DatabaseUpdater {
|
|||
|
||||
/**
|
||||
* @since 1.17
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getPostDatabaseUpdateMaintenance() {
|
||||
|
|
@ -463,13 +463,20 @@ abstract class DatabaseUpdater {
|
|||
* Applies a SQL patch
|
||||
* @param $path String Path to the patch file
|
||||
* @param $isFullPath Boolean Whether to treat $path as a relative or not
|
||||
* @param $msg String Description of the patch
|
||||
*/
|
||||
protected function applyPatch( $path, $isFullPath = false ) {
|
||||
if ( $isFullPath ) {
|
||||
$this->db->sourceFile( $path );
|
||||
} else {
|
||||
$this->db->sourceFile( $this->db->patchPath( $path ) );
|
||||
protected function applyPatch( $path, $isFullPath = false, $msg = null ) {
|
||||
if ( $msg === null ) {
|
||||
$msg = "Applying $path patch";
|
||||
}
|
||||
|
||||
if ( !$isFullPath ) {
|
||||
$path = $this->db->patchPath( $path );
|
||||
}
|
||||
|
||||
$this->output( "$msg ..." );
|
||||
$this->db->sourceFile( $path );
|
||||
$this->output( "done.\n" );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -482,9 +489,7 @@ abstract class DatabaseUpdater {
|
|||
if ( $this->db->tableExists( $name, __METHOD__ ) ) {
|
||||
$this->output( "...$name table already exists.\n" );
|
||||
} else {
|
||||
$this->output( "Creating $name table..." );
|
||||
$this->applyPatch( $patch, $fullpath );
|
||||
$this->output( "done.\n" );
|
||||
$this->applyPatch( $patch, $fullpath, "Creating $name table" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -501,9 +506,7 @@ abstract class DatabaseUpdater {
|
|||
} elseif ( $this->db->fieldExists( $table, $field, __METHOD__ ) ) {
|
||||
$this->output( "...have $field field in $table table.\n" );
|
||||
} else {
|
||||
$this->output( "Adding $field field to table $table..." );
|
||||
$this->applyPatch( $patch, $fullpath );
|
||||
$this->output( "done.\n" );
|
||||
$this->applyPatch( $patch, $fullpath, "Adding $field field to table $table" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -518,9 +521,7 @@ abstract class DatabaseUpdater {
|
|||
if ( $this->db->indexExists( $table, $index, __METHOD__ ) ) {
|
||||
$this->output( "...index $index already set on $table table.\n" );
|
||||
} else {
|
||||
$this->output( "Adding index $index to table $table... " );
|
||||
$this->applyPatch( $patch, $fullpath );
|
||||
$this->output( "done.\n" );
|
||||
$this->applyPatch( $patch, $fullpath, "Adding index $index to table $table" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -534,9 +535,7 @@ abstract class DatabaseUpdater {
|
|||
*/
|
||||
protected function dropField( $table, $field, $patch, $fullpath = false ) {
|
||||
if ( $this->db->fieldExists( $table, $field, __METHOD__ ) ) {
|
||||
$this->output( "Table $table contains $field field. Dropping... " );
|
||||
$this->applyPatch( $patch, $fullpath );
|
||||
$this->output( "done.\n" );
|
||||
$this->applyPatch( $patch, $fullpath, "Table $table contains $field field. Dropping" );
|
||||
} else {
|
||||
$this->output( "...$table table does not contain $field field.\n" );
|
||||
}
|
||||
|
|
@ -552,9 +551,7 @@ abstract class DatabaseUpdater {
|
|||
*/
|
||||
protected function dropIndex( $table, $index, $patch, $fullpath = false ) {
|
||||
if ( $this->db->indexExists( $table, $index, __METHOD__ ) ) {
|
||||
$this->output( "Dropping $index index from table $table... " );
|
||||
$this->applyPatch( $patch, $fullpath );
|
||||
$this->output( "done.\n" );
|
||||
$this->applyPatch( $patch, $fullpath, "Dropping $index index from table $table" );
|
||||
} else {
|
||||
$this->output( "...$index key doesn't exist.\n" );
|
||||
}
|
||||
|
|
@ -567,9 +564,7 @@ abstract class DatabaseUpdater {
|
|||
*/
|
||||
protected function dropTable( $table, $patch, $fullpath = false ) {
|
||||
if ( $this->db->tableExists( $table, __METHOD__ ) ) {
|
||||
$this->output( "Dropping table $table... " );
|
||||
$this->applyPatch( $patch, $fullpath );
|
||||
$this->output( "done.\n" );
|
||||
$this->applyPatch( $patch, $fullpath, "Dropping table $table" );
|
||||
} else {
|
||||
$this->output( "...$table doesn't exist.\n" );
|
||||
}
|
||||
|
|
@ -592,10 +587,8 @@ abstract class DatabaseUpdater {
|
|||
} elseif( $this->updateRowExists( $updateKey ) ) {
|
||||
$this->output( "...$field in table $table already modified by patch $patch.\n" );
|
||||
} else {
|
||||
$this->output( "Modifying $field field of table $table..." );
|
||||
$this->applyPatch( $patch, $fullpath );
|
||||
$this->applyPatch( $patch, $fullpath, "Modifying $field field of table $table" );
|
||||
$this->insertUpdateRow( $updateKey );
|
||||
$this->output( "done.\n" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -688,9 +681,7 @@ abstract class DatabaseUpdater {
|
|||
return;
|
||||
}
|
||||
|
||||
$this->output( "Converting tc_time from UNIX epoch to MediaWiki timestamp... " );
|
||||
$this->applyPatch( 'patch-tc-timestamp.sql' );
|
||||
$this->output( "done.\n" );
|
||||
$this->applyPatch( 'patch-tc-timestamp.sql', false, "Converting tc_time from UNIX epoch to MediaWiki timestamp" );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -232,9 +232,7 @@ class MysqlUpdater extends DatabaseUpdater {
|
|||
if ( in_array( 'binary', $flags ) ) {
|
||||
$this->output( "...$table table has correct $field encoding.\n" );
|
||||
} else {
|
||||
$this->output( "Fixing $field encoding on $table table... " );
|
||||
$this->applyPatch( $patchFile );
|
||||
$this->output( "done.\n" );
|
||||
$this->applyPatch( $patchFile, false, "Fixing $field encoding on $table table" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -271,12 +269,8 @@ class MysqlUpdater extends DatabaseUpdater {
|
|||
return;
|
||||
}
|
||||
|
||||
$this->output( 'Creating interwiki table...' );
|
||||
$this->applyPatch( 'patch-interwiki.sql' );
|
||||
$this->output( "done.\n" );
|
||||
$this->output( 'Adding default interwiki definitions...' );
|
||||
$this->applyPatch( "$IP/maintenance/interwiki.sql", true );
|
||||
$this->output( "done.\n" );
|
||||
$this->applyPatch( 'patch-interwiki.sql', false, 'Creating interwiki table' );
|
||||
$this->applyPatch( "$IP/maintenance/interwiki.sql", true, 'Adding default interwiki definitions' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -292,9 +286,7 @@ class MysqlUpdater extends DatabaseUpdater {
|
|||
return;
|
||||
}
|
||||
|
||||
$this->output( "Updating indexes to 20031107..." );
|
||||
$this->applyPatch( 'patch-indexes.sql', true );
|
||||
$this->output( "done.\n" );
|
||||
$this->applyPatch( 'patch-indexes.sql', true, "Updating indexes to 20031107" );
|
||||
}
|
||||
|
||||
protected function doOldLinksUpdate() {
|
||||
|
|
@ -309,10 +301,9 @@ class MysqlUpdater extends DatabaseUpdater {
|
|||
return;
|
||||
}
|
||||
|
||||
$this->output( "Fixing ancient broken imagelinks table.\n" );
|
||||
$this->output( "NOTE: you will have to run maintenance/refreshLinks.php after this.\n" );
|
||||
$this->applyPatch( 'patch-fix-il_from.sql' );
|
||||
$this->output( "done.\n" );
|
||||
if( $this->applyPatch( 'patch-fix-il_from.sql', false, "Fixing ancient broken imagelinks table." ) ) {
|
||||
$this->output("NOTE: you will have to run maintenance/refreshLinks.php after this." );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -534,9 +525,7 @@ class MysqlUpdater extends DatabaseUpdater {
|
|||
return;
|
||||
}
|
||||
|
||||
$this->output( "Converting links and brokenlinks tables to pagelinks... " );
|
||||
$this->applyPatch( 'patch-pagelinks.sql' );
|
||||
$this->output( "done.\n" );
|
||||
$this->applyPatch( 'patch-pagelinks.sql', false, "Converting links and brokenlinks tables to pagelinks" );
|
||||
|
||||
global $wgContLang;
|
||||
foreach ( MWNamespace::getCanonicalNamespaces() as $ns => $name ) {
|
||||
|
|
@ -572,9 +561,7 @@ class MysqlUpdater extends DatabaseUpdater {
|
|||
if ( !$duper->clearDupes() ) {
|
||||
$this->output( "WARNING: This next step will probably fail due to unfixed duplicates...\n" );
|
||||
}
|
||||
$this->output( "Adding unique index on user_name... " );
|
||||
$this->applyPatch( 'patch-user_nameindex.sql' );
|
||||
$this->output( "done.\n" );
|
||||
$this->applyPatch( 'patch-user_nameindex.sql', false, "Adding unique index on user_name" );
|
||||
}
|
||||
|
||||
protected function doUserGroupsUpdate() {
|
||||
|
|
@ -587,9 +574,7 @@ class MysqlUpdater extends DatabaseUpdater {
|
|||
$this->db->query( "ALTER TABLE $oldug RENAME TO $newug", __METHOD__ );
|
||||
$this->output( "done.\n" );
|
||||
|
||||
$this->output( "Re-adding fresh user_groups table... " );
|
||||
$this->applyPatch( 'patch-user_groups.sql' );
|
||||
$this->output( "done.\n" );
|
||||
$this->applyPatch( 'patch-user_groups.sql', false, "Re-adding fresh user_groups table" );
|
||||
|
||||
$this->output( "***\n" );
|
||||
$this->output( "*** WARNING: You will need to manually fix up user permissions in the user_groups\n" );
|
||||
|
|
@ -601,15 +586,11 @@ class MysqlUpdater extends DatabaseUpdater {
|
|||
return;
|
||||
}
|
||||
|
||||
$this->output( "Adding user_groups table... " );
|
||||
$this->applyPatch( 'patch-user_groups.sql' );
|
||||
$this->output( "done.\n" );
|
||||
$this->applyPatch( 'patch-user_groups.sql', false, "Adding user_groups table" );
|
||||
|
||||
if ( !$this->db->tableExists( 'user_rights', __METHOD__ ) ) {
|
||||
if ( $this->db->fieldExists( 'user', 'user_rights', __METHOD__ ) ) {
|
||||
$this->output( "Upgrading from a 1.3 or older database? Breaking out user_rights for conversion..." );
|
||||
$this->db->applyPatch( 'patch-user_rights.sql' );
|
||||
$this->output( "done.\n" );
|
||||
$this->db->applyPatch( 'patch-user_rights.sql', false, "Upgrading from a 1.3 or older database? Breaking out user_rights for conversion" );
|
||||
} else {
|
||||
$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" );
|
||||
|
|
@ -651,9 +632,7 @@ class MysqlUpdater extends DatabaseUpdater {
|
|||
return;
|
||||
}
|
||||
|
||||
$this->output( "Making wl_notificationtimestamp nullable... " );
|
||||
$this->applyPatch( 'patch-watchlist-null.sql' );
|
||||
$this->output( "done.\n" );
|
||||
$this->applyPatch( 'patch-watchlist-null.sql', false, "Making wl_notificationtimestamp nullable" );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -679,8 +658,8 @@ class MysqlUpdater extends DatabaseUpdater {
|
|||
return;
|
||||
}
|
||||
|
||||
$this->output( "Creating templatelinks table...\n" );
|
||||
$this->applyPatch( 'patch-templatelinks.sql' );
|
||||
$this->applyPatch( 'patch-templatelinks.sql', false, "Creating templatelinks table" );
|
||||
|
||||
$this->output( "Populating...\n" );
|
||||
if ( wfGetLB()->getServerCount() > 1 ) {
|
||||
// Slow, replication-friendly update
|
||||
|
|
@ -721,8 +700,7 @@ class MysqlUpdater extends DatabaseUpdater {
|
|||
!$this->indexHasField( 'templatelinks', 'tl_namespace', 'tl_from' ) ||
|
||||
!$this->indexHasField( 'imagelinks', 'il_to', 'il_from' ) )
|
||||
{
|
||||
$this->applyPatch( 'patch-backlinkindexes.sql' );
|
||||
$this->output( "...backlinking indices updated\n" );
|
||||
$this->applyPatch( 'patch-backlinkindexes.sql', false, "Updating backlinking indices" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -737,9 +715,8 @@ class MysqlUpdater extends DatabaseUpdater {
|
|||
return;
|
||||
}
|
||||
|
||||
$this->output( "Creating page_restrictions table..." );
|
||||
$this->applyPatch( 'patch-page_restrictions.sql' );
|
||||
$this->applyPatch( 'patch-page_restrictions_sortkey.sql' );
|
||||
$this->applyPatch( 'patch-page_restrictions.sql', false, "Creating page_restrictions table (1/2)" );
|
||||
$this->applyPatch( 'patch-page_restrictions_sortkey.sql', false, "Creating page_restrictions table (2/2)" );
|
||||
$this->output( "done.\n" );
|
||||
|
||||
$this->output( "Migrating old restrictions to new table...\n" );
|
||||
|
|
@ -749,8 +726,7 @@ class MysqlUpdater extends DatabaseUpdater {
|
|||
|
||||
protected function doCategorylinksIndicesUpdate() {
|
||||
if ( !$this->indexHasField( 'categorylinks', 'cl_sortkey', 'cl_from' ) ) {
|
||||
$this->applyPatch( 'patch-categorylinksindex.sql' );
|
||||
$this->output( "...categorylinks indices updated\n" );
|
||||
$this->applyPatch( 'patch-categorylinksindex.sql', false, "Updating categorylinks Indices" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -789,18 +765,14 @@ class MysqlUpdater extends DatabaseUpdater {
|
|||
} elseif ( $this->db->fieldExists( 'profiling', 'pf_memory', __METHOD__ ) ) {
|
||||
$this->output( "...profiling table has pf_memory field.\n" );
|
||||
} else {
|
||||
$this->output( "Adding pf_memory field to table profiling..." );
|
||||
$this->applyPatch( 'patch-profiling-memory.sql' );
|
||||
$this->output( "done.\n" );
|
||||
$this->applyPatch( 'patch-profiling-memory.sql', false, "Adding pf_memory field to table profiling" );
|
||||
}
|
||||
}
|
||||
|
||||
protected function doFilearchiveIndicesUpdate() {
|
||||
$info = $this->db->indexInfo( 'filearchive', 'fa_user_timestamp', __METHOD__ );
|
||||
if ( !$info ) {
|
||||
$this->output( "Updating filearchive indices..." );
|
||||
$this->applyPatch( 'patch-filearchive-user-index.sql' );
|
||||
$this->output( "done.\n" );
|
||||
$this->applyPatch( 'patch-filearchive-user-index.sql', false, "Updating filearchive indices" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -811,9 +783,7 @@ class MysqlUpdater extends DatabaseUpdater {
|
|||
return;
|
||||
}
|
||||
|
||||
$this->output( "Making pl_namespace, tl_namespace and il_to indices UNIQUE... " );
|
||||
$this->applyPatch( 'patch-pl-tl-il-unique.sql' );
|
||||
$this->output( "done.\n" );
|
||||
$this->applyPatch( 'patch-pl-tl-il-unique.sql', false, "Making pl_namespace, tl_namespace and il_to indices UNIQUE" );
|
||||
}
|
||||
|
||||
protected function renameEuWikiId() {
|
||||
|
|
@ -822,9 +792,7 @@ class MysqlUpdater extends DatabaseUpdater {
|
|||
return;
|
||||
}
|
||||
|
||||
$this->output( "Renaming eu_wiki_id -> eu_local_id... " );
|
||||
$this->applyPatch( 'patch-eu_local_id.sql' );
|
||||
$this->output( "done.\n" );
|
||||
$this->applyPatch( 'patch-eu_local_id.sql', false, "Renaming eu_wiki_id -> eu_local_id" );
|
||||
}
|
||||
|
||||
protected function doUpdateMimeMinorField() {
|
||||
|
|
@ -833,9 +801,7 @@ class MysqlUpdater extends DatabaseUpdater {
|
|||
return;
|
||||
}
|
||||
|
||||
$this->output( "Altering all *_mime_minor fields to 100 bytes in size ... " );
|
||||
$this->applyPatch( 'patch-mime_minor_length.sql' );
|
||||
$this->output( "done.\n" );
|
||||
$this->applyPatch( 'patch-mime_minor_length.sql', false, "Altering all *_mime_minor fields to 100 bytes in size" );
|
||||
}
|
||||
|
||||
protected function doClFieldsUpdate() {
|
||||
|
|
@ -844,9 +810,7 @@ class MysqlUpdater extends DatabaseUpdater {
|
|||
return;
|
||||
}
|
||||
|
||||
$this->output( 'Updating categorylinks (again)...' );
|
||||
$this->applyPatch( 'patch-categorylinks-better-collation2.sql' );
|
||||
$this->output( "done.\n" );
|
||||
$this->applyPatch( 'patch-categorylinks-better-collation2.sql', false, 'Updating categorylinks (again)' );
|
||||
}
|
||||
|
||||
protected function doLangLinksLengthUpdate() {
|
||||
|
|
@ -855,9 +819,7 @@ class MysqlUpdater extends DatabaseUpdater {
|
|||
$row = $this->db->fetchObject( $res );
|
||||
|
||||
if ( $row && $row->Type == "varbinary(10)" ) {
|
||||
$this->output( 'Updating length of ll_lang in langlinks...' );
|
||||
$this->applyPatch( 'patch-langlinks-ll_lang-20.sql' );
|
||||
$this->output( "done.\n" );
|
||||
$this->applyPatch( 'patch-langlinks-ll_lang-20.sql', false, 'Updating length of ll_lang in langlinks' );
|
||||
} else {
|
||||
$this->output( "...ll_lang is up-to-date.\n" );
|
||||
}
|
||||
|
|
@ -870,8 +832,6 @@ class MysqlUpdater extends DatabaseUpdater {
|
|||
return;
|
||||
}
|
||||
|
||||
$this->output( "Making user_last_timestamp nullable... " );
|
||||
$this->applyPatch( 'patch-user-newtalk-timestamp-null.sql' );
|
||||
$this->output( "done.\n" );
|
||||
$this->applyPatch( 'patch-user-newtalk-timestamp-null.sql', false, "Making user_last_timestamp nullable" );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,40 +83,32 @@ class OracleUpdater extends DatabaseUpdater {
|
|||
* Oracle inserts NULL, so namespace fields should have a default value
|
||||
*/
|
||||
protected function doNamespaceDefaults() {
|
||||
$this->output( "Altering namespace fields with default value ... " );
|
||||
$meta = $this->db->fieldInfo( 'page', 'page_namespace' );
|
||||
if ( $meta->defaultValue() != null ) {
|
||||
$this->output( "defaults seem to present on namespace fields\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
$this->applyPatch( 'patch_namespace_defaults.sql', false );
|
||||
$this->output( "ok\n" );
|
||||
$this->applyPatch( 'patch_namespace_defaults.sql', false, "Altering namespace fields with default value" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Uniform FK names + deferrable state
|
||||
*/
|
||||
protected function doFKRenameDeferr() {
|
||||
$this->output( "Altering foreign keys ... " );
|
||||
$meta = $this->db->query( 'SELECT COUNT(*) cnt FROM user_constraints WHERE constraint_type = \'R\' AND deferrable = \'DEFERRABLE\'' );
|
||||
$row = $meta->fetchRow();
|
||||
if ( $row && $row['cnt'] > 0 ) {
|
||||
$this->output( "at least one FK is deferrable, considering up to date\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
$this->applyPatch( 'patch_fk_rename_deferred.sql', false );
|
||||
$this->output( "ok\n" );
|
||||
$this->applyPatch( 'patch_fk_rename_deferred.sql', false, "Altering foreign keys ... " );
|
||||
}
|
||||
|
||||
/**
|
||||
* Recreate functions to 17 schema layout
|
||||
*/
|
||||
protected function doFunctions17() {
|
||||
$this->output( "Recreating functions ... " );
|
||||
$this->applyPatch( 'patch_create_17_functions.sql', false );
|
||||
$this->output( "ok\n" );
|
||||
$this->applyPatch( 'patch_create_17_functions.sql', false, "Recreating functions" );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -124,14 +116,11 @@ class OracleUpdater extends DatabaseUpdater {
|
|||
* there are no incremental patches prior to this
|
||||
*/
|
||||
protected function doSchemaUpgrade17() {
|
||||
$this->output( "Updating schema to 17 ... " );
|
||||
// check if iwlinks table exists which was added in 1.17
|
||||
if ( $this->db->tableExists( 'iwlinks' ) ) {
|
||||
$this->output( "schema seem to be up to date.\n" );
|
||||
return;
|
||||
}
|
||||
$this->applyPatch( 'patch_16_17_schema_changes.sql', false );
|
||||
$this->output( "ok\n" );
|
||||
$this->applyPatch( 'patch_16_17_schema_changes.sql', false, "Updating schema to 17" );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -160,24 +149,19 @@ class OracleUpdater extends DatabaseUpdater {
|
|||
* converted to NULL in Oracle
|
||||
*/
|
||||
protected function doRemoveNotNullEmptyDefaults() {
|
||||
$this->output( "Removing not null empty constraints ... " );
|
||||
$meta = $this->db->fieldInfo( 'categorylinks' , 'cl_sortkey_prefix' );
|
||||
if ( $meta->isNullable() ) {
|
||||
$this->output( "constraints seem to be removed\n" );
|
||||
return;
|
||||
}
|
||||
$this->applyPatch( 'patch_remove_not_null_empty_defs.sql', false );
|
||||
$this->output( "ok\n" );
|
||||
$this->applyPatch( 'patch_remove_not_null_empty_defs.sql', false, "Removing not null empty constraints" );
|
||||
}
|
||||
|
||||
protected function doRemoveNotNullEmptyDefaults2() {
|
||||
$this->output( "Removing not null empty constraints ... " );
|
||||
$meta = $this->db->fieldInfo( 'ipblocks' , 'ipb_by_text' );
|
||||
if ( $meta->isNullable() ) {
|
||||
$this->output( "constraints seem to be removed\n" );
|
||||
return;
|
||||
}
|
||||
$this->applyPatch( 'patch_remove_not_null_empty_defs2.sql', false );
|
||||
$this->output( "ok\n" );
|
||||
$this->applyPatch( 'patch_remove_not_null_empty_defs2.sql', false, "Removing not null empty constraints" );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -185,17 +169,13 @@ class OracleUpdater extends DatabaseUpdater {
|
|||
* cascading taken in account in the deleting function
|
||||
*/
|
||||
protected function doRecentchangesFK2Cascade() {
|
||||
$this->output( "Altering RECENTCHANGES_FK2 ... " );
|
||||
|
||||
$meta = $this->db->query( 'SELECT 1 FROM all_constraints WHERE owner = \''.strtoupper($this->db->getDBname()).'\' AND constraint_name = \''.$this->db->tablePrefix().'RECENTCHANGES_FK2\' AND delete_rule = \'CASCADE\'' );
|
||||
$row = $meta->fetchRow();
|
||||
if ( $row ) {
|
||||
$this->output( "FK up to date\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
$this->applyPatch( 'patch_recentchanges_fk2_cascade.sql', false );
|
||||
$this->output( "ok\n" );
|
||||
$this->applyPatch( 'patch_recentchanges_fk2_cascade.sql', false, "Altering RECENTCHANGES_FK2" );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -219,9 +199,7 @@ class OracleUpdater extends DatabaseUpdater {
|
|||
* rebuilding of the function that duplicates tables for tests
|
||||
*/
|
||||
protected function doRebuildDuplicateFunction() {
|
||||
$this->output( "Rebuilding duplicate function ... " );
|
||||
$this->applyPatch( 'patch_rebuild_dupfunc.sql', false );
|
||||
$this->output( "ok\n" );
|
||||
$this->applyPatch( 'patch_rebuild_dupfunc.sql', false, "Rebuilding duplicate function" );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -613,11 +613,11 @@ END;
|
|||
if ( $this->db->indexExists( $table, $index ) ) {
|
||||
$this->output( "...index '$index' on table '$table' already exists\n" );
|
||||
} else {
|
||||
$this->output( "Creating index '$index' on table '$table'\n" );
|
||||
if ( preg_match( '/^\(/', $type ) ) {
|
||||
$this->output( "Creating index '$index' on table '$table'\n" );
|
||||
$this->db->query( "CREATE INDEX $index ON $table $type" );
|
||||
} else {
|
||||
$this->applyPatch( $type, true );
|
||||
$this->applyPatch( $type, true, "Creating index '$index' on table '$table'" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -647,7 +647,6 @@ END;
|
|||
|
||||
protected function convertArchive2() {
|
||||
if ( $this->db->tableExists( "archive2" ) ) {
|
||||
$this->output( "Converting 'archive2' back to normal archive table\n" );
|
||||
if ( $this->db->ruleExists( 'archive', 'archive_insert' ) ) {
|
||||
$this->output( "Dropping rule 'archive_insert'\n" );
|
||||
$this->db->query( 'DROP RULE archive_insert ON archive' );
|
||||
|
|
@ -656,7 +655,7 @@ END;
|
|||
$this->output( "Dropping rule 'archive_delete'\n" );
|
||||
$this->db->query( 'DROP RULE archive_delete ON archive' );
|
||||
}
|
||||
$this->applyPatch( 'patch-remove-archive2.sql' );
|
||||
$this->applyPatch( 'patch-remove-archive2.sql', false, "Converting 'archive2' back to normal archive table" );
|
||||
} else {
|
||||
$this->output( "...obsolete table 'archive2' does not exist\n" );
|
||||
}
|
||||
|
|
@ -691,8 +690,7 @@ END;
|
|||
|
||||
protected function checkPageDeletedTrigger() {
|
||||
if ( !$this->db->triggerExists( 'page', 'page_deleted' ) ) {
|
||||
$this->output( "Adding function and trigger 'page_deleted' to table 'page'\n" );
|
||||
$this->applyPatch( 'patch-page_deleted.sql' );
|
||||
$this->applyPatch( 'patch-page_deleted.sql', false, "Adding function and trigger 'page_deleted' to table 'page'" );
|
||||
} else {
|
||||
$this->output( "...table 'page' has 'page_deleted' trigger\n" );
|
||||
}
|
||||
|
|
@ -727,35 +725,30 @@ END;
|
|||
if ( $this->fkeyDeltype( 'revision_rev_user_fkey' ) == 'r' ) {
|
||||
$this->output( "...constraint 'revision_rev_user_fkey' is ON DELETE RESTRICT\n" );
|
||||
} else {
|
||||
$this->output( "Changing constraint 'revision_rev_user_fkey' to ON DELETE RESTRICT\n" );
|
||||
$this->applyPatch( 'patch-revision_rev_user_fkey.sql' );
|
||||
$this->applyPatch( 'patch-revision_rev_user_fkey.sql', false, "Changing constraint 'revision_rev_user_fkey' to ON DELETE RESTRICT" );
|
||||
}
|
||||
}
|
||||
|
||||
protected function checkIwlPrefix() {
|
||||
if ( $this->db->indexExists( 'iwlinks', 'iwl_prefix' ) ) {
|
||||
$this->output( "Replacing index 'iwl_prefix' with 'iwl_prefix_from_title'...\n" );
|
||||
$this->applyPatch( 'patch-rename-iwl_prefix.sql' );
|
||||
$this->applyPatch( 'patch-rename-iwl_prefix.sql', false, "Replacing index 'iwl_prefix' with 'iwl_prefix_from_title'" );
|
||||
}
|
||||
}
|
||||
|
||||
protected function addInterwikiType() {
|
||||
$this->output( "Refreshing add_interwiki()...\n" );
|
||||
$this->applyPatch( 'patch-add_interwiki.sql' );
|
||||
$this->applyPatch( 'patch-add_interwiki.sql', false, "Refreshing add_interwiki()" );
|
||||
}
|
||||
|
||||
protected function tsearchFixes() {
|
||||
# Tweak the page_title tsearch2 trigger to filter out slashes
|
||||
# This is create or replace, so harmless to call if not needed
|
||||
$this->output( "Refreshing ts2_page_title()...\n" );
|
||||
$this->applyPatch( 'patch-ts2pagetitle.sql' );
|
||||
$this->applyPatch( 'patch-ts2pagetitle.sql', false, "Refreshing ts2_page_title()" );
|
||||
|
||||
# If the server is 8.3 or higher, rewrite the tsearch2 triggers
|
||||
# in case they have the old 'default' versions
|
||||
# Gather version numbers in case we need them
|
||||
if ( $this->db->getServerVersion() >= 8.3 ) {
|
||||
$this->output( "Rewriting tsearch2 triggers...\n" );
|
||||
$this->applyPatch( 'patch-tsearch2funcs.sql' );
|
||||
$this->applyPatch( 'patch-tsearch2funcs.sql', false, "Rewriting tsearch2 triggers" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,22 +101,16 @@ class SqliteUpdater extends DatabaseUpdater {
|
|||
$this->output( "...have initial indexes\n" );
|
||||
return;
|
||||
}
|
||||
$this->output( "Adding initial indexes..." );
|
||||
$this->applyPatch( 'initial-indexes.sql' );
|
||||
$this->output( "done\n" );
|
||||
$this->applyPatch( 'initial-indexes.sql', false, "Adding initial indexes" );
|
||||
}
|
||||
|
||||
protected function sqliteSetupSearchindex() {
|
||||
$module = DatabaseSqlite::getFulltextSearchModule();
|
||||
$fts3tTable = $this->updateRowExists( 'fts3' );
|
||||
if ( $fts3tTable && !$module ) {
|
||||
$this->output( '...PHP is missing FTS3 support, downgrading tables...' );
|
||||
$this->applyPatch( 'searchindex-no-fts.sql' );
|
||||
$this->output( "done\n" );
|
||||
$this->applyPatch( 'searchindex-no-fts.sql', false, 'PHP is missing FTS3 support, downgrading tables' );
|
||||
} elseif ( !$fts3tTable && $module == 'FTS3' ) {
|
||||
$this->output( '...adding FTS3 search capabilities...' );
|
||||
$this->applyPatch( 'searchindex-fts3.sql' );
|
||||
$this->output( "done\n" );
|
||||
$this->applyPatch( 'searchindex-fts3.sql', false, "Adding FTS3 search capabilities" );
|
||||
} else {
|
||||
$this->output( "...fulltext search table appears to be in order.\n" );
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue