| Index: trunk/phase3/maintenance/archives/moveCustomMessages.inc |
| — | — | @@ -1,5 +1,11 @@ |
| 2 | 2 | <? |
| 3 | 3 | |
| | 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 | + |
| 4 | 10 | function moveCustomMessages( $phase ) { |
| 5 | 11 | global $wgUser, $wgAllMessagesEn, $wgDeferredUpdateList, $wgLang ; |
| 6 | 12 | $wgUser = new User; |
| Index: trunk/phase3/maintenance/convertLinks.inc |
| — | — | @@ -1,6 +1,8 @@ |
| 2 | 2 | <?php |
| 3 | 3 | |
| 4 | 4 | function convertLinks() { |
| | 5 | + print "Converting links table to ID-ID...\n"; |
| | 6 | + |
| 5 | 7 | global $wgLang, $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname; |
| 6 | 8 | |
| 7 | 9 | $numRows = $tuplesAdded = $numBadLinks = $curRowsRead = 0; #counters etc |
| — | — | @@ -149,6 +151,7 @@ |
| 150 | 152 | print "Conversion complete. The converted table is at links_temp;\n"; |
| 151 | 153 | print "the original links table is unchanged.\n"; |
| 152 | 154 | } |
| | 155 | +} |
| 153 | 156 | |
| 154 | 157 | #-------------------------------------------------------------------- |
| 155 | 158 | |
| Index: trunk/phase3/config/index.php |
| — | — | @@ -153,6 +153,9 @@ |
| 154 | 154 | |
| 155 | 155 | require( "../install-utils.inc" ); |
| 156 | 156 | require( "../maintenance/updaters.inc" ); |
| | 157 | +require( "../maintenance/convertLinks.inc" ); |
| | 158 | +require( "../maintenance/archives/moveCustomMessages.inc" ); |
| | 159 | + |
| 157 | 160 | class ConfigData { |
| 158 | 161 | function getEncoded( $data ) { |
| 159 | 162 | # Hackish |
| — | — | @@ -399,11 +402,20 @@ |
| 400 | 403 | do_linkscc_update(); flush(); |
| 401 | 404 | do_hitcounter_update(); flush(); |
| 402 | 405 | do_recentchanges_update(); flush(); |
| 403 | | - echo "FIXME: need the link table change here\n"; |
| | 406 | + convertLinks(); flush(); |
| 404 | 407 | do_user_real_name_update(); flush(); |
| 405 | 408 | do_querycache_update(); flush(); |
| 406 | 409 | do_objectcache_update(); flush(); |
| 407 | 410 | 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 | + |
| 408 | 420 | initialiseMessages(); flush(); |
| 409 | 421 | chdir( "config" ); |
| 410 | 422 | |
| — | — | @@ -686,8 +698,19 @@ |
| 687 | 699 | $pretty = ($conf->prettyURLs ? "" : "# "); |
| 688 | 700 | $ugly = ($conf->prettyURLs ? "# " : ""); |
| 689 | 701 | $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 | + } |
| 690 | 714 | |
| 691 | | -# $proxyKey = Parser::getRandomString() . Parser::getRandomString(); |
| 692 | 715 | # Add slashes to strings for double quoting |
| 693 | 716 | $slconf = array_map( "addslashes", get_object_vars( $conf ) ); |
| 694 | 717 | |
| — | — | @@ -698,7 +721,7 @@ |
| 699 | 722 | # If you make manual changes, please keep track in case you need to |
| 700 | 723 | # recreate them later. |
| 701 | 724 | |
| 702 | | -\$IP = \"{$slconf[IP]}\"; |
| | 725 | +\$IP = \"{$slconf['IP']}\"; |
| 703 | 726 | ini_set( \"include_path\", \"\$IP/includes$sep\$IP/languages$sep\" . ini_get(\"include_path\") ); |
| 704 | 727 | include_once( \"DefaultSettings.php\" ); |
| 705 | 728 | |
| — | — | @@ -711,9 +734,9 @@ |
| 712 | 735 | {$zlib}if( !ini_get( 'zlib.output_compression' ) ) ob_start( 'ob_gzhandler' ); |
| 713 | 736 | } |
| 714 | 737 | |
| 715 | | -\$wgSitename = \"{$slconf[Sitename]}\"; |
| | 738 | +\$wgSitename = \"{$slconf['Sitename']}\"; |
| 716 | 739 | |
| 717 | | -\$wgScriptPath = \"{$slconf[ScriptPath]}\"; |
| | 740 | +\$wgScriptPath = \"{$slconf['ScriptPath']}\"; |
| 718 | 741 | \$wgScript = \"\$wgScriptPath/index.php\"; |
| 719 | 742 | \$wgRedirectScript = \"\$wgScriptPath/redirect.php\"; |
| 720 | 743 | |
| — | — | @@ -728,13 +751,13 @@ |
| 729 | 752 | \$wgUploadPath = \"\$wgScriptPath/images\"; |
| 730 | 753 | \$wgUploadDirectory = \"\$IP/images\"; |
| 731 | 754 | |
| 732 | | -\$wgEmergencyContact = \"{$slconf[EmergencyContact]}\"; |
| 733 | | -\$wgPasswordSender = \"{$slconf[PasswordSender]}\"; |
| | 755 | +\$wgEmergencyContact = \"{$slconf['EmergencyContact']}\"; |
| | 756 | +\$wgPasswordSender = \"{$slconf['PasswordSender']}\"; |
| 734 | 757 | |
| 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']}\"; |
| 739 | 762 | |
| 740 | 763 | ## To allow SQL queries through the wiki's Special:Askaql page, |
| 741 | 764 | ## uncomment the next lines. THIS IS VERY INSECURE. If you want |
| — | — | @@ -764,16 +787,15 @@ |
| 765 | 788 | |
| 766 | 789 | \$wgLocalInterwiki = \$wgSitename; |
| 767 | 790 | |
| 768 | | -\$wgLanguageCode = \"{$slconf[LanguageCode]}\"; |
| 769 | | -" . ($conf->Encoding ? "\$wgInputEncoding = \$wgOutputEncoding = \"{$slconf[Encoding]}\";" : "" ) . " |
| | 791 | +\$wgLanguageCode = \"{$slconf['LanguageCode']}\"; |
| | 792 | +" . ($conf->Encoding ? "\$wgInputEncoding = \$wgOutputEncoding = \"{$slconf['Encoding']}\";" : "" ) . " |
| 770 | 793 | |
| | 794 | +\$wgProxyKey = \"$proxyKey\"; |
| | 795 | + |
| 771 | 796 | ## Default skin: you can change the default skin. Use the internal symbolic |
| 772 | 797 | ## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook': |
| 773 | 798 | # \$wgDefaultSkin = 'monobook'; |
| 774 | 799 | |
| 775 | | -## This is incomplete, ignore it: |
| 776 | | -#\$wgProxyKey = $proxyKey; |
| 777 | | - |
| 778 | 800 | ## For attaching licensing metadata to pages, and displaying an |
| 779 | 801 | ## appropriate copyright notice / icon. GNU Free Documentation |
| 780 | 802 | ## License and Creative Commons licenses are supported so far. |