1.2 -> 1.3 conversion using the web-based installer 1.3.0beta1
authorTim Starling <tstarling@users.mediawiki.org>
Sat, 22 May 2004 07:05:45 +0000 (07:05 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Sat, 22 May 2004 07:05:45 +0000 (07:05 +0000)
config/index.php
maintenance/archives/moveCustomMessages.inc
maintenance/convertLinks.inc

index 16d17a2..ad1cc16 100644 (file)
@@ -153,6 +153,9 @@ if( !is_writable( "." ) ) {
 
 require( "../install-utils.inc" );
 require( "../maintenance/updaters.inc" );
+require( "../maintenance/convertLinks.inc" );
+require( "../maintenance/archives/moveCustomMessages.inc" );
+
 class ConfigData {
        function getEncoded( $data ) {
                # Hackish
@@ -399,11 +402,20 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
                        do_linkscc_update(); flush();
                        do_hitcounter_update(); flush();
                        do_recentchanges_update(); flush();
-                       echo "FIXME: need the link table change here\n";
+                       convertLinks(); flush();
                        do_user_real_name_update(); flush();
                        do_querycache_update(); flush();
                        do_objectcache_update(); flush();
                        do_categorylinks_update(); flush();
+                       
+                       if ( isTemplateInitialised() ) {
+                               print "Template namespace already initialised\n";
+                       } else {
+                               moveCustomMessages( 1 ); flush();
+                               moveCustomMessages( 2 ); flush();
+                               moveCustomMessages( 3 ); flush();
+                       }
+
                        initialiseMessages(); flush();
                        chdir( "config" );
                        
@@ -686,8 +698,19 @@ function writeLocalSettings( $conf ) {
        $pretty = ($conf->prettyURLs ? "" : "# ");
        $ugly = ($conf->prettyURLs ? "# " : "");
        $rights = ($conf->RightsUrl) ? "" : "# ";
+       
+       $file = @fopen( "/dev/random", "r" );
+       if ( $file ) {
+               $proxyKey = bin2hex( fread( $file, 32 ) );
+               fclose( $file );
+       } else {
+               $proxyKey = "";
+               for ( $i=0; $i<8; $i++ ) {
+                       $proxyKey .= dechex(mt_rand(0, 0x7fffffff));
+               }
+               print "Warning: \$wgProxyKey is insecure\n";
+       }
 
-#      $proxyKey = Parser::getRandomString() . Parser::getRandomString();
        # Add slashes to strings for double quoting
        $slconf = array_map( "addslashes", get_object_vars( $conf ) );
 
@@ -698,7 +721,7 @@ function writeLocalSettings( $conf ) {
 # If you make manual changes, please keep track in case you need to
 # recreate them later.
 
-\$IP = \"{$slconf[IP]}\";
+\$IP = \"{$slconf['IP']}\";
 ini_set( \"include_path\", \"\$IP/includes$sep\$IP/languages$sep\" . ini_get(\"include_path\") );
 include_once( \"DefaultSettings.php\" );
 
@@ -711,9 +734,9 @@ if ( \$wgCommandLineMode ) {
        {$zlib}if( !ini_get( 'zlib.output_compression' ) ) ob_start( 'ob_gzhandler' );
 }
 
-\$wgSitename         = \"{$slconf[Sitename]}\";
+\$wgSitename         = \"{$slconf['Sitename']}\";
 
-\$wgScriptPath     = \"{$slconf[ScriptPath]}\";
+\$wgScriptPath     = \"{$slconf['ScriptPath']}\";
 \$wgScript           = \"\$wgScriptPath/index.php\";
 \$wgRedirectScript   = \"\$wgScriptPath/redirect.php\";
 
@@ -728,13 +751,13 @@ if ( \$wgCommandLineMode ) {
 \$wgUploadPath       = \"\$wgScriptPath/images\";
 \$wgUploadDirectory  = \"\$IP/images\";
 
-\$wgEmergencyContact = \"{$slconf[EmergencyContact]}\";
-\$wgPasswordSender     = \"{$slconf[PasswordSender]}\";
+\$wgEmergencyContact = \"{$slconf['EmergencyContact']}\";
+\$wgPasswordSender     = \"{$slconf['PasswordSender']}\";
 
-\$wgDBserver         = \"{$slconf[DBserver]}\";
-\$wgDBname           = \"{$slconf[DBname]}\";
-\$wgDBuser           = \"{$slconf[DBuser]}\";
-\$wgDBpassword       = \"{$slconf[DBpassword]}\";
+\$wgDBserver         = \"{$slconf['DBserver']}\";
+\$wgDBname           = \"{$slconf['DBname']}\";
+\$wgDBuser           = \"{$slconf['DBuser']}\";
+\$wgDBpassword       = \"{$slconf['DBpassword']}\";
 
 ## To allow SQL queries through the wiki's Special:Askaql page,
 ## uncomment the next lines. THIS IS VERY INSECURE. If you want
@@ -764,16 +787,15 @@ if ( \$wgCommandLineMode ) {
 
 \$wgLocalInterwiki   = \$wgSitename;
 
-\$wgLanguageCode = \"{$slconf[LanguageCode]}\";
-" . ($conf->Encoding ? "\$wgInputEncoding = \$wgOutputEncoding = \"{$slconf[Encoding]}\";" : "" ) . "
+\$wgLanguageCode = \"{$slconf['LanguageCode']}\";
+" . ($conf->Encoding ? "\$wgInputEncoding = \$wgOutputEncoding = \"{$slconf['Encoding']}\";" : "" ) . "
+
+\$wgProxyKey = \"$proxyKey\";
 
 ## Default skin: you can change the default skin. Use the internal symbolic
 ## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook':
 # \$wgDefaultSkin = 'monobook';
 
-## This is incomplete, ignore it:
-#\$wgProxyKey = $proxyKey;
-
 ## For attaching licensing metadata to pages, and displaying an
 ## appropriate copyright notice / icon. GNU Free Documentation
 ## License and Creative Commons licenses are supported so far.
index 8ad118d..dd5e8ae 100644 (file)
@@ -1,5 +1,11 @@
 <?
 
+function isTemplateInitialised() {
+       $sql = "SELECT 1 FROM cur WHERE cur_namespace=" . NS_TEMPLATE . " LIMIT 1";
+       $res = wfQuery( $sql, DB_READ );
+       return wfNumRows( $res ) ? true : false;
+}
+
 function moveCustomMessages( $phase ) {
        global $wgUser, $wgAllMessagesEn, $wgDeferredUpdateList, $wgLang ;
        $wgUser = new User;
index a2acf67..4ca7cd4 100644 (file)
@@ -1,6 +1,8 @@
 <?php
 
 function convertLinks() {
+       print "Converting links table to ID-ID...\n";
+       
        global $wgLang, $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname;
        
        $numRows = $tuplesAdded = $numBadLinks = $curRowsRead = 0; #counters etc
@@ -149,6 +151,7 @@ function convertLinks() {
                print "Conversion complete.  The converted table is at links_temp;\n";
                print "the original links table is unchanged.\n";
        }
+}
 
 #--------------------------------------------------------------------