X-Git-Url: http://git.cyclocoop.org/%7B%7B%20url_for%28%27admin_vote_del%27%2C%20idvote=vote.voteid%29%20%7D%7D?a=blobdiff_plain;f=includes%2Finstaller%2FDatabaseUpdater.php;h=f2e36aec2b27a024c4eb87e7a4ba21d099fd57f5;hb=1a40d939490097b00b27acfcef6a4dba0e13a94b;hp=0ae28b788239b6783c92525e7c5a667ad58f30bd;hpb=c6b3c2f05b45c2ebdc7ff72743eb53afdaadbaa1;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index 0ae28b7882..f2e36aec2b 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -153,6 +153,8 @@ abstract class DatabaseUpdater { * Add a new update coming from an extension. This should be called by * extensions while executing the LoadExtensionSchemaUpdates hook. * + * @since 1.17 + * * @param $update Array: the update to run. Format is the following: * first item is the callback function, it also can be a * simple string with the name of a function in this class, @@ -167,6 +169,9 @@ abstract class DatabaseUpdater { /** * Convenience wrapper for addExtensionUpdate() when adding a new table (which * is the most common usage of updaters in an extension) + * + * @since 1.18 + * * @param $tableName String Name of table to create * @param $sqlPath String Full path to the schema file */ @@ -175,6 +180,8 @@ abstract class DatabaseUpdater { } /** + * @since 1.19 + * * @param $tableName string * @param $indexName string * @param $sqlPath string @@ -184,6 +191,9 @@ abstract class DatabaseUpdater { } /** + * + * @since 1.19 + * * @param $tableName string * @param $columnName string * @param $sqlPath string @@ -193,7 +203,10 @@ abstract class DatabaseUpdater { } /** - * Add a maintenance script to be run after the database updates are complete + * 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 ) { @@ -210,6 +223,8 @@ abstract class DatabaseUpdater { } /** + * @since 1.17 + * * @return array */ public function getPostDatabaseUpdateMaintenance() { @@ -235,6 +250,10 @@ abstract class DatabaseUpdater { $this->setAppliedUpdates( $wgVersion, $this->updates ); + if ( isset( $what['stats'] ) ) { + $this->checkStats(); + } + if ( isset( $what['purge'] ) ) { $this->purgeCache(); @@ -242,9 +261,6 @@ abstract class DatabaseUpdater { $this->rebuildLocalisationCache(); } } - if ( isset( $what['stats'] ) ) { - $this->checkStats(); - } } /** @@ -417,7 +433,7 @@ abstract class DatabaseUpdater { } else { $this->output( "Creating $name table..." ); $this->applyPatch( $patch, $fullpath ); - $this->output( "ok\n" ); + $this->output( "done.\n" ); } } @@ -430,13 +446,13 @@ abstract class DatabaseUpdater { */ protected function addField( $table, $field, $patch, $fullpath = false ) { if ( !$this->db->tableExists( $table, __METHOD__ ) ) { - $this->output( "...$table table does not exist, skipping new field patch\n" ); + $this->output( "...$table table does not exist, skipping new field patch.\n" ); } 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( "ok\n" ); + $this->output( "done.\n" ); } } @@ -449,11 +465,11 @@ abstract class DatabaseUpdater { */ protected function addIndex( $table, $index, $patch, $fullpath = false ) { if ( $this->db->indexExists( $table, $index, __METHOD__ ) ) { - $this->output( "...$index key already set on $table table.\n" ); + $this->output( "...index $index already set on $table table.\n" ); } else { - $this->output( "Adding $index key to table $table... " ); + $this->output( "Adding index $index to table $table... " ); $this->applyPatch( $patch, $fullpath ); - $this->output( "ok\n" ); + $this->output( "done.\n" ); } } @@ -469,7 +485,7 @@ abstract class DatabaseUpdater { if ( $this->db->fieldExists( $table, $field, __METHOD__ ) ) { $this->output( "Table $table contains $field field. Dropping... " ); $this->applyPatch( $patch, $fullpath ); - $this->output( "ok\n" ); + $this->output( "done.\n" ); } else { $this->output( "...$table table does not contain $field field.\n" ); } @@ -485,9 +501,9 @@ abstract class DatabaseUpdater { */ protected function dropIndex( $table, $index, $patch, $fullpath = false ) { if ( $this->db->indexExists( $table, $index, __METHOD__ ) ) { - $this->output( "Dropping $index key from table $table... " ); + $this->output( "Dropping $index index from table $table... " ); $this->applyPatch( $patch, $fullpath ); - $this->output( "ok\n" ); + $this->output( "done.\n" ); } else { $this->output( "...$index key doesn't exist.\n" ); } @@ -502,7 +518,7 @@ abstract class DatabaseUpdater { if ( $this->db->tableExists( $table, __METHOD__ ) ) { $this->output( "Dropping table $table... " ); $this->applyPatch( $patch, $fullpath ); - $this->output( "ok\n" ); + $this->output( "done.\n" ); } else { $this->output( "...$table doesn't exist.\n" ); } @@ -519,16 +535,16 @@ abstract class DatabaseUpdater { public function modifyField( $table, $field, $patch, $fullpath = false ) { $updateKey = "$table-$field-$patch"; if ( !$this->db->tableExists( $table, __METHOD__ ) ) { - $this->output( "...$table table does not exist, skipping modify field patch\n" ); + $this->output( "...$table table does not exist, skipping modify field patch.\n" ); } elseif ( !$this->db->fieldExists( $table, $field, __METHOD__ ) ) { - $this->output( "...$field field does not exist in $table table, skipping modify field patch\n" ); + $this->output( "...$field field does not exist in $table table, skipping modify field patch.\n" ); } elseif( $this->updateRowExists( $updateKey ) ) { - $this->output( "...$field in table $table already modified by patch $patch\n" ); + $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->insertUpdateRow( $updateKey ); - $this->output( "ok\n" ); + $this->output( "done.\n" ); } } @@ -547,7 +563,7 @@ abstract class DatabaseUpdater { * Check the site_stats table is not properly populated. */ protected function checkStats() { - $this->output( "Checking site_stats row..." ); + $this->output( "...site_stats is populated..." ); $row = $this->db->selectRow( 'site_stats', '*', array( 'ss_row_id' => 1 ), __METHOD__ ); if ( $row === false ) { $this->output( "data is missing! rebuilding...\n" ); @@ -592,6 +608,7 @@ abstract class DatabaseUpdater { $task = $this->maintenance->runChild( 'PopulateLogUsertext' ); $task->execute(); + $this->output( "done.\n" ); } } @@ -607,6 +624,7 @@ abstract class DatabaseUpdater { $task = $this->maintenance->runChild( 'PopulateLogSearch' ); $task->execute(); + $this->output( "done.\n" ); } } @@ -621,7 +639,7 @@ abstract class DatabaseUpdater { $this->output( "Converting tc_time from UNIX epoch to MediaWiki timestamp... " ); $this->applyPatch( 'patch-tc-timestamp.sql' ); - $this->output( "ok\n" ); + $this->output( "done.\n" ); } /** @@ -639,8 +657,10 @@ abstract class DatabaseUpdater { return; } + $this->output( "Updating category collations..." ); $task = $this->maintenance->runChild( 'UpdateCollation' ); $task->execute(); + $this->output( "...done.\n" ); } /** @@ -648,7 +668,6 @@ abstract class DatabaseUpdater { */ protected function doMigrateUserOptions() { $cl = $this->maintenance->runChild( 'ConvertUserOptions', 'convertUserOptions.php' ); - $this->output( "Migrating remaining user_options... " ); $cl->execute(); $this->output( "done.\n" ); } @@ -664,20 +683,6 @@ abstract class DatabaseUpdater { $this->output( "Rebuilding localisation cache...\n" ); $cl->setForce(); $cl->execute(); - $this->output( "Rebuilding localisation cache done.\n" ); - } - - /** - * Increases the length of the user_group field - */ - protected function doIncreaseUserGroupLength() { - $this->output( 'Increasing the length of the user_group...' ); - if ( $this->updateRowExists( 'user_groups_length' ) ) { - $this->output( "...user_groups field is already long enough.\n" ); - return; - } - $this->applyPatch( 'patch-ug_group-length-increase.sql' ); - $this->insertUpdateRow( 'user_groups_length' ); $this->output( "done.\n" ); } }