jenkins-bot has submitted this change and it was merged.

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.

Change-Id: I0d85a26a048d9dfae7ed4a8061daaa92cb01517d
---
M includes/Hooks.php
M includes/WikibaseConnector.php
2 files changed, 15 insertions(+), 8 deletions(-)

Approvals:
  Kaldari: Looks good to me, approved
  jenkins-bot: Verified



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 40f45c9..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 )
                );
        }
 
@@ -104,7 +115,7 @@
         * @return string
         */
        public function getLabelForProperty( $property ) {
-               return $this->getLabel( new PropertyId( $property ) );
+               return $this->getLabel( $this->getEntity( $property ) );
        }
 
        /**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0d85a26a048d9dfae7ed4a8061daaa92cb01517d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikiGrok
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: Phuedx <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to