MediaWiki r3655 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r3654‎ | r3655 (on ViewVC)‎ | r3656 >
Date:07:05, 22 May 2004
Author:timstarling
Status:old
Tags:
Comment:
1.2 -> 1.3 conversion using the web-based installer
Modified paths:

Diff [purge]

Index: trunk/phase3/maintenance/archives/moveCustomMessages.inc
@@ -1,5 +1,11 @@
22 <?
33
 4+function isTemplateInitialised() {
 5+ $sql = "SELECT 1 FROM cur WHERE cur_namespace=" . NS_TEMPLATE . " LIMIT 1";
 6+ $res = wfQuery( $sql, DB_READ );
 7+ return wfNumRows( $res ) ? true : false;
 8+}
 9+
410 function moveCustomMessages( $phase ) {
511 global $wgUser, $wgAllMessagesEn, $wgDeferredUpdateList, $wgLang ;
612 $wgUser = new User;
Index: trunk/phase3/maintenance/convertLinks.inc
@@ -1,6 +1,8 @@
22 <?php
33
44 function convertLinks() {
 5+ print "Converting links table to ID-ID...\n";
 6+
57 global $wgLang, $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname;
68
79 $numRows = $tuplesAdded = $numBadLinks = $curRowsRead = 0; #counters etc
@@ -149,6 +151,7 @@
150152 print "Conversion complete. The converted table is at links_temp;\n";
151153 print "the original links table is unchanged.\n";
152154 }
 155+}
153156
154157 #--------------------------------------------------------------------
155158
Index: trunk/phase3/config/index.php
@@ -153,6 +153,9 @@
154154
155155 require( "../install-utils.inc" );
156156 require( "../maintenance/updaters.inc" );
 157+require( "../maintenance/convertLinks.inc" );
 158+require( "../maintenance/archives/moveCustomMessages.inc" );
 159+
157160 class ConfigData {
158161 function getEncoded( $data ) {
159162 # Hackish
@@ -399,11 +402,20 @@
400403 do_linkscc_update(); flush();
401404 do_hitcounter_update(); flush();
402405 do_recentchanges_update(); flush();
403 - echo "FIXME: need the link table change here\n";
 406+ convertLinks(); flush();
404407 do_user_real_name_update(); flush();
405408 do_querycache_update(); flush();
406409 do_objectcache_update(); flush();
407410 do_categorylinks_update(); flush();
 411+
 412+ if ( isTemplateInitialised() ) {
 413+ print "Template namespace already initialised\n";
 414+ } else {
 415+ moveCustomMessages( 1 ); flush();
 416+ moveCustomMessages( 2 ); flush();
 417+ moveCustomMessages( 3 ); flush();
 418+ }
 419+
408420 initialiseMessages(); flush();
409421 chdir( "config" );
410422
@@ -686,8 +698,19 @@
687699 $pretty = ($conf->prettyURLs ? "" : "# ");
688700 $ugly = ($conf->prettyURLs ? "# " : "");
689701 $rights = ($conf->RightsUrl) ? "" : "# ";
 702+
 703+ $file = @fopen( "/dev/random", "r" );
 704+ if ( $file ) {
 705+ $proxyKey = bin2hex( fread( $file, 32 ) );
 706+ fclose( $file );
 707+ } else {
 708+ $proxyKey = "";
 709+ for ( $i=0; $i<8; $i++ ) {
 710+ $proxyKey .= dechex(mt_rand(0, 0x7fffffff));
 711+ }
 712+ print "Warning: \$wgProxyKey is insecure\n";
 713+ }
690714
691 -# $proxyKey = Parser::getRandomString() . Parser::getRandomString();
692715 # Add slashes to strings for double quoting
693716 $slconf = array_map( "addslashes", get_object_vars( $conf ) );
694717
@@ -698,7 +721,7 @@
699722 # If you make manual changes, please keep track in case you need to
700723 # recreate them later.
701724
702 -\$IP = \"{$slconf[IP]}\";
 725+\$IP = \"{$slconf['IP']}\";
703726 ini_set( \"include_path\", \"\$IP/includes$sep\$IP/languages$sep\" . ini_get(\"include_path\") );
704727 include_once( \"DefaultSettings.php\" );
705728
@@ -711,9 +734,9 @@
712735 {$zlib}if( !ini_get( 'zlib.output_compression' ) ) ob_start( 'ob_gzhandler' );
713736 }
714737
715 -\$wgSitename = \"{$slconf[Sitename]}\";
 738+\$wgSitename = \"{$slconf['Sitename']}\";
716739
717 -\$wgScriptPath = \"{$slconf[ScriptPath]}\";
 740+\$wgScriptPath = \"{$slconf['ScriptPath']}\";
718741 \$wgScript = \"\$wgScriptPath/index.php\";
719742 \$wgRedirectScript = \"\$wgScriptPath/redirect.php\";
720743
@@ -728,13 +751,13 @@
729752 \$wgUploadPath = \"\$wgScriptPath/images\";
730753 \$wgUploadDirectory = \"\$IP/images\";
731754
732 -\$wgEmergencyContact = \"{$slconf[EmergencyContact]}\";
733 -\$wgPasswordSender = \"{$slconf[PasswordSender]}\";
 755+\$wgEmergencyContact = \"{$slconf['EmergencyContact']}\";
 756+\$wgPasswordSender = \"{$slconf['PasswordSender']}\";
734757
735 -\$wgDBserver = \"{$slconf[DBserver]}\";
736 -\$wgDBname = \"{$slconf[DBname]}\";
737 -\$wgDBuser = \"{$slconf[DBuser]}\";
738 -\$wgDBpassword = \"{$slconf[DBpassword]}\";
 758+\$wgDBserver = \"{$slconf['DBserver']}\";
 759+\$wgDBname = \"{$slconf['DBname']}\";
 760+\$wgDBuser = \"{$slconf['DBuser']}\";
 761+\$wgDBpassword = \"{$slconf['DBpassword']}\";
739762
740763 ## To allow SQL queries through the wiki's Special:Askaql page,
741764 ## uncomment the next lines. THIS IS VERY INSECURE. If you want
@@ -764,16 +787,15 @@
765788
766789 \$wgLocalInterwiki = \$wgSitename;
767790
768 -\$wgLanguageCode = \"{$slconf[LanguageCode]}\";
769 -" . ($conf->Encoding ? "\$wgInputEncoding = \$wgOutputEncoding = \"{$slconf[Encoding]}\";" : "" ) . "
 791+\$wgLanguageCode = \"{$slconf['LanguageCode']}\";
 792+" . ($conf->Encoding ? "\$wgInputEncoding = \$wgOutputEncoding = \"{$slconf['Encoding']}\";" : "" ) . "
770793
 794+\$wgProxyKey = \"$proxyKey\";
 795+
771796 ## Default skin: you can change the default skin. Use the internal symbolic
772797 ## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook':
773798 # \$wgDefaultSkin = 'monobook';
774799
775 -## This is incomplete, ignore it:
776 -#\$wgProxyKey = $proxyKey;
777 -
778800 ## For attaching licensing metadata to pages, and displaying an
779801 ## appropriate copyright notice / icon. GNU Free Documentation
780802 ## License and Creative Commons licenses are supported so far.

Status & tagging log

  • 01:56, 13 October 2010 ^demon (Talk | contribs) changed the status of r3655 [removed: new added: old]
Personal tools
Namespaces

Variants
Views
Actions
Navigation
Support
Download
Development
Communication
Toolbox