}
/**
- * Refresh metadata in memcached, but don't touch thumbnails or squid
+ * Refresh metadata in memcached, but don't touch thumbnails or CDN
*/
function purgeMetadataCache() {
$this->invalidateCache();
}
/**
- * Delete all previously generated thumbnails, refresh metadata in memcached and purge the squid.
+ * Delete all previously generated thumbnails, refresh metadata in memcached and purge the CDN.
*
* @param array $options An array potentially with the key forThumbRefresh.
*
// Delete thumbnails
$this->purgeThumbnails( $options );
- // Purge squid cache for this file
+ // Purge CDN cache for this file
DeferredUpdates::addUpdate(
- new SquidUpdate( array( $this->getUrl() ) ),
+ new CdnCacheUpdate( array( $this->getUrl() ) ),
DeferredUpdates::PRESEND
);
}
$dir = array_shift( $files );
$this->purgeThumbList( $dir, $files );
- // Purge the squid
+ // Purge the CDN
$urls = array();
foreach ( $files as $file ) {
$urls[] = $this->getArchiveThumbUrl( $archiveName, $file );
}
- DeferredUpdates::addUpdate( new SquidUpdate( $urls ), DeferredUpdates::PRESEND );
+ DeferredUpdates::addUpdate( new CdnCacheUpdate( $urls ), DeferredUpdates::PRESEND );
}
/**
public function purgeThumbnails( $options = array() ) {
// Delete thumbnails
$files = $this->getThumbnails();
- // Always purge all files from squid regardless of handler filters
+ // Always purge all files from CDN regardless of handler filters
$urls = array();
foreach ( $files as $file ) {
$urls[] = $this->getThumbUrl( $file );
$dir = array_shift( $files );
$this->purgeThumbList( $dir, $files );
- // Purge the squid
- DeferredUpdates::addUpdate( new SquidUpdate( $urls ), DeferredUpdates::PRESEND );
+ // Purge the CDN
+ DeferredUpdates::addUpdate( new CdnCacheUpdate( $urls ), DeferredUpdates::PRESEND );
}
/**
}
$descTitle = $this->getTitle();
+ $descId = $descTitle->getArticleID();
$wikiPage = new WikiFilePage( $descTitle );
$wikiPage->setFile( $this );
$nullRevision = Revision::newNullRevision(
$dbw,
- $descTitle->getArticleID(),
+ $descId,
$editSummary,
false,
$user
array( $wikiPage, $nullRevision, $nullRevision->getParentId(), $user )
);
$wikiPage->updateRevisionOn( $dbw, $nullRevision );
+ // Associate null revision id
+ $logEntry->setAssociatedRevId( $nullRevision->getId() );
}
$newPageContent = null;
# b) They won't cause rollback of the log publish/update above
$that = $this;
$dbw->onTransactionIdle( function () use (
- $that, $reupload, $wikiPage, $newPageContent, $comment, $user, $logEntry, $logId
+ $that, $reupload, $wikiPage, $newPageContent, $comment, $user, $logEntry, $logId, $descId
) {
# Update memcache after the commit
$that->invalidateCache();
+ $updateLogPage = false;
if ( $newPageContent ) {
# New file page; create the description page.
# There's already a log entry, so don't make a second RC entry
- # Squid and file cache for the description page are purged by doEditContent.
+ # CDN and file cache for the description page are purged by doEditContent.
$status = $wikiPage->doEditContent(
$newPageContent,
$comment,
$user
);
+ if ( isset( $status->value['revision'] ) ) {
+ // Associate new page revision id
+ $logEntry->setAssociatedRevId( $status->value['revision']->getId() );
+ }
// This relies on the resetArticleID() call in WikiPage::insertOn(),
// which is triggered on $descTitle by doEditContent() above.
if ( isset( $status->value['revision'] ) ) {
/** @var $rev Revision */
$rev = $status->value['revision'];
- $that->getRepo()->getMasterDB()->update(
- 'logging',
- array( 'log_page' => $rev->getPage() ),
- array( 'log_id' => $logId ),
- __METHOD__
- );
+ $updateLogPage = $rev->getPage();
}
} else {
# Existing file page: invalidate description page cache
$wikiPage->getTitle()->invalidateCache();
$wikiPage->getTitle()->purgeSquid();
+ # Allow the new file version to be patrolled from the page footer
+ Article::purgePatrolFooterCache( $descId );
}
- # Now that the page exists, make an RC entry.
+ # Update associated rev id. This should be done by $logEntry->insert() earlier,
+ # but setAssociatedRevId() wasn't called at that point yet...
+ $logParams = $logEntry->getParameters();
+ $logParams['associated_rev_id'] = $logEntry->getAssociatedRevId();
+ $update = array( 'log_params' => LogEntryBase::makeParamBlob( $logParams ) );
+ if ( $updateLogPage ) {
+ # Also log page, in case where we just created it above
+ $update['log_page'] = $updateLogPage;
+ }
+ $that->getRepo()->getMasterDB()->update(
+ 'logging',
+ $update,
+ array( 'log_id' => $logId ),
+ __METHOD__
+ );
+ $that->getRepo()->getMasterDB()->insert(
+ 'log_search',
+ array(
+ 'ls_field' => 'associated_rev_id',
+ 'ls_value' => $logEntry->getAssociatedRevId(),
+ 'ls_log_id' => $logId,
+ ),
+ __METHOD__
+ );
+
+ # Now that the log entry is up-to-date, make an RC entry.
$logEntry->publish( $logId );
# Run hook for other updates (typically more cache purging)
Hooks::run( 'FileUpload', array( $that, $reupload, !$newPageContent ) );
if ( $reupload ) {
# Delete old thumbnails
$that->purgeThumbnails();
- # Remove the old file from the squid cache
+ # Remove the old file from the CDN cache
DeferredUpdates::addUpdate(
- new SquidUpdate( array( $that->getUrl() ) ),
+ new CdnCacheUpdate( array( $that->getUrl() ) ),
DeferredUpdates::PRESEND
);
} else {
}
);
- // Purge the squid
+ // Purge the CDN
$purgeUrls = array();
foreach ( $archiveNames as $archiveName ) {
$purgeUrls[] = $this->getArchiveUrl( $archiveName );
}
- DeferredUpdates::addUpdate( new SquidUpdate( $purgeUrls ), DeferredUpdates::PRESEND );
+ DeferredUpdates::addUpdate( new CdnCacheUpdate( $purgeUrls ), DeferredUpdates::PRESEND );
return $status;
}
}
DeferredUpdates::addUpdate(
- new SquidUpdate( array( $this->getArchiveUrl( $archiveName ) ) ),
+ new CdnCacheUpdate( array( $this->getArchiveUrl( $archiveName ) ) ),
DeferredUpdates::PRESEND
);