Addshore has uploaded a new change for review.

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

Change subject: Add showcase items script
......................................................................

Add showcase items script

Change-Id: Iceb845f539d9a47710c786411c1a602bab10e7bd
---
M daily_misc.sh
A graphite/showcase.php
2 files changed, 25 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/analytics/limn-wikidata-data 
refs/changes/53/260553/1

diff --git a/daily_misc.sh b/daily_misc.sh
index 9998edc..3c2b17e 100755
--- a/daily_misc.sh
+++ b/daily_misc.sh
@@ -1,3 +1,4 @@
 #!/bin/bash
 
-~/wikidata-data/graphite/development/phabricator.php
\ No newline at end of file
+~/wikidata-data/graphite/development/phabricator.php
+~/wikidata-data/graphite/showcase.php
\ No newline at end of file
diff --git a/graphite/showcase.php b/graphite/showcase.php
new file mode 100755
index 0000000..ec4476f
--- /dev/null
+++ b/graphite/showcase.php
@@ -0,0 +1,23 @@
+#!/usr/bin/php
+<?php
+
+/**
+ * @author Addshore
+ */
+
+require_once( __DIR__ . '/../src/WikimediaCurl.php' );
+
+$url = 
'https://www.wikidata.org/w/api.php?action=query&prop=revisions&titles=Wikidata:Showcase_items&rvprop=content';
+$json = WikimediaCurl::curlGet( $url );
+
+if( $json === false ) {
+       throw new RuntimeException( "Failed to get showcase items from API" );
+}
+
+$json = json_decode( $json[1], true );
+$pageArray = array_pop( $json['query']['pages'] );
+$pageContent = $pageArray['revisions'][0]['*'];
+
+$showcaseItems = substr_count( $pageContent, '{{ShowcaseItem|' );
+
+exec( "echo \"daily.wikidata.showcaseItems $showcaseItems `date +%s`\" | nc 
-q0 graphite.eqiad.wmnet 2003" );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iceb845f539d9a47710c786411c1a602bab10e7bd
Gerrit-PatchSet: 1
Gerrit-Project: analytics/limn-wikidata-data
Gerrit-Branch: master
Gerrit-Owner: Addshore <addshorew...@gmail.com>

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

Reply via email to