From 01802ac3fb67cbffe89719463b4ed0d4611cf57d Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Tue, 23 Jun 2015 13:46:35 -0700 Subject: [PATCH] Use RejectParserCacheValue hook to invalidate caches that were using GeSHi Change-Id: I47de88dc1c2f2380e41e6af0d3222b46c9c65569 --- SyntaxHighlight_GeSHi.class.php | 18 ++++++++++++++++++ extension.json | 3 +++ 2 files changed, 21 insertions(+) diff --git a/SyntaxHighlight_GeSHi.class.php b/SyntaxHighlight_GeSHi.class.php index 17ad20a1..5b7ea54a 100644 --- a/SyntaxHighlight_GeSHi.class.php +++ b/SyntaxHighlight_GeSHi.class.php @@ -378,6 +378,24 @@ class SyntaxHighlight_GeSHi { return false; } + /** + * Reject parser cache values that are for GeSHi since those + * ResourceLoader modules no longer exist + * + * @param ParserOutput $parserOutput + * @param WikiPage $page + * @param ParserOptions $popts + * @return bool + */ + public static function onRejectParserCacheValue( ParserOutput $parserOutput, WikiPage $page, ParserOptions $popts ) { + foreach ( $parserOutput->getModuleStyles() as $module ) { + if ( strpos( $module, 'ext.geshi.' ) === 0 ) { + return false; + } + } + return true; + } + /** Backward-compatibility shim for extensions. */ public static function prepare( $text, $lang ) { wfDeprecated( __METHOD__ ); diff --git a/extension.json b/extension.json index b589486c..f2d238d8 100644 --- a/extension.json +++ b/extension.json @@ -50,6 +50,9 @@ ], "ApiFormatHighlight": [ "SyntaxHighlight_GeSHi::onApiFormatHighlight" + ], + "RejectParserCacheValue": [ + "SyntaxHighlight_GeSHi::onRejectParserCacheValue" ] }, "SyntaxHighlightModels": {