Aude has uploaded a new change for review.

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


Change subject: (bug 50729, bug 51699) handle exception in the langlinkhander
......................................................................

(bug 50729, bug 51699) handle exception in the langlinkhander

- there are legitimate reasons for the sites table to be empty
or missing the site id!
- in such situations, no wikibase lang links can be found and none
added, with warning

Change-Id: Icb5350f9bd75a522847f82f1215ff5bffcfea4d6
---
M client/WikibaseClient.hooks.php
1 file changed, 11 insertions(+), 5 deletions(-)


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

diff --git a/client/WikibaseClient.hooks.php b/client/WikibaseClient.hooks.php
index 1e0577f..38d09cb 100644
--- a/client/WikibaseClient.hooks.php
+++ b/client/WikibaseClient.hooks.php
@@ -388,6 +388,8 @@
        public static function onParserAfterParse( \Parser &$parser, &$text, 
\StripState $stripState ) {
                wfProfileIn( __METHOD__ );
 
+               // @todo split up the multiple responsibilities here and in 
lang link handler
+
                $parserOutput = $parser->getOutput();
 
                // only run this once, for the article content and not 
interface stuff
@@ -406,12 +408,16 @@
 
                $useRepoLinks = $langLinkHandler->useRepoLinks( 
$parser->getTitle(), $parser->getOutput() );
 
-               if ( $useRepoLinks ) {
-                       // add links
-                       $langLinkHandler->addLinksFromRepository( 
$parser->getTitle(), $parser->getOutput() );
-               }
+               try {
+                       if ( $useRepoLinks ) {
+                               // add links
+                               $langLinkHandler->addLinksFromRepository( 
$parser->getTitle(), $parser->getOutput() );
+                       }
 
-               $langLinkHandler->updateItemIdProperty( $parser->getTitle(), 
$parser->getOutput() );
+                       $langLinkHandler->updateItemIdProperty( 
$parser->getTitle(), $parser->getOutput() );
+               } catch ( \Exception $e ) {
+                       wfWarn( 'Failed to add repo links: ' . $e->getMessage() 
);
+               }
 
                if ( $useRepoLinks || Settings::get( 'alwaysSort' ) ) {
                        // sort links

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icb5350f9bd75a522847f82f1215ff5bffcfea4d6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aude <aude.w...@gmail.com>

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

Reply via email to