"-resize 100x35!"; some thumbs were off due to differences in rounding and
would be generated smaller than expected.
* (bug 5062) Width sometimes one pixel short when using maximum heights
+* Purge thumbnails and metadata cache for action=purge on an image page
=== Caveats ===
$this->view();
}
+ /**
+ * Handle action=purge
+ */
function purge() {
- global $wgUser, $wgRequest, $wgOut, $wgUseSquid;
-
- if ( $wgUser->isLoggedIn() || $wgRequest->wasPosted() || ! wfRunHooks( 'ArticlePurge', array( &$this ) ) ) {
- // Invalidate the cache
- $this->mTitle->invalidateCache();
-
- if ( $wgUseSquid ) {
- // Commit the transaction before the purge is sent
- $dbw = wfGetDB( DB_MASTER );
- $dbw->immediateCommit();
+ global $wgUser, $wgRequest, $wgOut;
- // Send purge
- $update = SquidUpdate::newSimplePurge( $this->mTitle );
- $update->doUpdate();
+ if ( $wgUser->isLoggedIn() || $wgRequest->wasPosted() ) {
+ if( wfRunHooks( 'ArticlePurge', array( &$this ) ) ) {
+ $this->doPurge();
}
- $this->view();
} else {
$msg = $wgOut->parse( wfMsg( 'confirm_purge' ) );
$action = $this->mTitle->escapeLocalURL( 'action=purge' );
$wgOut->addHTML( $msg );
}
}
+
+ /**
+ * Perform the actions of a page purging
+ */
+ function doPurge() {
+ global $wgUseSquid;
+ // Invalidate the cache
+ $this->mTitle->invalidateCache();
+
+ if ( $wgUseSquid ) {
+ // Commit the transaction before the purge is sent
+ $dbw = wfGetDB( DB_MASTER );
+ $dbw->immediateCommit();
+
+ // Send purge
+ $update = SquidUpdate::newSimplePurge( $this->mTitle );
+ $update->doUpdate();
+ }
+ $this->view();
+ }
/**
* Insert a new empty page record for this article.
$edit = new EditPage( $this );
return $edit->blockedIPpage();
}
+
+ /**
+ * Override handling of action=purge
+ */
+ function doPurge() {
+ $this->img = new Image( $this->mTitle );
+ if( $this->img->exists() ) {
+ wfDebug( "ImagePage::doPurge purging " . $this->img->getName() . "\n" );
+ $linksTo = $this->img->getLinksTo();
+ Title::touchArray( $linksTo );
+ $this->img->purgeCache();
+ } else {
+ wfDebug( "ImagePage::doPurge no image\n" );
+ }
+ parent::doPurge();
+ }
}