@@ -106,29 +106,33 @@ def pages_with_most_revisions( self ):
106106 def autopatrol_eligibles ( self ):
107107 cur = self .db .cursor ()
108108 query = """ SELECT
109- # "editor" consisting of user_name , wrapped in HTML tags linking to the sigma "created" tool
109+ # "editor" consisting of username , wrapped in HTML tags linking to the sigma "created" tool
110110 CONCAT (
111- '[[User:',user_name ,'|',user_name ,']]'
111+ '[[User:',username ,'|',username ,']]'
112112 ) AS editor,
113113 CONCAT (
114114 '[https://tools.wmflabs.org/sigma/created.py?name=',
115- REPLACE(user_name ," ","%20"),
115+ REPLACE(username ," ","%20"),
116116 '&server=enwiki&max=100&startdate=&ns=,,&redirects=none&deleted=undeleted (list)]'
117117 ) AS listlink,
118118 # derived column "created count" returned by this subquery
119119 ( SELECT count(*)
120120 FROM revision_userindex
121121 LEFT JOIN page ON page_id = rev_page
122- WHERE page_namespace = 0 AND rev_parent_id = 0 AND rev_user_text = user_name AND rev_deleted = 0 AND page_is_redirect = 0
122+ WHERE page_namespace = 0 AND rev_parent_id = 0 AND rev_actor = actor AND rev_deleted = 0 AND page_is_redirect = 0
123123 ) AS created_count
124124 FROM
125125 ( # This query returns users who have created pages in the last 30 days and who are not already members of autoreviewed
126- SELECT DISTINCT user_name
126+ SELECT
127+ actor_name AS username,
128+ actor_id AS actor
127129 FROM recentchanges
128- LEFT JOIN user
129- ON rc_user = user_id
130- LEFT JOIN page
131- ON rc_cur_id=page_id
130+ JOIN actor
131+ ON rc_actor=actor_id
132+ JOIN user ON
133+ actor_user=user_id
134+ LEFT JOIN page
135+ ON rc_cur_id=page_id
132136 WHERE
133137 # User created a page within the last thirty days
134138 rc_timestamp > date_format(date_sub(NOW(),INTERVAL 30 DAY),'%Y%m%d%H%i%S') AND
@@ -143,6 +147,7 @@ def autopatrol_eligibles( self ):
143147 # User doesn't already have autoreviewer
144148 NOT EXISTS
145149 ( SELECT 1 FROM user_groups WHERE ug_user=user_id AND ( ug_group='autoreviewer' OR ug_group='sysop' )
150+ GROUP BY actor_id, actor_name
146151 )
147152 ) as InnerQuery
148153 HAVING created_count > 24
@@ -238,18 +243,17 @@ def unused_file_redirects( self ):
238243 def oldest_active ( self ):
239244 cur = self .db .cursor ()
240245 query = """SELECT SQL_SMALL_RESULT
241- CONCAT( '[[User:',user_name,'|',user_name,']]' ) AS user_name
242- , user_registration
243- , user_editcount
246+ CONCAT( '[[User:',user_name,'|',user_name,']]' ) AS user_name,
247+ user_registration,
248+ user_editcount
244249 FROM (
245- SELECT user_name,user_registration,user_editcount
250+ SELECT user_name, user_registration, user_editcount
246251 FROM user
247- WHERE user_name IN (
248- SELECT DISTINCT rc_user_text
249- FROM recentchanges
252+ WHERE user_id IN (
253+ SELECT DISTINCT actor_user
254+ FROM recentchanges, actor
250255 WHERE rc_timestamp > date_format( date_sub(NOW(),INTERVAL 30 DAY),'%Y%m%d%H%i%S' )
251- AND rc_user_text NOT REGEXP '^[0-9]{1,3}\\ .[0-9]'
252- AND rc_user_text NOT REGEXP '\\ :.+\\ :'
256+ AND actor_user > 0
253257 )
254258 AND user_registration IS NOT NULL
255259 ORDER BY user_id
0 commit comments