Kaldari has uploaded a new change for review. https://gerrit.wikimedia.org/r/183187
Change subject: Fix campaigns picking ...................................................................... Fix campaigns picking Was completely broken by https://gerrit.wikimedia.org/r/#/c/180811/ Also, kill the catch that was masking it, at least we know that Wikidata is not causing errors during normal editing so far. Also, would really appreciate if people used an IDE that highlights obvious errors if they can't test their changes. Cherry-picked from master. Change-Id: I0d85a26a048d9dfae7ed4a8061daaa92cb01517d --- M includes/Hooks.php M includes/WikibaseConnector.php 2 files changed, 26 insertions(+), 8 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikiGrok refs/changes/87/183187/1 diff --git a/includes/Hooks.php b/includes/Hooks.php index 5ebb989..dd3d1be 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -68,12 +68,8 @@ $parserOutput = $lu->getParserOutput(); $campaigns = new QuestionPicker( self::getConfig() ); - $data = array(); - try { - $data = $campaigns->getSlowQuestions( $parserOutput ); - } catch ( \Exception $ex ) { - wfDebugLog( 'mobile', __METHOD__ . "(): {$ex->getMessage()}" ); - } + $data = $campaigns->getSlowQuestions( $parserOutput ); + $store = new QuestionStore(); $store->store( $lu->getTitle(), $data ); $cache = new QuestionCache( self::getConfig() ); diff --git a/includes/WikibaseConnector.php b/includes/WikibaseConnector.php index 5ecfb1d..76bf1af 100644 --- a/includes/WikibaseConnector.php +++ b/includes/WikibaseConnector.php @@ -28,12 +28,23 @@ } /** + * Creates entity id of a proper type from a string + * + * @param $idString + * @return EntityId + */ + public function createEntityId( $idString ) { + $parser = WikibaseClient::getDefaultInstance()->getEntityIdParser(); + return $parser->parse( $idString ); + } + + /** * @param string $entityId * @return Entity */ public function getEntity( $entityId ) { return $this->getEntityLookup()->getEntity( - new ItemId( $entityId ) + $this->createEntityId( $entityId ) ); } @@ -97,6 +108,17 @@ } /** + * Gets the Wikidata label of the property in the content language of the + * host wiki. + * + * @param string $property + * @return string + */ + public function getLabelForProperty( $property ) { + return $this->getLabel( $this->getEntity( $property ) ); + } + + /** * Returns a list of values of given properties of a given Wikidata item * * @param string $itemId: item identifier @@ -139,4 +161,4 @@ return $values; } -} \ No newline at end of file +} -- To view, visit https://gerrit.wikimedia.org/r/183187 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0d85a26a048d9dfae7ed4a8061daaa92cb01517d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikiGrok Gerrit-Branch: wmf/1.25wmf13 Gerrit-Owner: Kaldari <[email protected]> Gerrit-Reviewer: MaxSem <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
