$this->purgeThumbnails( $options );
// Purge squid cache for this file
- SquidUpdate::purge( array( $this->getURL() ) );
+ DeferredUpdates::addUpdate(
+ new SquidUpdate( array( $this->getUrl() ) ),
+ DeferredUpdates::PRESEND
+ );
}
/**
* @param string $archiveName Name of the archived file
*/
function purgeOldThumbnails( $archiveName ) {
- global $wgUseSquid;
-
// Get a list of old thumbnails and URLs
$files = $this->getThumbnails( $archiveName );
$this->purgeThumbList( $dir, $files );
// Purge the squid
- if ( $wgUseSquid ) {
- $urls = array();
- foreach ( $files as $file ) {
- $urls[] = $this->getArchiveThumbUrl( $archiveName, $file );
- }
- SquidUpdate::purge( $urls );
+ $urls = array();
+ foreach ( $files as $file ) {
+ $urls[] = $this->getArchiveThumbUrl( $archiveName, $file );
}
-
+ DeferredUpdates::addUpdate( new SquidUpdate( $urls ), DeferredUpdates::PRESEND );
}
/**
* @param array $options
*/
public function purgeThumbnails( $options = array() ) {
- global $wgUseSquid;
-
// Delete thumbnails
$files = $this->getThumbnails();
// Always purge all files from squid regardless of handler filters
$urls = array();
- if ( $wgUseSquid ) {
- foreach ( $files as $file ) {
- $urls[] = $this->getThumbUrl( $file );
- }
- array_shift( $urls ); // don't purge directory
+ foreach ( $files as $file ) {
+ $urls[] = $this->getThumbUrl( $file );
}
+ array_shift( $urls ); // don't purge directory
// Give media handler a chance to filter the file purge list
if ( !empty( $options['forThumbRefresh'] ) ) {
$this->purgeThumbList( $dir, $files );
// Purge the squid
- if ( $wgUseSquid ) {
- SquidUpdate::purge( $urls );
- }
-
+ DeferredUpdates::addUpdate( new SquidUpdate( $urls ), DeferredUpdates::PRESEND );
}
/**
# Delete old thumbnails
$that->purgeThumbnails();
# Remove the old file from the squid cache
- SquidUpdate::purge( array( $that->getURL() ) );
+ DeferredUpdates::addUpdate(
+ new SquidUpdate( array( $that->getUrl() ) ),
+ DeferredUpdates::PRESEND
+ );
} else {
# Update backlink pages pointing to this title if created
LinksUpdate::queueRecursiveJobsForTable( $that->getTitle(), 'imagelinks' );
$that = $this;
$this->getRepo()->getMasterDB()->onTransactionIdle(
function () use ( $that, $archiveNames ) {
- global $wgUseSquid;
-
$that->purgeEverything();
foreach ( $archiveNames as $archiveName ) {
$that->purgeOldThumbnails( $archiveName );
}
-
- if ( $wgUseSquid ) {
- // Purge the squid
- $purgeUrls = array();
- foreach ( $archiveNames as $archiveName ) {
- $purgeUrls[] = $that->getArchiveUrl( $archiveName );
- }
- SquidUpdate::purge( $purgeUrls );
- }
}
);
+ // Purge the squid
+ $purgeUrls = array();
+ foreach ( $archiveNames as $archiveName ) {
+ $purgeUrls[] = $this->getArchiveUrl( $archiveName );
+ }
+ DeferredUpdates::addUpdate( new SquidUpdate( $purgeUrls ), DeferredUpdates::PRESEND );
+
return $status;
}
* @return FileRepoStatus
*/
function deleteOld( $archiveName, $reason, $suppress = false, $user = null ) {
- global $wgUseSquid;
if ( $this->getRepo()->getReadOnlyReason() !== false ) {
return $this->readOnlyFatalStatus();
}
$this->purgeDescription();
}
- if ( $wgUseSquid ) {
- // Purge the squid
- SquidUpdate::purge( array( $this->getArchiveUrl( $archiveName ) ) );
- }
+ DeferredUpdates::addUpdate(
+ new SquidUpdate( array( $this->getArchiveUrl( $archiveName ) ) ),
+ DeferredUpdates::PRESEND
+ );
return $status;
}
$file = wfLocalFile( $this->title );
$file->purgeCache();
$file->purgeDescription();
+
+ // Purge full images from cache
$purgeUrls = array();
foreach ( $this->ids as $timestamp ) {
$archiveName = $timestamp . '!' . $this->title->getDBkey();
$file->purgeOldThumbnails( $archiveName );
$purgeUrls[] = $file->getArchiveUrl( $archiveName );
}
- if ( $this->getConfig()->get( 'UseSquid' ) ) {
- // purge full images from cache
- SquidUpdate::purge( $purgeUrls );
- }
+ DeferredUpdates::addUpdate(
+ new SquidUpdate( $purgeUrls ),
+ DeferredUpdates::PRESEND
+ );
return Status::newGood();
}