jthingelstad / foreground

A MediaWiki skin that focuses on putting your content in the foreground.
http://foreground.wikiproject.net/
Other
137 stars 60 forks source link

Error 500 with this skin (only MW1.32 because of wfRunHooks() function) #338

Closed Ash-Crow closed 5 years ago

Ash-Crow commented 5 years ago

Setup

Issue

I just installed the skin, and when activated only the skin interface (Top bar, Actions button), but not the page contents (whatever the page is) Looking at the console of my browser I see errors like TypeError: mw.message is not a function TypeError: mw.msg is not a function

And the network tab shows a error 500 code.

The Mediawiki log files has lines like this: [exception] [053b8f0ba8e99bfd820297ae] /wiki/Ash:Index Error from line 202 of /<redactedbasepath>/skins/foreground/Foreground.skin.php: Call to undefined function wfRunHooks() The wiki works fine with Vector.

Hutchy68 commented 5 years ago

There is probably some deprecated code. I’ll have to take a look.

jamespharvey20 commented 5 years ago

I also just installed, and only see the skin interface, but not the page contents. I don't get those TypeError messages on my browser console, and don't see error 500's on my browser network tab.

I tried setting up Mediawiki logging, and failed. It never writes to the file, even with 666 permissions, either being in /var/log/ or /usr/share/webapps/mediawiki/ (where mediawiki is installed on Arch Linux, and is the directory in apache config.)

Viewing page source shows it attempts printing the page 3 times, including 3 <!DOCTYPE html> tags. Just quoting one fo these below, rather than repeating 3 times. See the extra DOCTYPE on the last line, at the very end. Hoping this source might help show where this is going wrong.

Note another skin I just tried (https://github.com/mtyeh411/mediawiki-bootstrap) has a somewhat similar behavior. It tries printing the pages 3 times, but shows a completely blank screen.

<!DOCTYPE html>
<html class="client-nojs" lang="en" dir="ltr">
<head>
<meta charset="UTF-8"/>
<title>Brain</title>
<script>document.documentElement.className = document.documentElement.className.replace( /(^|\s)client-nojs(\s|$)/, "$1client-js$2" );</script>
<script>(window.RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"Main_Page","wgTitle":"Main Page","wgCurRevisionId":1671,"wgRevisionId":1671,"wgArticleId":1,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":"jamespharvey20","wgUserGroups":["bureaucrat","interface-admin","sysop","*","user","autoconfirmed"],"wgCategories":[],"wgBreakFrames":false,"wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy","wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgMonthNamesShort":["","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"wgRelevantPageName":"Main_Page","wgRelevantArticleId":1,"wgRequestId":"4a1d3f09d7fa93ec1b1b65a8","wgCSPNonce":false,"wgUserId":1,"wgUserEditCount":1770,"wgUserRegistration":1441871779000,"wgUserNewMsgRevisionId":null,"wgIsProbablyEditable":true,"wgRelevantPageIsProbablyEditable":true,"wgRestrictionEdit":[],"wgRestrictionMove":[],"wgIsMainPage":true,"wgVisualEditor":{"pageLanguageCode":"en","pageLanguageDir":"ltr","pageVariantFallbacks":"en","usePageImages":false,"usePageDescriptions":false},"wgCategoryTreePageCategoryOptions":"{\"mode\":0,\"hideprefix\":20,\"showcount\":true,\"namespaces\":false}","wgVisualEditorToolbarScrollOffset":0,"wgVisualEditorUnsupportedEditParams":["undo","undoafter","veswitched"],"wgEditSubmitButtonLabelPublish":false});mw.loader.state({"site.styles":"ready","noscript":"ready","user.styles":"ready","user":"ready","user.options":"loading","user.tokens":"loading","ext.categoryTree.css":"ready","mediawiki.legacy.shared":"ready","mediawiki.legacy.commonPrint":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready","skins.foreground.styles":"ready"});mw.loader.implement("user.options@09trr36",function($,jQuery,require,module){/*@nomin*/mw.user.options.set({"visualeditor-hidebetawelcome":"1","visualeditor-editor":"visualeditor","rcdays":"30","rcfilters-limit":"500","rcfilters-rc-collapsed":0,"rcfilters-saved-queries":"{\"queries\":{},\"version\":\"2\"}","visualeditor-diffmode-visual":"\"source\"","visualeditor-findAndReplace-diacritic":"false","visualeditor-findAndReplace-findText":"\"mind \"","visualeditor-findAndReplace-matchCase":"false","visualeditor-findAndReplace-regex":"false","visualeditor-findAndReplace-word":"false","visualeditor-hideusered":"1","visualeditor-hidevisualswitchpopup":"1"});
});mw.loader.implement("user.tokens@0tffind",function($,jQuery,require,module){/*@nomin*/mw.user.tokens.set({"editToken":"338f629433f87eb9da99863a1e091c245c490559+\\","patrolToken":"3bca3f2e35bc719da19d1b3fea1814295c490559+\\","watchToken":"e8ea266f594789ae31972d3fb7be07865c490559+\\","csrfToken":"338f629433f87eb9da99863a1e091c245c490559+\\"});
});RLPAGEMODULES=["ext.categoryTree","site","mediawiki.page.startup","mediawiki.user","mediawiki.page.ready","mediawiki.searchSuggest","mediawiki.page.watch.ajax","ext.visualEditor.desktopArticleTarget.init","ext.visualEditor.targetLoader","skins.foreground.js"];mw.loader.load(RLPAGEMODULES);});</script>
<link rel="stylesheet" href="/mediawiki/load.php?debug=false&amp;lang=en&amp;modules=ext.categoryTree.css%7Cext.visualEditor.desktopArticleTarget.noscript%7Cmediawiki.legacy.commonPrint%2Cshared%7Cskins.foreground.styles&amp;only=styles&amp;skin=foreground"/>
<script async="" src="/mediawiki/load.php?debug=false&amp;lang=en&amp;modules=startup&amp;only=scripts&amp;skin=foreground"></script>
<meta name="ResourceLoaderDynamicStyles" content=""/>
<link rel="stylesheet" href="/mediawiki/load.php?debug=false&amp;lang=en&amp;modules=site.styles&amp;only=styles&amp;skin=foreground"/>
<meta name="generator" content="MediaWiki 1.32.0"/>
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0"/>
<link rel="alternate" type="application/x-wiki" title="Edit" href="/mediawiki/index.php?title=Main_Page&amp;action=edit"/>
<link rel="edit" title="Edit" href="/mediawiki/index.php?title=Main_Page&amp;action=edit"/>
<link rel="shortcut icon" href="/favicon.ico"/>
<link rel="search" type="application/opensearchdescription+xml" href="/mediawiki/opensearch_desc.php" title="Brain (en)"/>
<link rel="EditURI" type="application/rsd+xml" href="http://45.63.106.241/mediawiki/api.php?action=rsd"/>
<link rel="alternate" type="application/atom+xml" title="Brain Atom feed" href="/mediawiki/index.php?title=Special:RecentChanges&amp;feed=atom"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!--[if lt IE 9]><script src="/mediawiki/load.php?debug=false&amp;lang=en&amp;modules=html5shiv&amp;only=scripts&amp;skin=vector&amp;sync=1"></script><![endif]-->
</head>
<body class="mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Main_Page rootpage-Main_Page skin-foreground action-view"><div id='navwrapper'><!-- START FOREGROUNDTEMPLATE -->
        <nav class="top-bar" data-topbar role="navigation" data-options="back_text: Back">
            <ul class="title-area">
                <li class="name">
                    <div class="title-name">
                    <a href="/mediawiki/index.php/Main_Page">

                    <div class="title-name" style="display: inline-block;">Brain</div>
                    </a>
                    </div>
                </li>
                <li class="toggle-topbar menu-icon">
                    <a href="#"><span>Menu</span></a>
                </li>
            </ul>

        <section class="top-bar-section">

            <ul id="top-bar-left" class="left">
                <li class="divider show-for-small"></li>
                                    <li class="has-dropdown active"  id='p-navigation'>
                    <a href="#">Navigation</a>
                                                    <ul class="dropdown">
                                <li id="n-mainpage-description"><a href="/mediawiki/index.php/Main_Page" title="Visit the main page [z]" accesskey="z">Main page</a></li><li id="n-recentchanges"><a href="/mediawiki/index.php/Special:RecentChanges" title="A list of recent changes in the wiki [r]" accesskey="r">Recent changes</a></li><li id="n-randompage"><a href="/mediawiki/index.php/Special:Random" title="Load a random page [x]" accesskey="x">Random page</a></li><li id="n-help-mediawiki"><a href="https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents">Help about MediaWiki</a></li>                         </ul>
                                                                                            </ul>

            <ul id="top-bar-right" class="right">
                <li class="has-form">
                    <form action="/mediawiki/index.php" id="searchform" class="mw-search">
                        <div class="row collapse">
                        <div class="small-12 columns">
                            <input type="search" name="search" placeholder="Search Brain" title="Search Brain [f]" accesskey="f" id="searchInput"/>                         <button type="submit" class="button search">Search</button>
                        </div>
                        </div>
                    </form>
                </li>
                <li class="divider show-for-small"></li>

                <li class="has-dropdown active"><a href="#"><i class="fa fa-cogs"></i></a>
                    <ul id="toolbox-dropdown" class="dropdown">
                        <li id="t-whatlinkshere"><a href="/mediawiki/index.php/Special:WhatLinksHere/Main_Page" title="A list of all wiki pages that link here [j]" accesskey="j">What links here</a></li><li id="t-recentchangeslinked"><a href="/mediawiki/index.php/Special:RecentChangesLinked/Main_Page" rel="nofollow" title="Recent changes in pages linked from this page [k]" accesskey="k">Related changes</a></li><li id="t-specialpages"><a href="/mediawiki/index.php/Special:SpecialPages" title="A list of all special pages [q]" accesskey="q">Special pages</a></li><li id="t-print"><a href="/mediawiki/index.php?title=Main_Page&amp;useskin=foreground&amp;printable=yes" rel="alternate" title="Printable version of this page [p]" accesskey="p">Printable version</a></li><li id="t-permalink"><a href="/mediawiki/index.php?title=Main_Page&amp;oldid=1671" title="Permanent link to this revision of the page">Permanent link</a></li><li id="t-info"><a href="/mediawiki/index.php?title=Main_Page&amp;action=info" title="More information about this page">Page information</a></li>                        <li id="n-recentchanges"><a href="/mediawiki/index.php/Special:RecentChanges" title="Special:RecentChanges">Recent changes</a></li>                     <li id="n-help" ><a href="https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents">Help</a></li>                    </ul>
                </li>

                <li id="personal-tools-dropdown" class="has-dropdown active"><a href="#"><i class="fa fa-user"></i></a>
                    <ul class="dropdown">
                        <li id="pt-userpage"><a href="/mediawiki/index.php/User:jamespharvey20" class="new" dir="auto" title="Your user page (page does not exist) [.]" accesskey=".">jamespharvey20</a></li><li id="pt-mytalk"><a href="/mediawiki/index.php/User_talk:jamespharvey20" class="new" title="Your talk page (page does not exist) [n]" accesskey="n">Talk</a></li><li id="pt-preferences"><a href="/mediawiki/index.php/Special:Preferences" title="Your preferences">Preferences</a></li><li id="pt-watchlist"><a href="/mediawiki/index.php/Special:Watchlist" title="A list of pages you are monitoring for changes [l]" accesskey="l">Watchlist</a></li><li id="pt-mycontris"><a href="/mediawiki/index.php/Special:Contributions/jamespharvey20" title="A list of your contributions [y]" accesskey="y">Contributions</a></li><li id="pt-logout"><a href="/mediawiki/index.php?title=Special:UserLogout&amp;returnto=Main+Page&amp;returntoquery=useskin%3Dforeground" title="Log out">Log out</a></li>                  </ul>
                </li>

            </ul>
        </section>
        </nav>

        </div>      
        <div id="page-content">
        <div class="row">
                <div class="large-12 columns">
                    <!-- Output page indicators -->
                    <div class="mw-indicators mw-body-content">
</div>
                    <!-- If user is logged in output echo location -->
                                        <div id="echo-notifications">
                    <div id="echo-notifications-alerts"></div>
                    <div id="echo-notifications-messages"></div>
                    <div id="echo-notifications-notice"></div>
                    </div>
                                    <!--[if lt IE 9]>
                <div id="siteNotice" class="sitenotice panel radius">Brain may not look as expected in this version of Internet Explorer. We recommend you upgrade to a newer version of Internet Explorer or switch to a browser like Firefox or Chrome.</div>
                <![endif]-->

                                                </div>
        </div>

        <div id="mw-js-message" style="display:none;"></div>

        <div class="row">
                <div id="p-cactions" class="large-12 columns">
                                            <a id="actions-button" href="#" data-dropdown="actions" data-options="align:left; is_hover: true; hover_timeout:700" class="button small secondary radius"><i class="fa fa-cog"><span class="show-for-medium-up">&nbsp;Actions</span></i></a>
                        <!--RTL -->
                        <ul id="actions" class="f-dropdown" data-dropdown-content>
                            <li id="ca-nstab-main" class="selected"><a href="/mediawiki/index.php/Main_Page" title="View the content page [c]" accesskey="c">Main page</a></li><li id="ca-talk" class="new"><a href="/mediawiki/index.php?title=Talk:Main_Page&amp;action=edit&amp;redlink=1" rel="discussion" title="Discussion about the content page (page does not exist) [t]" accesskey="t">Discussion</a></li><li id="ca-ve-edit"><a href="/mediawiki/index.php?title=Main_Page&amp;veaction=edit" title="Edit this page [v]" accesskey="v">Edit</a></li><li id="ca-edit" class="collapsible"><a href="/mediawiki/index.php?title=Main_Page&amp;action=edit" title="Edit this page [e]" accesskey="e">Edit source</a></li><li id="ca-history"><a href="/mediawiki/index.php?title=Main_Page&amp;action=history" title="Past revisions of this page [h]" accesskey="h">History</a></li><li id="ca-delete"><a href="/mediawiki/index.php?title=Main_Page&amp;action=delete" title="Delete this page [d]" accesskey="d">Delete</a></li><li id="ca-move"><a href="/mediawiki/index.php/Special:MovePage/Main_Page" title="Move this page [m]" accesskey="m">Move</a></li><li id="ca-protect"><a href="/mediawiki/index.php?title=Main_Page&amp;action=protect" title="Protect this page [=]" accesskey="=">Protect</a></li><li id="ca-unwatch" class="mw-watchlink"><a href="/mediawiki/index.php?title=Main_Page&amp;action=unwatch" data-mw="interface" title="Remove this page from your watchlist [w]" accesskey="w">Unwatch</a></li>                         <!DOCTYPE html>
jamespharvey20 commented 5 years ago

All that's needed to fix is in Foreground.skin.php, change line 202's call to wfRunHooks to Hooks::run. Then, it works fine.

Found this in the MediaWiki 1.32 Release Notes.

I got MediaWiki logging working, but the error was being logged to apache's error_log.

Hutchy68 commented 5 years ago

Thanks for the fix post @jamespharvey20

All that's needed to fix is in Foreground.skin.php, change line 202's call to wfRunHooks to Hooks::run.

Repeating >

Change line 202 in Forground.skin.php from wfRunHooks to Hooks::run

I will work on releasing the fix, but I first need to test how far backwards compatibility will be. ie. Does it break MW 1.27 mainly is my focus.

kghbln commented 5 years ago

Since also a couple of other people noted the incompatibility on mw.org I updated the docu pointing to this bug. I have also added a note to . Once the fix was release with a new version I will amend the docu accordingly.

Extarys commented 5 years ago

An updated version would indeed be nice. Thanks @kghbln for linking to this issue, I was going to try it :)

MaxSem commented 5 years ago

Hooks::run() was introduced in 1.22, you won't break 1.27 support.

roguespider commented 5 years ago

Changed line 202 in Forground.skin.php from wfRunHooks to Hooks::run this does not fix anything content still missing

patrikroy commented 5 years ago

The fix worked perfectly for me on 1.32

Hutchy68 commented 5 years ago

Solved with release of v2.2.0 #344

kghbln commented 5 years ago

@Hutchy68 FYI I finally upgraded to MediaWiki 1.31.1 and Foreground 2.2.0 Sorry that it took me so long.