Revision as of 03:32, 13 January 2014 editMZMcBride (talk | contribs)Extended confirmed users190,597 edits updated page← Previous edit | Latest revision as of 02:51, 3 December 2015 edit undoMZMcBride (talk | contribs)Extended confirmed users190,597 edits updated page | ||
Line 1: | Line 1: | ||
<syntaxhighlight lang="sql"> | |||
mzmcbride@willow:~$ cat scripts/misc/articlecount.py | |||
select distinct page_title from page join categorylinks on cl_from = page_id where cl_to = 'Wikipedia_bureaucrats' and page_namespace in (2,3) and substring_index(replace(page_title, '_', ' '), '/', 1) not in (select user_name from user join user_groups on ug_user = user_id where ug_group = 'bureaucrat'); | |||
<syntaxhighlight lang="python" enclose="div"> | |||
</syntaxhighlight> | |||
#! /usr/bin/env python | |||
<syntaxhighlight lang="sql"> | |||
# Copyright 2010 bjweeks, MZMcBride | |||
select distinct page_title from page join categorylinks on cl_from = page_id where cl_to = 'Wikipedia_administrators' and page_namespace in (2,3) and substring_index(replace(page_title, '_', ' '), '/', 1) not in (select user_name from user join user_groups on ug_user = user_id where ug_group = 'sysop'); | |||
</syntaxhighlight> | |||
# ] | |||
# This program is free software: you can redistribute it and/or modify | |||
# ] | |||
# it under the terms of the GNU General Public License as published by | |||
# ] | |||
# the Free Software Foundation, either version 3 of the License, or | |||
# ] | |||
# (at your option) any later version. | |||
# ] | |||
# ] | |||
# This program is distributed in the hope that it will be useful, | |||
# ] | |||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
# ] | |||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
# ] | |||
# GNU General Public License for more details. | |||
# ] | |||
# ] | |||
# You should have received a copy of the GNU General Public License | |||
# ] | |||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
# ] | |||
# ] | |||
import datetime | |||
# ] | |||
import MySQLdb | |||
# ] | |||
import re | |||
# ] | |||
import wikitools | |||
# ] | |||
import settings | |||
# ] | |||
# ] | |||
report_title = 'Misplaced Pages:List of Wikipedians by article count/Data' | |||
# ] | |||
# ] | |||
report_template = u'''\ | |||
# ] | |||
{| class="wikitable sortable" | |||
# ] | |||
|- style="white-space:nowrap;" | |||
# ] | |||
! No. | |||
# ] | |||
! User | |||
# ] | |||
! Article count | |||
# ] | |||
|- | |||
# ] | |||
%s | |||
# ] | |||
|} | |||
# ] | |||
''' | |||
# ] | |||
# ] | |||
wiki = wikitools.Wiki() | |||
# ] | |||
wiki.login(settings.username, settings.password) | |||
# ] | |||
# ] | |||
conn = MySQLdb.connect(host=settings.host, db=settings.dbname, read_default_file='~/.my.cnf') | |||
# ] | |||
cursor = conn.cursor() | |||
# ] | |||
cursor.execute(''' | |||
# ] | |||
/* articlecount.py SLOW_OK */ | |||
# ] | |||
SELECT | |||
# ] | |||
p2.page_creator, | |||
# ] | |||
COUNT(*) | |||
# ] | |||
FROM enwiki_p.page AS p1 | |||
# ] | |||
JOIN u_mzmcbride_enwiki_page_creators_p.page AS p2 | |||
# ] | |||
ON p1.page_id = p2.page_id | |||
# ] | |||
AND p1.page_namespace = 0 | |||
# ] | |||
AND p1.page_is_redirect = 0 | |||
# ] | |||
GROUP BY p2.page_creator | |||
# ] | |||
ORDER BY COUNT(*) DESC | |||
# ] | |||
LIMIT 3000; | |||
# ] | |||
''') | |||
# ] | |||
# ] | |||
def thous(x): # From http://code.activestate.com/recipes/498181/ | |||
# ] | |||
return re.sub(r'(\d{3})(?=\d)', r'\1,', str(x)) | |||
# ] | |||
# ] | |||
i = 1 | |||
# ] | |||
output = | |||
# ] | |||
for row in cursor.fetchall(): | |||
# ] | |||
page_creator = u'%s' % unicode(row, 'utf-8') | |||
# ] | |||
article_count = thous(str(row)) | |||
# ] | |||
table_row = u'''| %d | |||
# ] | |||
| %s | |||
# ] | |||
| %s | |||
# ] | |||
|-''' % (i, page_creator, article_count) | |||
# ] | |||
output.append(table_row) | |||
# ] | |||
i += 1 | |||
# ] | |||
# ] | |||
report = wikitools.Page(wiki, report_title) | |||
# ] | |||
report_text = report_template % ('\n'.join(output)) | |||
# ] | |||
report_text = report_text.encode('utf-8') | |||
# ] | |||
report.edit(report_text, summary=settings.editsumm, bot=1) | |||
# ] | |||
# ] | |||
cursor.close() | |||
# ] | |||
conn.close() | |||
# ] | |||
</syntaxhighlight> | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] | |||
# ] |
Latest revision as of 02:51, 3 December 2015
select distinct page_title from page join categorylinks on cl_from = page_id where cl_to = 'Wikipedia_bureaucrats' and page_namespace in (2,3) and substring_index(replace(page_title, '_', ' '), '/', 1) not in (select user_name from user join user_groups on ug_user = user_id where ug_group = 'bureaucrat');
select distinct page_title from page join categorylinks on cl_from = page_id where cl_to = 'Wikipedia_administrators' and page_namespace in (2,3) and substring_index(replace(page_title, '_', ' '), '/', 1) not in (select user_name from user join user_groups on ug_user = user_id where ug_group = 'sysop');
- User:Daveydweeb
- User:Slumgum
- User:Tra
- User:Amalas
- User:LAX
- User:Melesse
- User:UberScienceNerd
- User:Vaoverland/Administrator_role
- User:Stephen_Bain
- User:Vaoverland/aboutme
- User:Le_Faux_Nez_de_L'Aquatique
- User:L'Aquatique
- User:Hmwith
- User:Fainites
- User:Magister_Mathematicae
- User:EyeSerene
- User:Climie.ca
- User:JWSchmidt
- User:Jtdirl
- User:Davidgothberg
- User:Sam_Vimes
- User:Tkinias
- User:CJLL_Wright
- User:Jj137
- User:Hu12
- User:Hamster_Sandwich
- User:RyanGerbil10
- User:DO11.10
- User:Mtmelendez
- User:Bryan_Derksen
- User:David_Newton
- User:Pablo-flores
- User:FisherQueen
- User:Mysekurity
- User:Kakofonous
- User:Danger
- User:Henrik
- User:Jredmond
- User:Qaz
- User:Ronline
- User:Dsmdgold
- User:Shanel
- User:Hit_bull,_win_steak
- User:BirgitteSB
- User:Seb26
- User:Kilo-Lima
- User:Leebo
- User:Diberri
- User:Kbthompson
- User:Stevenfruitsmaak
- User:Canderson7
- User:Qwghlm
- User:ClockworkSoul
- User:Wifione/userboxes
- User:Wifione/userbox1
- User:Shell_Kinney/Infobox
- User:Dieter_Simon
- User:Wagino_20100516
- User:Tlranln999
- User:Paxse
- User:Jimsjohnson
- User:Hrengifo
- User:Kristtty
- User:Arjun01
- User:Nad808080
- User:Kristoffer_L
- User:Joseph_the_writer
- User:PatSunter
- User:VancityEditor
- User:Ramon_Serra
- User:MikeLynch
- User:Alliver
- User:Tcvella
- User:SausageParty77934
- User:TranslatorUK
- User:Junirullah/sandbox
- User:Prof.junirullah/sandbox
- User:Dry_Martini
- User:Oskar_Sigvardsson/List_of_administrators
- User:Jamlaw223
- User:Max7310
- User:Sonulangaya
- User:Reigndeleon
- User:Elen_of_the_Roads
- User:Pat.moloney
- User:Rocking_ramlal
- User:Vivekprakash92
- User:Gmaxwell/adminship_map
- User:Stewartadcock
- User:Kaiger
- User:TheElderFox
- User:Ronald7488
- User:Sivaraam07
- User:RaysRates
- User:Xbowery
- User:ChriCom
- User:Tropicalpurplekitty
- User:Sobek121
- User:Mel_Etitis/sandbox
- User:Loreanar
- User:Phiraphon
- User:Jiale8331
- User:Hyipworld
- User:Betsy6286
- User:Admiral_Alvin
- User:ERcheck
- User:Billyoweston
- User:Bagumbe