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

Change subject: Debug mode
......................................................................


Debug mode

Override Wikidata id for the current page by appending &wikidataid=Q...
to the URL.

Change-Id: Ib457201c0cb40b837a40c80df0c88556ef838b63
---
M WikiGrok.php
M includes/Hooks.php
2 files changed, 11 insertions(+), 3 deletions(-)

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



diff --git a/WikiGrok.php b/WikiGrok.php
index e02d711..6d90f78 100644
--- a/WikiGrok.php
+++ b/WikiGrok.php
@@ -96,3 +96,8 @@
  * Fast campaign cache expiry in seconds
  */
 $wgWikiGrokFastCampaignsCacheTime = 60 * 60 * 24; // 1 day
+
+/**
+ * Enables developer mode that allows to override Wikidata item id for the 
current page
+ */
+$wgWikiGrokDebug = false;
diff --git a/includes/Hooks.php b/includes/Hooks.php
index bc97e81..6b6c8af 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -56,14 +56,17 @@
                        $config = self::getConfig();
                        $campaigns = new QuestionPicker( $config );
 
-                       $list =
-                               self::filterCampaigns(
+                       if ( $config->get( 'WikiGrokDebug' ) ) {
+                               $item = $out->getRequest()->getText( 
'wikidataid', $item );
+                       }
+
+                       $list = self::filterCampaigns(
                                        unserialize( $prop ),
                                        $config->get( 'WikiGrokSlowCampaigns' )
                                )
                                + self::filterCampaigns(
                                        $campaigns->getFastQuestions( 
$out->getTitle(), $item ),
-                                       $config->get( 'WikiGrokFastCampaigns')
+                                       $config->get( 'WikiGrokFastCampaigns' )
                                );
                        if ( $list ) {
                                $out->addJsConfigVars( 'wgWikiGrokCampaigns', 
$list );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib457201c0cb40b837a40c80df0c88556ef838b63
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/WikiGrok
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>
Gerrit-Reviewer: Bmansurov <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Jhernandez <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: Phuedx <[email protected]>
Gerrit-Reviewer: Robmoen <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to