https://bugs.kde.org/show_bug.cgi?id=458903

            Bug ID: 458903
           Summary: "wgPageName not defined" JavaScript error from site
                    JavaScript on techbase and userbase wikis
           Product: KDE MediaWiki
           Version: unspecified
          Platform: unspecified
                OS: All
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: schwanc...@protonmail.com
          Reporter: skierp...@gmail.com
  Target Milestone: ---

STEPS TO REPRODUCE
1. Open browser's developer console
2. Visit any page on those web sites, e.g.
https://userbase.kde.org/Welcome_to_KDE_UserBase
3. Append ?debug=true and reload

OBSERVED RESULT
The Firefox browser console shows
Uncaught ReferenceError: wgPageName is not defined

If you append ?debug=true (see
https://www.mediawiki.org/wiki/ResourceLoader/Architecture#Debug_mode ), the
concatenated but uncompressed JavaScript reveals the broken code is from
https://techbase.kde.org/MediaWiki:Common.js where you can have wiki-specific
code, and indeed this has
   if (wgPageName == "Special:Search") //scripts specific to Special:Search
  {
      importScript("MediaWiki:Common.js/search.js")         |     
importScript("MediaWiki:Common.js/search.js")
  }

EXPECTED RESULT
No error. MediaWiki has deprecated global wg variables for a decade, see
https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_(users)#Global_wg_variables.

SOFTWARE/OS VERSIONS
N/A

ADDITIONAL INFORMATION
I can't fix this because editing https://techbase.kde.org/MediaWiki:Common.js
(wisely!) restricted to users in some special group.

https://community.kde.org/MediaWiki:Common.js doesn't have this code, or
seemingly any site JavaScript.

I think the rest of the JavaScript in common.js isn't loaded, so probably the
search script https://userbase.kde.org/MediaWiki:Common.js/search.js isn't
loaded; I think it wants to add searches of the kde wiki using "Windows Live"
and other search engines. Fixing this bug is trivial, probably just replace
with `mw.config.get('wgPageName') ` instead, but I think that will just lead to
more JavaScript errors (e.g. wgUserGroups on userbase will also fail). Since
search is working fine it's probably safest to remove all the JavaScript. The
JavaScript was added to techbase and userbase by user Danimo back in 2009, and
then user Nikerabbit tweaked it on userbase in 2011.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to