Aude has uploaded a new change for review.

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


Change subject: (bug 52038) catch exception when magic word not found and warn
......................................................................

(bug 52038) catch exception when magic word not found and warn

Change-Id: I3e1f7d070d304bcdec208c3c6542efc56d80009a
---
M client/WikibaseClient.hooks.php
1 file changed, 18 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/97/75997/1

diff --git a/client/WikibaseClient.hooks.php b/client/WikibaseClient.hooks.php
index 324d916..1032e59 100644
--- a/client/WikibaseClient.hooks.php
+++ b/client/WikibaseClient.hooks.php
@@ -679,10 +679,25 @@
         * @return bool
         */
        public static function onParserFirstCallInit( &$parser ) {
-               $parser->setFunctionHook( 'noexternallanglinks', 
'\Wikibase\NoLangLinkHandler::handle', SFH_NO_HASH );
+               try {
+                       $parser->setFunctionHook(
+                               'noexternallanglinks',
+                               '\Wikibase\NoLangLinkHandler::handle',
+                               SFH_NO_HASH
+                       );
+               } catch( \Exception $e ) {
+                       wfWarn( 'Wikibase noexternallanglinks magic word 
found.' );
+               }
 
-               if ( Settings::get( 'allowDataTransclusion' ) === true ) {
-                       $parser->setFunctionHook( 'property', array( 
'\Wikibase\PropertyParserFunction', 'render' ) );
+               try {
+                       if ( Settings::get( 'allowDataTransclusion' ) === true 
) {
+                               $parser->setFunctionHook(
+                                       'property',
+                                       array( 
'\Wikibase\PropertyParserFunction', 'render' )
+                               );
+                       }
+               } catch ( \Exception $e ) {
+                       wfWarn( 'Wikibase property parser function not found.' 
);
                }
 
                return true;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e1f7d070d304bcdec208c3c6542efc56d80009a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aude <[email protected]>

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

Reply via email to