46if ( $dbkeys === [] ) {
54staticfunction () use ( $dbw, $namespace, $dbkeys, $fname ) {
56 $dbProvider = $services->getConnectionProvider();
57// Determine which pages need to be updated. 58// This is necessary to prevent the job queue from smashing the DB with 59// large numbers of concurrent invalidations of the same page. 64 ->where( [
'page_namespace' => $namespace ] )
65 ->andWhere( [
'page_title' => $dbkeys ] )
66 ->andWhere( $dbw->
expr(
'page_touched',
'<', $now ) )
67 ->caller( $fname )->fetchFieldValues();
75 $ticket = $dbProvider->getEmptyTransactionTicket( $fname );
76 $idBatches = array_chunk( $ids, $batchSize );
77foreach ( $idBatches as $idBatch ) {
80 ->set( [
'page_touched' => $now ] )
81 ->where( [
'page_id' => $idBatch ] )
82 ->andWhere( $dbw->
expr(
'page_touched',
'<', $now ) )
// handle races 83 ->caller( $fname )->execute();
84if ( count( $idBatches ) > 1 ) {
85 $dbProvider->commitAndWaitForReplication( $fname, $ticket );
94class_alias( PurgeJobUtils::class,
'PurgeJobUtils' );
Deferrable Update for closure/callback updates that should use auto-commit mode.
Defer callable updates to run later in the PHP process.
Helper for a Job that writes data derived from page content to the database.
static invalidatePages(IDatabase $dbw, $namespace, array $dbkeys)
Invalidate the cache of a list of pages from a single namespace.
A class containing constants representing the names of configuration variables.
const UpdateRowsPerQuery
Name constant for the UpdateRowsPerQuery setting, for use with Config::get()
Service locator for MediaWiki core services.
static getInstance()
Returns the global default instance of the top level service locator.
Interface to a relational database.
newUpdateQueryBuilder()
Get an UpdateQueryBuilder bound to this connection.
newSelectQueryBuilder()
Create an empty SelectQueryBuilder which can be used to run queries against this connection.
expr(string $field, string $op, $value)
See Expression::__construct()
timestamp( $ts=0)
Convert a timestamp in one of the formats accepted by ConvertibleTimestamp to the format used for ins...