https://bugzilla.wikimedia.org/show_bug.cgi?id=57647

       Web browser: ---
            Bug ID: 57647
           Summary: maintenance/rebuildFileCache.php fails when
                    $wgEnableCanonicalServerLink is set to true
           Product: MediaWiki
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: Unprioritized
         Component: Maintenance scripts
          Assignee: [email protected]
          Reporter: [email protected]
    Classification: Unclassified
   Mobile Platform: ---

This is what I get when setting $wgEnableCanonicalServerLink to true in
LocalSettings.php:

$ php maintenance/rebuildFileCache.php 
Building content page file cache from page 0!
Page 1 already cached
[057522cb] [no req]   Exception from line 1334 of
/home/<username>/public_html/mediawiki/includes/WebRequest.php:
FauxRequest::getRequestURL() not implemented
Backtrace:
#0 /home/<username>/public_html/mediawiki/includes/WebRequest.php(1385):
FauxRequest->notImplemented(string)
#1 /home/<username>/public_html/mediawiki/includes/OutputPage.php(3298):
FauxRequest->getRequestURL()
#2 /home/<username>/public_html/mediawiki/includes/OutputPage.php(3316):
OutputPage->getHeadLinksArray()
#3 /home/<username>/public_html/mediawiki/includes/OutputPage.php(2518):
OutputPage->getHeadLinks()
#4 /home/<username>/public_html/mediawiki/includes/SkinTemplate.php(498):
OutputPage->headElement(SkinVector)
#5 /home/<username>/public_html/mediawiki/includes/OutputPage.php(2078):
SkinTemplate->outputPage()
#6
/home/<username>/public_html/mediawiki/maintenance/rebuildFileCache.php(135):
OutputPage->output()
#7 /home/<username>/public_html/mediawiki/maintenance/doMaintenance.php(113):
RebuildFileCache->execute()
#8
/home/<username>/public_html/mediawiki/maintenance/rebuildFileCache.php(163):
require_once(string)
#9 {main}

This change fixes the bug for me, but it seems kind of hackish:
diff --git a/includes/WebRequest.php b/includes/WebRequest.php
index b17cb9e..05ffae7 100644
--- a/includes/WebRequest.php
+++ b/includes/WebRequest.php
@@ -1382,7 +1382,8 @@ class FauxRequest extends WebRequest {
        }

        public function getRequestURL() {
-               $this->notImplemented( __METHOD__ );
+               global $wgTitle;
+               return $wgTitle->getLocalURL();
        }

        /**

It works, though:

$ php maintenance/rebuildFileCache.php 
Building content page file cache from page 0!
Cached page 1
Cached page 2
Done!

How should I submit this change?

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to