Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/228209

Change subject: Use SidebarBeforeOutput hook & stop disabling sidebar cache
......................................................................

Use SidebarBeforeOutput hook & stop disabling sidebar cache

The SidebarBeforeOutput hook has the same signature as the
SkinBuildSidebar hook, except it runs after the sidebar cache, so we
don't have to disable it.

Bug: T104951
Change-Id: I45b45fa7446958e162fe7a74c25c96c73a9d28da
(cherry picked from commit 09d2585e92fc387055ac2878ef3c70fe4ac490ae)
---
M DynamicSidebar.body.php
M DynamicSidebar.php
M extension.json
3 files changed, 3 insertions(+), 24 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DynamicSidebar 
refs/changes/09/228209/1

diff --git a/DynamicSidebar.body.php b/DynamicSidebar.body.php
index fd6f0ca..4a57855 100644
--- a/DynamicSidebar.body.php
+++ b/DynamicSidebar.body.php
@@ -1,24 +1,7 @@
 <?php
 class DynamicSidebar {
        /**
-        * Called through $wgExtensionFunctions. Disables sidebar cache if 
necessary
-        */
-       public static function setup() {
-               global $wgUser, $wgEnableSidebarCache;
-
-               // Don't pollute the sidebar cache for non-logged-in users
-               // Also ensure that logged-in users are getting dynamic content
-               // FIXME: Only do this for users who should actually get the 
non-standard sidebar
-               // FIXME: Accessing $wgUser inside an extension function can 
break depending on
-               // what other extensions are installed
-               if ( $wgUser->isLoggedIn() ) {
-                       $wgEnableSidebarCache = false;
-               }
-               return true;
-       }
-
-       /**
-        * Called from SkinBuildSidebar hook. Modifies the sidebar
+        * Called from SidebarBeforeOutput hook. Modifies the sidebar
         * via callbacks.
         *
         * @param Skin $skin
diff --git a/DynamicSidebar.php b/DynamicSidebar.php
index a7cb902..60a3c8a 100644
--- a/DynamicSidebar.php
+++ b/DynamicSidebar.php
@@ -47,8 +47,7 @@
        'descriptionmsg' => 'dynamicsidebar-desc',
 );
 
-$wgExtensionFunctions[] = 'DynamicSidebar::setup';
-$wgHooks['SkinBuildSidebar'][] = 'DynamicSidebar::modifySidebar';
+$wgHooks['SidebarBeforeOutput'][] = 'DynamicSidebar::modifySidebar';
 
 $wgAutoloadClasses['DynamicSidebar'] = __DIR__ . '/DynamicSidebar.body.php';
 $wgMessagesDirs['DynamicSidebar'] = __DIR__ . '/i18n';
diff --git a/extension.json b/extension.json
index e343cb6..a41e317 100644
--- a/extension.json
+++ b/extension.json
@@ -15,7 +15,7 @@
                "DynamicSidebar": "DynamicSidebar.i18n.php"
        },
        "Hooks": {
-               "SkinBuildSidebar": [
+               "SidebarBeforeOutput": [
                        "DynamicSidebar::modifySidebar"
                ]
        },
@@ -24,9 +24,6 @@
                        "i18n"
                ]
        },
-       "ExtensionFunctions": [
-               "DynamicSidebar::setup"
-       ],
        "AutoloadClasses": {
                "DynamicSidebar": "DynamicSidebar.body.php"
        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I45b45fa7446958e162fe7a74c25c96c73a9d28da
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DynamicSidebar
Gerrit-Branch: REL1_25
Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com>

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

Reply via email to