$newid = wfInsertId();
$this->mTitle->resetArticleID( $newid );
- Article::onArticleCreate( $this->mTitle, $text );
+ Article::onArticleCreate( $this->mTitle );
RecentChange::notifyNew( $now, $this->mTitle, $isminor, $wgUser, $summary );
if ($watchthis) {
$wgOut = new OutputPage();
$wgOut->addWikiText( $text );
- # Every 1000th edit, prune the recent changes table.
- wfSeedRandom();
- if ( 0 == mt_rand( 0, 999 ) ) {
- $cutoff = wfUnix2Timestamp( time() - ( 7 * 86400 ) );
- $sql = "DELETE FROM recentchanges WHERE rc_timestamp < '{$cutoff}'";
- wfQuery( $sql, DB_WRITE );
- }
-
+ $this->editUpdates( $text );
if( $wgMwRedir->matchStart( $text ) )
$r = "redirect=no";
else
}
}
+ # Do standard deferred updates after page edit.
+ # Every 1000th edit, prune the recent changes table.
+
+ /* private */ function editUpdates( $text )
+ {
+ global $wgDeferredUpdateList, $wgDBname, $wgMemc;
+ global $wgMessageCache;
+
+ wfSeedRandom();
+ if ( 0 == mt_rand( 0, 999 ) ) {
+ $cutoff = wfUnix2Timestamp( time() - ( 7 * 86400 ) );
+ $sql = "DELETE FROM recentchanges WHERE rc_timestamp < '{$cutoff}'";
+ wfQuery( $sql, DB_WRITE );
+ }
+ $id = $this->getID();
+ $title = $this->mTitle->getPrefixedDBkey();
+ $shortTitle = $this->mTitle->getDBkey();
+
+ $adj = $this->mCountAdjustment;
+
+ if ( 0 != $id ) {
+ $u = new LinksUpdate( $id, $title );
+ array_push( $wgDeferredUpdateList, $u );
+ $u = new SiteStatsUpdate( 0, 1, $adj );
+ array_push( $wgDeferredUpdateList, $u );
+ $u = new SearchUpdate( $id, $title, $text );
+ array_push( $wgDeferredUpdateList, $u );
+
+ $u = new UserTalkUpdate( 1, $this->mTitle->getNamespace(), $shortTitle );
+ array_push( $wgDeferredUpdateList, $u );
+ if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
+ $wgMessageCache->replace( $shortTitle, $text );
+ }
+ }
+ }
/* private */ function setOldSubtitle()
{
#
# This is a good place to put code to clear caches, for instance.
- /* static */ function onArticleCreate($title_obj,$text=''){
- global $wgEnablePersistentLC, $wgEnableParserCache, $wgUseSquid;
- global $wgDeferredUpdateList, $wgDBname, $wgMemc;
- global $wgMessageCache, $wgInternalServer;
- # Do standard deferred updates after page edit.
- $id = $title_obj->getArticleID();
- $title = $title_obj->getPrefixedDBkey();
- $shortTitle = $title_obj->getDBkey();
-
- $adj = $this->mCountAdjustment;
-
- if ( 0 != $id ) {
- $u = new LinksUpdate( $id, $title );
- array_push( $wgDeferredUpdateList, $u );
- $u = new SiteStatsUpdate( 0, 1, $adj );
- array_push( $wgDeferredUpdateList, $u );
- $u = new SearchUpdate( $id, $title, $text );
- array_push( $wgDeferredUpdateList, $u );
-
- $u = new UserTalkUpdate( 1, $title_obj->getNamespace(), $shortTitle );
- array_push( $wgDeferredUpdateList, $u );
-
- if ( $title_obj->getNamespace() == NS_MEDIAWIKI ) {
- $wgMessageCache->replace( $shortTitle, $text );
- }
- }
+ /* static */ function onArticleCreate($title_obj){
+ global $wgEnablePersistentLC, $wgEnableParserCache;
if ( $wgEnablePersistentLC ) {
- LinkCache::linksccClearBrokenLinksTo( $title );
+ LinkCache::linksccClearBrokenLinksTo( $title_obj->getPrefixedDBkey() );
}
if ( $wgEnableParserCache ) {
- OutputPage::parsercacheClearBrokenLinksTo( $title );
- }
- if ( $wgUseSquid ) {
- $urlArr = Array(
- $wgInternalServer.wfLocalUrl( $title_obj->getPrefixedURL())
- );
- wfPurgeSquidServers($urlArr);
- /* this needs to be done after LinksUpdate */
- $u = new SquidUpdate($title_obj);
- array_push( $wgDeferredUpdateList, $u );
+ OutputPage::parsercacheClearBrokenLinksTo( $title_obj->getPrefixedDBkey() );
}
}
- /* static */ function onArticleDelete($title_obj,$text=''){
- global $wgEnablePersistentLC, $wgEnableParserCache, $wgUseSquid, $wgDeferredUpdateList;
- global $wgDeferredUpdateList, $wgDBname, $wgMemc;
- global $wgMessageCache, $wgInternalServer;
-
- $id = $title_obj->getArticleID();
- $title = $title_obj->getPrefixedDBkey();
- $shortTitle = $title_obj->getDBkey();
-
+ /* static */ function onArticleDelete($title_obj){
+ global $wgEnablePersistentLC, $wgEnableParserCache;
if ( $wgEnablePersistentLC ) {
- LinkCache::linksccClearLinksTo( $id );
+ LinkCache::linksccClearLinksTo( $title_obj->getArticleID() );
}
if ( $wgEnableParserCache ) {
- OutputPage::parsercacheClearLinksTo( $id );
- }
- if ( $wgUseSquid ) {
- $urlArr = Array(
- $wgInternalServer.wfLocalUrl( $title_obj->getPrefixedURL())
- );
- wfPurgeSquidServers($urlArr);
-
- /* prepare the list of urls to purge */
- $sql = "SELECT l_from FROM links WHERE l_to={$id}" ;
- $res = wfQuery ( $sql, DB_READ ) ;
- while ( $BL = wfFetchObject ( $res ) )
- {
- $t = Title::newFromDBkey( $BL->l_from) ;
- $blurlArr[] = $wgInternalServer.wfLocalUrl( $t->getPrefixedURL() );
- }
- wfFreeResult ( $res ) ;
- $u = new SquidUpdate( $title_obj, $blurlArr );
- array_push( $wgDeferredUpdateList, $u );
-
+ OutputPage::parsercacheClearLinksTo( $title_obj->getArticleID() );
}
}
- /* static */ function onArticleEdit($title_obj,$text=''){
- global $wgEnablePersistentLC, $wgEnableParserCache, $wgUseSquid;
- global $wgDeferredUpdateList, $wgDBname, $wgMemc;
- global $wgMessageCache, $wgInternalServer;
-
- $id = $title_obj->getArticleID();
- $title = $title_obj->getPrefixedDBkey();
- $shortTitle = $title_obj->getDBkey();
-
- $adj = $this->mCountAdjustment;
-
- if ( 0 != $id ) {
- $u = new LinksUpdate( $id, $title );
- array_push( $wgDeferredUpdateList, $u );
- $u = new SiteStatsUpdate( 0, 1, $adj );
- array_push( $wgDeferredUpdateList, $u );
- $u = new SearchUpdate( $id, $title, $text );
- array_push( $wgDeferredUpdateList, $u );
-
- $u = new UserTalkUpdate( 1, $title_obj->getNamespace(), $shortTitle );
- array_push( $wgDeferredUpdateList, $u );
-
- if ( $title_obj->getNamespace() == NS_MEDIAWIKI ) {
- $wgMessageCache->replace( $shortTitle, $text );
- }
- }
+ /* static */ function onArticleEdit($title_obj){
+ global $wgEnablePersistentLC, $wgEnableParserCache;
if ( $wgEnablePersistentLC ) {
- LinkCache::linksccClearPage( $id );
+ LinkCache::linksccClearPage( $title_obj->getArticleID() );
}
if ( $wgEnableParserCache ) {
- OutputPage::parsercacheClearPage( $id );
- }
- if ( $wgUseSquid ) {
- $urlArr = Array(
- $wgInternalServer.wfLocalUrl( $title_obj->getPrefixedURL()),
- );
- wfPurgeSquidServers($urlArr);
+ OutputPage::parsercacheClearPage( $title_obj->getArticleID() );
}
}
}