Pastakhov has submitted this change and it was merged.

Change subject: fix minor bug with nowiki tag
......................................................................


fix minor bug with nowiki tag

Thanks User:Protnet for report and User:Phorgo for help.

http://www.mediawiki.org/wiki/Extension_talk:MagicNoCache#Minor_bug_with_nowiki_tag_31305

Change-Id: Ia80c5cb0bf9a89c16d8ee00dd770b71a2d5975c4
(cherry picked from commit 4e67cebe27cdbbcdf88ca44220622bf8528f8747)
---
M MagicNoCache.php
1 file changed, 12 insertions(+), 24 deletions(-)

Approvals:
  Pastakhov: Verified; Looks good to me, approved



diff --git a/MagicNoCache.php b/MagicNoCache.php
index 47c13d4..3cc746d 100644
--- a/MagicNoCache.php
+++ b/MagicNoCache.php
@@ -24,11 +24,11 @@
 $wgExtensionCredits['parserhook'][] = array(
        'path'           => __FILE__,
        'name'           => 'MagicNoCache',
-       'version'        => '1.2.1',
+       'version'        => '1.2.2',
        'url'            => 
'https://www.mediawiki.org/wiki/Extension:MagicNoCache',
        'author'         => array(
                'Kimon Andreou',
-               'Pavel Astakhov',
+               '[https://www.mediawiki.org/wiki/User:Pastakhov Pavel 
Astakhov]',
                '...'
                ),
        'descriptionmsg' => 'magicnocache-desc'
@@ -41,27 +41,15 @@
 $wgExtensionMessagesFiles['MagicNoCache'] = $dir . '/MagicNoCache.i18n.php';
 $wgExtensionMessagesFiles['MagicNoCacheMagic'] = $dir . 
'/MagicNoCache.i18n.magic.php';
 
-// Register hooks
-$wgHooks['ParserBeforeTidy'][] = 'MagicNoCache::onParserBeforeTidy';
+// Check to see if we have the magic word in the article
+$wgHooks['InternalParseBeforeLinks'][] = function( &$parser, &$text ) {
+       global $wgOut, $wgAction;
+       $mw = MagicWord::get('MAG_NOCACHE');
 
-// Create extension class
-class MagicNoCache
-{
-       /**
-        * Check to see if we have the magic word in the article
-        * @global OutputPage $wgOut
-        * @global array $wgAction
-        * @return boolean
-        */
-       public static function onParserBeforeTidy(&$parser, &$text) {
-               global $wgOut, $wgAction;
-               $mw = MagicWord::get('MAG_NOCACHE');
-
-               // if it is there, remove it and disable caching
-               if ( !in_array( $wgAction, array( 'submit', 'edit') ) && 
$mw->matchAndRemove($text) ) {
-                       $parser->disableCache();
-                       $wgOut->enableClientCache(false);
-               }
-               return true;
+       // if it is there, remove it and disable caching
+       if ( !in_array( $wgAction, array( 'submit', 'edit') ) && 
$mw->matchAndRemove($text) ) {
+               $parser->disableCache();
+               $wgOut->enableClientCache(false);
        }
-}
+       return true;
+};

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia80c5cb0bf9a89c16d8ee00dd770b71a2d5975c4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MagicNoCache
Gerrit-Branch: REL1_21
Gerrit-Owner: Pastakhov <[email protected]>
Gerrit-Reviewer: Pastakhov <[email protected]>

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

Reply via email to