jenkins-bot has submitted this change and it was merged.

Change subject: Really Activate $wgUserMediaWikiUIEverywhere everywhere
......................................................................


Really Activate $wgUserMediaWikiUIEverywhere everywhere

Set $wgUseMediaWikiUIEverywhere as early as possible (some contents
will be created before Skin is created and will not be MW UI).

Bug: 72853
Change-Id: I18fecda9aeb3e0babd92146d6e6413abf296bed3
---
M MobileFrontend.php
M includes/MobileFrontend.hooks.php
2 files changed, 43 insertions(+), 7 deletions(-)

Approvals:
  Jdlrobson: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/MobileFrontend.php b/MobileFrontend.php
index 25f8b11..9114724 100644
--- a/MobileFrontend.php
+++ b/MobileFrontend.php
@@ -111,6 +111,7 @@
 
 $wgHooks['LinksUpdate'][] = 'MobileFrontendHooks::onLinksUpdate';
 $wgHooks['RequestContextCreateSkin'][] = 
'MobileFrontendHooks::onRequestContextCreateSkin';
+$wgHooks['MediaWikiPerformAction'][] = 
'MobileFrontendHooks::onMediaWikiPerformAction';
 $wgHooks['SkinTemplateOutputPageBeforeExec'][] =
        'MobileFrontendHooks::onSkinTemplateOutputPageBeforeExec';
 $wgHooks['BeforePageRedirect'][] = 'MobileFrontendHooks::onBeforePageRedirect';
diff --git a/includes/MobileFrontend.hooks.php 
b/includes/MobileFrontend.hooks.php
index b1ecaa4..338227d 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -39,6 +39,24 @@
        }
 
        /**
+        * Enables the global booleans $wgHTMLFormAllowTableFormat and 
$wgUseMediaWikiUIEverywhere
+        * for mobile users.
+        */
+       private static function enableMediaWikiUI() {
+               global $wgHTMLFormAllowTableFormat, $wgUseMediaWikiUIEverywhere;
+
+               $mobileContext = MobileContext::singleton();
+
+               if ( $mobileContext->shouldDisplayMobileView() && 
!$mobileContext->isBlacklistedPage() ) {
+                       // Force non-table based layouts (see bug 63428)
+                       $wgHTMLFormAllowTableFormat = false;
+                       // Turn on MediaWiki UI styles so special pages with 
form are styled.
+                       // FIXME: Remove when this becomes the default.
+                       $wgUseMediaWikiUIEverywhere = true;
+               }
+       }
+
+       /**
         * RequestContextCreateSkin hook handler
         * @see 
https://www.mediawiki.org/wiki/Manual:Hooks/RequestContextCreateSkin
         *
@@ -47,8 +65,7 @@
         * @return bool
         */
        public static function onRequestContextCreateSkin( $context, &$skin ) {
-               global $wgMFDefaultSkinClass, $wgULSPosition, 
$wgHTMLFormAllowTableFormat,
-                       $wgUseMediaWikiUIEverywhere;
+               global $wgMFDefaultSkinClass, $wgULSPosition;
 
                $mobileContext = MobileContext::singleton();
 
@@ -59,11 +76,8 @@
                        return true;
                }
 
-               // Force non-table based layouts (see bug 63428)
-               $wgHTMLFormAllowTableFormat = false;
-               // Turn on MediaWiki UI styles so special pages with form are 
styled.
-               // FIXME: Remove when this becomes the default.
-               $wgUseMediaWikiUIEverywhere = true;
+               // enable wgUseMediaWikiUIEverywhere
+               self::enableMediaWikiUI();
 
                // FIXME: Remove hack around Universal Language selector bug 
57091
                $wgULSPosition = 'none';
@@ -104,6 +118,27 @@
        }
 
        /**
+        * MediaWikiPerformAction hook handler (enable mwui for all pages)
+        * @see 
https://www.mediawiki.org/wiki/Manual:Hooks/MediaWikiPerformAction
+        *
+        * @param OutputPage $output
+        * @param Article $article
+        * @param Title $title
+        * @param User $user
+        * @param RequestContext $request
+        * @param MediaWiki $wiki
+        * @return bool
+        */
+       public static function onMediaWikiPerformAction( $output, $article, 
$title,
+               $user, $request, $wiki
+       ) {
+               self::enableMediaWikiUI();
+
+               // don't prevent performAction to do anything
+               return true;
+       }
+
+       /**
         * SkinTemplateOutputPageBeforeExec hook handler
         * @see 
https://www.mediawiki.org/wiki/Manual:Hooks/SkinTemplateOutputPageBeforeExec
         *

-- 
To view, visit https://gerrit.wikimedia.org/r/170518
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I18fecda9aeb3e0babd92146d6e6413abf296bed3
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to