RecentChange::notifyEdit( $now, $this->mTitle, $isminor, $wgUser, $summary,
$lastRevision, $this->getTimestamp(), $bot, '', $oldsize, $newsize,
$revisionId );
- Article::onArticleEdit( $this->mTitle );
$dbw->commit();
+
+ // Update caches outside the main transaction
+ Article::onArticleEdit( $this->mTitle );
}
}
$this->editUpdates( $text, $summary, $minor, $now );
- $urls = array();
- # Template namespace
- # Purge all articles linking here
- if ( $this->mTitle->getNamespace() == NS_TEMPLATE) {
- $titles = $this->mTitle->getLinksTo();
- Title::touchArray( $titles );
- if ( $wgUseSquid ) {
- foreach ( $titles as $title ) {
- $urls[] = $title->getInternalURL();
- }
- }
- }
-
- # Squid updates
- if ( $wgUseSquid ) {
- $urls = array_merge( $urls, $this->mTitle->getSquidURLs() );
- $u = new SquidUpdate( $urls );
- array_push( $wgPostCommitUpdateList, $u );
- }
-
- # File cache
- if ( $wgUseFileCache ) {
- $cm = new CacheManager($this->mTitle);
- @unlink($cm->fileCacheName());
- }
-
$this->showArticle( $text, wfMsg( 'updated' ), $sectionanchor, $isminor, $now, $summary, $lastRevision, $revisionId );
}
wfRunHooks( 'ArticleSaveComplete',
else
$r = '';
$wgOut->redirect( $this->mTitle->getFullURL( $r ).$sectionanchor );
-
- if ( $wgUseEnotif ) {
- # this would be better as an extension hook
- include_once( "UserMailer.php" );
- $enotif = new EmailNotification ();
- $enotif->notifyOnPageChange( $this->mTitle, $now, $summary, $me2, $oldid );
- }
+
wfProfileOut( $fname );
}
}
}
- function onArticleEdit($title_obj) {
- // This would be an appropriate place to purge caches.
- // Why's this not in here now?
+ /**
+ * Purge caches on page update etc
+ */
+ function onArticleEdit( $title ) {
+ global $wgUseSquid, $wgPostCommitUpdateList, $wgUseFileCache;
+
+ $urls = array();
+
+ // Template namespace? Purge all articles linking here.
+ // FIXME: When a templatelinks table arrives, use it for all includes.
+ if ( $title->getNamespace() == NS_TEMPLATE) {
+ $titles = $title->getLinksTo();
+ Title::touchArray( $titles );
+ if ( $wgUseSquid ) {
+ foreach ( $titles as $link ) {
+ $urls[] = $link->getInternalURL();
+ }
+ }
+ }
+
+ # Squid updates
+ if ( $wgUseSquid ) {
+ $urls = array_merge( $urls, $this->mTitle->getSquidURLs() );
+ $u = new SquidUpdate( $urls );
+ array_push( $wgPostCommitUpdateList, $u );
+ }
+
+ # File cache
+ if ( $wgUseFileCache ) {
+ $cm = new CacheManager( $title );
+ @unlink( $cm->fileCacheName() );
+ }
}
/**#@-*/
socket_close( $conn );
}
}
+
+ // E-mail notifications
+ global $wgUseEnotif;
+ if( $wgUseEnotif ) {
+ # this would be better as an extension hook
+ include_once( "UserMailer.php" );
+ $enotif = new EmailNotification();
+ $title = Title::makeTitle( $this->mAttribs['rc_namespace'], $this->mAttribs['rc_title'] );
+ $enotif->notifyOnPageChange( $title,
+ $this->mAttribs['rc_timestamp'],
+ $this->mAttribs['rc_comment'],
+ $this->mAttribs['rc_minor'],
+ $this->mAttribs['rc_last_oldid'] );
+ }
+
}
# Marks a certain row as patrolled
function addWatch() {
$fname = 'WatchedItem::addWatch';
wfProfileIn( $fname );
- # REPLACE instead of INSERT because occasionally someone
- # accidentally reloads a watch-add operation.
+
+ // Use INSERT IGNORE to avoid overwriting the notification timestamp
+ // if there's already an entry for this page
$dbw =& wfGetDB( DB_MASTER );
- $dbw->replace( 'watchlist', array(array('wl_user', 'wl_namespace', 'wl_title', 'wl_notificationtimestamp')),
+ $dbw->insert( 'watchlist',
array(
'wl_user' => $this->id,
'wl_namespace' => ($this->ns & ~1),
'wl_title' => $this->ti,
'wl_notificationtimestamp' => NULL
- ), $fname );
+ ), $fname, 'IGNORE' );
- # the following code compensates the new behaviour, introduced by the enotif patch,
- # that every single watched page needs now to be listed in watchlist
- # namespace:page and namespace_talk:page need separate entries: create them
- $dbw->replace( 'watchlist', array(array('wl_user', 'wl_namespace', 'wl_title', 'wl_notificationtimestamp')),
+ // Every single watched page needs now to be listed in watchlist;
+ // namespace:page and namespace_talk:page need separate entries:
+ $dbw->insert( 'watchlist',
array(
'wl_user' => $this->id,
'wl_namespace' => ($this->ns | 1 ),
'wl_title' => $this->ti,
'wl_notificationtimestamp' => NULL
- ), $fname );
+ ), $fname, 'IGNORE' );
global $wgMemc;
$wgMemc->set( $this->watchkey(), 1 );