Merge "Special:Newpages feed now shows first revision instead of latest revision"
[lhc/web/wiklou.git] / includes / jobqueue / jobs / RecentChangesUpdateJob.php
index eb367af..6f349d4 100644 (file)
@@ -16,7 +16,6 @@
  * http://www.gnu.org/copyleft/gpl.html
  *
  * @file
- * @author Aaron Schulz
  * @ingroup JobQueue
  */
 use MediaWiki\MediaWikiServices;
@@ -87,14 +86,21 @@ class RecentChangesUpdateJob extends Job {
                $ticket = $factory->getEmptyTransactionTicket( __METHOD__ );
                $cutoff = $dbw->timestamp( time() - $wgRCMaxAge );
                do {
-                       $rcIds = $dbw->selectFieldValues( 'recentchanges',
-                               'rc_id',
+                       $rcIds = [];
+                       $rows = [];
+                       $res = $dbw->select( 'recentchanges',
+                               RecentChange::selectFields(),
                                [ 'rc_timestamp < ' . $dbw->addQuotes( $cutoff ) ],
                                __METHOD__,
                                [ 'LIMIT' => $wgUpdateRowsPerQuery ]
                        );
+                       foreach ( $res as $row ) {
+                               $rcIds[] = $row->rc_id;
+                               $rows[] = $row;
+                       }
                        if ( $rcIds ) {
                                $dbw->delete( 'recentchanges', [ 'rc_id' => $rcIds ], __METHOD__ );
+                               Hooks::run( 'RecentChangesPurgeRows', [ $rows ] );
                                // There might be more, so try waiting for replica DBs
                                try {
                                        $factory->commitAndWaitForReplication(