Permalink
Browse files

added creator and creation date columns, per request

  • Loading branch information...
MZMcBride
MZMcBride committed Apr 17, 2009
1 parent 46a4e38 commit 2869f8ea94e45a9e914538db9385d42742eceb2a
Showing with 30 additions and 12 deletions.
  1. +30 −12 ownerlessuserpages.py
@@ -16,7 +16,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import datetime
import re
import MySQLdb
import wikitools
import settings
@@ -31,6 +30,8 @@
! No.
! Page
! Length
! Creator
! Creation date
|-
%s
|}
@@ -47,18 +48,31 @@
page_namespace,
ns_name,
page_title,
page_len
FROM page
page_len,
rev_user_text,
rev_timestamp
FROM revision
JOIN (SELECT
page_id,
page_namespace,
page_title,
page_len
FROM page
LEFT JOIN user
ON user_name = REPLACE(page_title, '_', ' ')
WHERE page_namespace IN (2,3)
AND page_is_redirect = 0
AND page_title NOT LIKE "%/%"
AND page_title NOT RLIKE "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
AND ISNULL(user_name)) AS pgtmp
ON pgtmp.page_id = rev_page
JOIN toolserver.namespace
ON page_namespace = ns_id
ON pgtmp.page_namespace = ns_id
AND dbname = 'enwiki_p'
LEFT JOIN user
ON user_name = REPLACE(page_title, '_', ' ')
WHERE page_namespace IN (2,3)
AND page_is_redirect = 0
AND page_title NOT LIKE "%/%"
AND page_title NOT RLIKE "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
AND user_name IS NULL;
AND rev_timestamp = (SELECT
MIN(rev_timestamp)
FROM revision
WHERE rev_page = pgtmp.page_id);
''')
i = 1
@@ -68,10 +82,14 @@
ns_name = u'%s' % unicode(row[1], 'utf-8')
page_title = u'[[%s:%s]]' % (ns_name, unicode(row[2], 'utf-8'))
page_len = row[3]
rev_user_text = u'%s' % unicode(row[4], 'utf-8')
rev_timestamp = row[5]
table_row = u'''| %d
| %s
| %s
|-''' % (i, page_title, page_len)
| %s
| %s
|-''' % (i, page_title, page_len, rev_user_text, rev_timestamp)
output.append(table_row)
i += 1

0 comments on commit 2869f8e

Please sign in to comment.