use MediaWiki\Logger\LoggerFactory;
use Wikimedia\Rdbms\Database;
use Wikimedia\Rdbms\IDatabase;
+use Wikimedia\Rdbms\IResultWrapper;
use MediaWiki\MediaWikiServices;
/**
/** @var int Number of line to return by nextHistoryLine() (constructor) */
private $historyLine;
- /** @var int Result of the query for the file's history (nextHistoryLine) */
+ /** @var IResultWrapper|null Result of the query for the file's history (nextHistoryLine) */
private $historyRes;
/** @var string Major MIME type */
$this->purgeThumbnails( $options );
// Purge CDN cache for this file
- DeferredUpdates::addUpdate(
- new CdnCacheUpdate( [ $this->getUrl() ] ),
- DeferredUpdates::PRESEND
- );
+ MediaWikiServices::getInstance()->getHtmlCacheUpdater()->purge( $this->getUrl() );
}
/**
foreach ( $files as $file ) {
$urls[] = $this->getArchiveThumbUrl( $archiveName, $file );
}
- DeferredUpdates::addUpdate( new CdnCacheUpdate( $urls ), DeferredUpdates::PRESEND );
+ MediaWikiServices::getInstance()->getHtmlCacheUpdater()->purge( $urls );
}
/**
$this->purgeThumbList( $dir, $files );
// Purge the CDN
- DeferredUpdates::addUpdate( new CdnCacheUpdate( $urls ), DeferredUpdates::PRESEND );
+ MediaWikiServices::getInstance()->getHtmlCacheUpdater()->purge( $urls );
}
/**
}
} else {
# Existing file page: invalidate description page cache
- $wikiPage->getTitle()->invalidateCache();
- $wikiPage->getTitle()->purgeSquid();
+ $title = $wikiPage->getTitle();
+ $title->invalidateCache();
+ MediaWikiServices::getInstance()->getHtmlCacheUpdater()->purge( $title );
# Allow the new file version to be patrolled from the page footer
Article::purgePatrolFooterCache( $descId );
}
# Delete old thumbnails
$this->purgeThumbnails();
# Remove the old file from the CDN cache
- DeferredUpdates::addUpdate(
- new CdnCacheUpdate( [ $this->getUrl() ] ),
- DeferredUpdates::PRESEND
- );
+ MediaWikiServices::getInstance()
+ ->getHtmlCacheUpdater()->purge( $this->getUrl() );
} else {
# Update backlink pages pointing to this title if created
LinksUpdate::queueRecursiveJobsForTable(
}
# Invalidate cache for all pages using this file
- DeferredUpdates::addUpdate(
- new HTMLCacheUpdate( $this->getTitle(), 'imagelinks', 'file-upload' )
+ $job = HTMLCacheUpdateJob::newForBacklinks(
+ $this->getTitle(),
+ 'imagelinks',
+ [ 'causeAction' => 'file-upload', 'causeAgent' => $user->getName() ]
);
+ JobQueueGroup::singleton()->lazyPush( $job );
return Status::newGood();
}
foreach ( $archiveNames as $archiveName ) {
$purgeUrls[] = $this->getArchiveUrl( $archiveName );
}
- DeferredUpdates::addUpdate( new CdnCacheUpdate( $purgeUrls ), DeferredUpdates::PRESEND );
+ MediaWikiServices::getInstance()->getHtmlCacheUpdater()->purge( $purgeUrls );
return $status;
}
$this->purgeDescription();
}
- DeferredUpdates::addUpdate(
- new CdnCacheUpdate( [ $this->getArchiveUrl( $archiveName ) ] ),
- DeferredUpdates::PRESEND
- );
+ $url = $this->getArchiveUrl( $archiveName );
+ MediaWikiServices::getInstance()->getHtmlCacheUpdater()->purge( $url );
return $status;
}