X-Git-Url: https://git.cyclocoop.org/%28%28?a=blobdiff_plain;f=includes%2Fjobqueue%2Fjobs%2FRecentChangesUpdateJob.php;h=77daca7676e43a3cedfd7c57835273c3da41b8b4;hb=27c61fb1e94da9114314468fd00bcf129ec064b6;hp=a92ae96074efb0d1c254bc13cbfde782f5f894d4;hpb=9b83841b9b44457b498770b847ac72f53031c34d;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/jobqueue/jobs/RecentChangesUpdateJob.php b/includes/jobqueue/jobs/RecentChangesUpdateJob.php index a92ae96074..77daca7676 100644 --- a/includes/jobqueue/jobs/RecentChangesUpdateJob.php +++ b/includes/jobqueue/jobs/RecentChangesUpdateJob.php @@ -76,10 +76,9 @@ class RecentChangesUpdateJob extends Job { $lockKey = wfWikiID() . ':recentchanges-prune'; $dbw = wfGetDB( DB_MASTER ); - if ( !$dbw->lockIsFree( $lockKey, __METHOD__ ) - || !$dbw->lock( $lockKey, __METHOD__, 1 ) - ) { - return; // already in progress + if ( !$dbw->lock( $lockKey, __METHOD__, 0 ) ) { + // already in progress + return; } $factory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory(); @@ -138,7 +137,7 @@ class RecentChangesUpdateJob extends Job { $dbw->setSessionOptions( [ 'connTimeout' => 900 ] ); $lockKey = wfWikiID() . '-activeusers'; - if ( !$dbw->lockIsFree( $lockKey, __METHOD__ ) || !$dbw->lock( $lockKey, __METHOD__, 1 ) ) { + if ( !$dbw->lock( $lockKey, __METHOD__, 0 ) ) { // Exclusive update (avoids duplicate entries)… it's usually fine to just drop out here, // if the Job is already running. return; @@ -159,11 +158,15 @@ class RecentChangesUpdateJob extends Job { $eTimestamp = min( $sTimestamp + $window, $nowUnix ); // Get all the users active since the last update + $actorQuery = ActorMigration::newMigration()->getJoin( 'rc_user' ); $res = $dbw->select( - [ 'recentchanges' ], - [ 'rc_user_text', 'lastedittime' => 'MAX(rc_timestamp)' ], + [ 'recentchanges' ] + $actorQuery['tables'], [ - 'rc_user > 0', // actual accounts + 'rc_user_text' => $actorQuery['fields']['rc_user_text'], + 'lastedittime' => 'MAX(rc_timestamp)' + ], + [ + $actorQuery['fields']['rc_user'] . ' > 0', // actual accounts 'rc_type != ' . $dbw->addQuotes( RC_EXTERNAL ), // no wikidata 'rc_log_type IS NULL OR rc_log_type != ' . $dbw->addQuotes( 'newusers' ), 'rc_timestamp >= ' . $dbw->addQuotes( $dbw->timestamp( $sTimestamp ) ), @@ -173,7 +176,8 @@ class RecentChangesUpdateJob extends Job { [ 'GROUP BY' => [ 'rc_user_text' ], 'ORDER BY' => 'NULL' // avoid filesort - ] + ], + $actorQuery['joins'] ); $names = []; foreach ( $res as $row ) {