Pull the actual series of updater calls into do_all_updaters(), add
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 13 Oct 2004 07:38:43 +0000 (07:38 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 13 Oct 2004 07:38:43 +0000 (07:38 +0000)
the necessary require_all's to updaters.inc, and add a command-line
update.php which runs them without having to pull things out and
run the web installer.

config/index.php
maintenance/update.php [new file with mode: 0644]
maintenance/updaters.inc

index 920edc7..b073069 100644 (file)
@@ -482,36 +482,7 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
                        print "<pre>\n";
                        chdir( ".." );
                        flush();
-
-
-                       # Add missing tables
-                       foreach ( $wgNewTables as $tableRecord ) {
-                               add_table( $tableRecord[0], $tableRecord[1] );
-                               flush();
-                       }
-
-                       # Add missing fields
-                       foreach ( $wgNewFields as $fieldRecord ) {
-                               add_table( $fieldRecord[0], $fieldRecord[1], $fieldRecord[2] );
-                               flush();
-                       }
-
-                       # Do schema updates which require special handling
-                       do_interwiki_update(); flush();
-                       do_index_update(); flush();
-                       do_linkscc_1_3_update(); flush();
-                       convertLinks(); flush();
-                       do_image_name_unique_update(); flush();
-
-                       if ( isTemplateInitialised() ) {
-                               print "Template namespace already initialised\n";
-                       } else {
-                               moveCustomMessages( 1 ); flush();
-                               moveCustomMessages( 2 ); flush();
-                               moveCustomMessages( 3 ); flush();
-                       }
-
-                       initialiseMessages(); flush();
+                       do_all_updates();
                        chdir( "config" );
 
                        print "</pre>\n";
@@ -655,7 +626,7 @@ if( count( $errs ) ) {
                <?php
                        $list = getLanguageList();
                        foreach( $list as $code => $name ) {
-                               $sel = ($code == $conf->LanguageCode) ? "selected" : "";
+                               $sel = ($code == $conf->LanguageCode) ? 'selected="selected"' : '';
                                echo "\t\t<option value=\"$code\" $sel>$name</option>\n";
                        }
                ?>
diff --git a/maintenance/update.php b/maintenance/update.php
new file mode 100644 (file)
index 0000000..955be7d
--- /dev/null
@@ -0,0 +1,20 @@
+<?php
+/**
+ * Run all updaters.
+ *
+ * @todo document
+ * @package MediaWiki
+ * @subpackage Maintenance
+ */ 
+
+/** */
+require_once( "commandLine.inc" );
+require_once( "updaters.inc" );
+$wgTitle = Title::newFromText( "MediaWiki database updater" );
+$wgDatabase = Database::newFromParams( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname );
+
+do_all_updates();
+
+print "Done.\n";
+
+?>
index da96ef1..3a2c6b8 100644 (file)
@@ -6,6 +6,10 @@
  
  /** */
 
+require_once 'convertLinks.inc';
+require_once 'InitialiseMessages.inc';
+require_once 'archives/moveCustomMessages.inc';
+
 $wgNewTables = array(
 #            table          patch file (in maintenance/archives)
        array( 'linkscc',       'patch-linkscc.sql' ),
@@ -137,4 +141,37 @@ function do_image_name_unique_update() {
        }
 }
 
+function do_all_updates() {
+       global $wgNewTables, $wgNewFields;
+       
+       # Add missing tables
+       foreach ( $wgNewTables as $tableRecord ) {
+               add_table( $tableRecord[0], $tableRecord[1] );
+               flush();
+       }
+
+       # Add missing fields
+       foreach ( $wgNewFields as $fieldRecord ) {
+               add_table( $fieldRecord[0], $fieldRecord[1], $fieldRecord[2] );
+               flush();
+       }
+
+       # Do schema updates which require special handling
+       do_interwiki_update(); flush();
+       do_index_update(); flush();
+       do_linkscc_1_3_update(); flush();
+       convertLinks(); flush();
+       do_image_name_unique_update(); flush();
+
+       if ( isTemplateInitialised() ) {
+               print "Template namespace already initialised\n";
+       } else {
+               moveCustomMessages( 1 ); flush();
+               moveCustomMessages( 2 ); flush();
+               moveCustomMessages( 3 ); flush();
+       }
+
+       initialiseMessages(); flush();
+}
+
 ?>