http://www.mediawiki.org/wiki/Special:Code/MediaWiki/75650

Revision: 75650
Author:   demon
Date:     2010-10-29 16:28:50 +0000 (Fri, 29 Oct 2010)
Log Message:
-----------
(bug 19593) $wgServer can't be set properly with --server attribute in command 
line tools. Also fixes regression in generateSitemap.php from maintenance 
rewrite. Also possible workaround for bug 18274.

Modified Paths:
--------------
    trunk/phase3/RELEASE-NOTES
    trunk/phase3/maintenance/Maintenance.php
    trunk/phase3/maintenance/generateSitemap.php

Modified: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES  2010-10-29 16:22:43 UTC (rev 75649)
+++ trunk/phase3/RELEASE-NOTES  2010-10-29 16:28:50 UTC (rev 75650)
@@ -188,6 +188,7 @@
 * (bug 23194) Special:ListFiles now has thumbnails
 * Use hreflang to specify canonical and alternate links, search engine friendly
   when a wiki has multiple variant languages.
+* (bug 19593) Specifying --server in now works for all maintenance scripts
 
 === Bug fixes in 1.17 ===
 * (bug 17560) Half-broken deletion moved image files to deletion archive

Modified: trunk/phase3/maintenance/Maintenance.php
===================================================================
--- trunk/phase3/maintenance/Maintenance.php    2010-10-29 16:22:43 UTC (rev 
75649)
+++ trunk/phase3/maintenance/Maintenance.php    2010-10-29 16:28:50 UTC (rev 
75650)
@@ -351,6 +351,9 @@
                $this->addOption( 'wiki', 'For specifying the wiki ID', false, 
true );
                $this->addOption( 'globals', 'Output globals at the end of 
processing for debugging' );
                $this->addOption( 'memory-limit', 'Set a specific memory limit 
for the script, "max" for no limit or "default" to avoid changing it' );
+               $this->addOption( 'server', "The protocol and server name to 
use in URLs, e.g.\n" .
+                                                       
"\t\thttp://en.wikipedia.org. This is sometimes necessary because\n" .
+                                                       "\t\tserver name 
detection may fail in command line scripts.", false, true );
                // If we support a DB, show the options
                if ( $this->getDbType() > 0 ) {
                        $this->addOption( 'dbuser', 'The DB user to use for 
this script', false, true );
@@ -693,7 +696,7 @@
         * Handle some last-minute setup here.
         */
        public function finalSetup() {
-               global $wgCommandLineMode, $wgShowSQLErrors;
+               global $wgCommandLineMode, $wgShowSQLErrors, $wgServer;
                global $wgProfiling, $wgDBadminuser, $wgDBadminpassword;
                global $wgDBuser, $wgDBpassword, $wgDBservers, $wgLBFactoryConf;
 
@@ -704,6 +707,11 @@
                # Same with these
                $wgCommandLineMode = true;
 
+               # Override $wgServer
+               if( $this->hasOption( 'server') ) {
+                       $wgServer = $this->getOption( 'server', $wgServer );
+               }
+
                # If these were passed, use them
                if ( $this->mDbUser ) {
                        $wgDBadminuser = $this->mDbUser;

Modified: trunk/phase3/maintenance/generateSitemap.php
===================================================================
--- trunk/phase3/maintenance/generateSitemap.php        2010-10-29 16:22:43 UTC 
(rev 75649)
+++ trunk/phase3/maintenance/generateSitemap.php        2010-10-29 16:28:50 UTC 
(rev 75650)
@@ -128,9 +128,6 @@
                $this->mDescription = "Creates a sitemap for the site";
                $this->addOption( 'fspath', 'The file system path to save to, 
e.g. /tmp/sitemap' .
                                                                        
"\n\t\tdefaults to current directory", false, true );
-               $this->addOption( 'server', "The protocol and server name to 
use in URLs, e.g.\n" .
-                                                                       
"\t\thttp://en.wikipedia.org. This is sometimes necessary because\n" .
-                                                                       
"\t\tserver name detection may fail in command line scripts.", false, true );
                $this->addOption( 'compress', 'Compress the sitemap files, can 
take value yes|no, default yes', false, true );
        }
 


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to