Last active
May 16, 2020 08:59
-
-
Save pa4080/0e7770dfb497f6ed543c8be8110c0b66 to your computer and use it in GitHub Desktop.
Patch for MediaWiki Extension:CollapsibleVector - https://github.com/wikimedia/mediawiki-extensions-CollapsibleVector/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** CollapsibleVectorHooks.php 2020-04-16 19:53:58.903979173 +0300 | |
--- CollapsibleVectorHooks.patch.php 2020-04-16 19:53:17.347693246 +0300 | |
*************** | |
*** 46,51 **** | |
--- 46,56 ---- | |
public static function isEnabled( $name ) { | |
global $wgCollapsibleVectorFeatures, $wgUser; | |
+ // Handle global false and anonymous users | |
+ $is_anonymosus_user = filter_var($wgUser, FILTER_VALIDATE_IP); | |
+ if ( $is_anonymosus_user && $wgCollapsibleVectorFeatures['customSettings']['anonymous'] === false ) { | |
+ return false; | |
+ } | |
// Features with global set to true are always enabled | |
if ( | |
!isset( $wgCollapsibleVectorFeatures[$name] ) || $wgCollapsibleVectorFeatures[$name]['global'] |
Tested with MediaWiki/CollapsibleVector REL1_34.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This patch allows to disable the
CollapsibleVector
feature for anonymous users by adding the following line in yourLocalSettings.php
:Unfortunately the embedded option
$wgCollapsibleVectorFeatures['collapsiblenav']['global'] = false;
doesn't help in this case. The logged in users are still able to enable the feature via their preferences.Here is how to apply the patch:
In order to revert the change before update use:
References:
https://www.thegeekstuff.com/2014/12/patch-command-examples/
diff -u source.file modified.file > patch.file