Page MenuHomePhabricator
Paste P7986

Code for T211881
ActivePublic

Authored by akosiaris on Jan 15 2019, 9:43 AM.
# Ran on a labs VM
#!/bin/bash
mysql --defaults-file=$HOME/replica.my.cnf -h metawiki.analytics.db.svc.eqiad.wmflabs metawiki_p -NBe 'select site_global_key from sites order by site_global_key' > all_wikis
# This is going to error out on some 40+ wikis where my account did not have access
for i in `cat all_wikis`
do
mysql --defaults-file=$HOME/replica.my.cnf -h ${i}.analytics.db.svc.eqiad.wmflabs ${i}_p -NBe 'SELECT count(*) from page JOIN page_props on page.page_id=page_props.pp_page WHERE pp_propname="graph_specs"' > data/$i
done
# Get the top 50 (arbitrarily chosen number) projects and their number of graphs. Format it nicely for a phabricator table, leaving only the head to be added manually
for i in data/* ; do echo -n "$i "; cat $i ; done | sort -rn -k2 | head -50 | column -t | sed -e 's/^/|/' -e 's/ / |/' -e 's/$/|/'