Page MenuHomePhabricator
Paste P7986

Code for T211881

Authored by akosiaris on Jan 15 2019, 9:43 AM.
# Ran on a labs VM
mysql --defaults-file=$HOME/ -h 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`
mysql --defaults-file=$HOME/ -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
# 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/$/|/'