*/
function showArticle( $text, $subtitle , $sectionanchor = '', $me2, $now, $summary, $oldid ) {
global $wgUseDumbLinkUpdate, $wgAntiLockFlags, $wgOut, $wgUser, $wgLinkCache, $wgEnotif;
+ global $wgUseEnotif;
$wgLinkCache = new LinkCache();
$r = '';
$wgOut->redirect( $this->mTitle->getFullURL( $r ).$sectionanchor );
- # this call would better fit into RecentChange::notifyEdit and RecentChange::notifyNew .
- # this will be improved later (to-do)
-
- include_once( "UserMailer.php" );
- $wgEnotif = new EmailNotification ();
- $wgEnotif->notifyOnPageChange( $this->mTitle, $now, $summary, $me2, $oldid );
+ if ( $wgUseEnotif ) {
+ # this would be better as an extension hook
+ include_once( "UserMailer.php" );
+ $wgEnotif = new EmailNotification ();
+ $wgEnotif->notifyOnPageChange( $this->mTitle, $now, $summary, $me2, $oldid );
+ }
}
/**
* @private
*/
function viewUpdates() {
- global $wgDeferredUpdateList;
+ global $wgDeferredUpdateList, $wgUseEnotif;
if ( 0 != $this->getID() ) {
global $wgDisableCounters;
if ($this->mTitle->getNamespace() == NS_USER_TALK &&
$this->mTitle->getText() == $wgUser->getName())
{
- require_once( 'UserTalkUpdate.php' );
- $u = new UserTalkUpdate( 0, $this->mTitle->getNamespace(), $this->mTitle->getDBkey(), false, false, false );
- } else {
+ if ( $wgUseEnotif ) {
+ require_once( 'UserTalkUpdate.php' );
+ $u = new UserTalkUpdate( 0, $this->mTitle->getNamespace(), $this->mTitle->getDBkey(), false, false, false );
+ } else {
+ $wgUser->setNewtalk(0);
+ $wgUser->saveNewtalk();
+ }
+ } elseif ( $wgUseEnotif ) {
$wgUser->clearNotification( $this->mTitle );
}
*/
function editUpdates( $text, $summary, $minoredit, $timestamp_of_pagechange) {
global $wgDeferredUpdateList, $wgDBname, $wgMemc;
- global $wgMessageCache, $wgUser;
+ global $wgMessageCache, $wgUser, $wgUseEnotif;
wfSeedRandom();
if ( 0 == mt_rand( 0, 999 ) ) {
$u = new SearchUpdate( $id, $title, $text );
array_push( $wgDeferredUpdateList, $u );
- # If this is another user's talk page,
- # create a watchlist entry for this page
+ # If this is another user's talk page, update newtalk
- if ($this->mTitle->getNamespace() == NS_USER_TALK &&
- $shortTitle != $wgUser->getName()) {
- require_once( 'UserTalkUpdate.php' );
- $u = new UserTalkUpdate( 1, $this->mTitle->getNamespace(), $shortTitle, $summary, $minoredit, $timestamp_of_pagechange);
+ if ($this->mTitle->getNamespace() == NS_USER_TALK && $shortTitle != $wgUser->getName()) {
+ if ( $wgUseEnotif ) {
+ require_once( 'UserTalkUpdate.php' );
+ $u = new UserTalkUpdate( 1, $this->mTitle->getNamespace(), $shortTitle, $summary,
+ $minoredit, $timestamp_of_pagechange);
+ } else {
+ $other = User::newFromName($shortTitle);
+ $other->setNewtalk(1);
+ $other->saveNewtalk();
+ }
}
if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
array( 'categorylinks', 'patch-categorylinks.sql' ),
array( 'logging', 'patch-logging.sql' ),
array( 'validate', 'patch-validate.sql' ),
+ array( 'user_newtalk', 'patch-usernewtalk2.sql' ),
);
$wgNewFields = array(
array( 'image', 'img_metadata', 'patch-img_metadata.sql' ),
array( 'image', 'img_media_type', 'patch-img_media_type.sql' ),
array( 'validate', 'val_ip', 'patch-val_ip.sql' ),
- array( 'site_stats', 'ss_total_articles', 'patch-ss_total_articles.sql' ),
+ array( 'site_stats', 'ss_total_pages', 'patch-ss_total_articles.sql' ),
);
function rename_table( $from, $to, $patch ) {
function do_watchlist_update() {
global $wgDatabase;
if( $wgDatabase->fieldExists( 'watchlist', 'wl_notificationtimestamp' ) ) {
- echo "ENOTIF: The watchlist table is already set up for email notification.\n";
+ echo "The watchlist table is already set up for email notification.\n";
} else {
- echo "ENOTIF: Adding wl_notificationtimestamp field for email notification management.";
+ echo "Adding wl_notificationtimestamp field for email notification management.";
/* ALTER TABLE watchlist ADD (wl_notificationtimestamp varchar(14) binary NOT NULL default '0'); */
dbsource( "maintenance/archives/patch-email-notification.sql", $wgDatabase );
echo "ok\n";
global $wgDatabase;
global $wgCommandLineMode; # this needs to be saved while getID() and getName() are called
- if ( $wgDatabase->tableExists( 'user_newtalk' ) ) {
- $res = $wgDatabase->safeQuery( 'SELECT user_id, user_ip FROM !',
- $wgDatabase->tableName( 'user_newtalk' ) );
- $num_newtalks=$wgDatabase->numRows($res);
- echo "ENOTIF: Now converting ".$num_newtalks." user_newtalk entries to watchlist table entries ... \n";
-
- $user = new User();
- for ( $i = 1; $i <= $num_newtalks; $i++ ) {
- $wluser = $wgDatabase->fetchObject( $res );
- echo 'ENOTIF: <= user_newtalk: user_id='.$wluser->user_id.' user_ip='.$wluser->user_ip."\n";
- if ($wluser->user_id == 0) { # anonymous users ... have IP numbers as "names"
- if ($user->isIP($wluser->user_ip)) { # do only if it really looks like an IP number (double checked)
- $wgDatabase->replace( 'watchlist',
- array(array('wl_user','wl_namespace', 'wl_title', 'wl_notificationtimestamp' )),
- array('wl_user' => 0,
- 'wl_namespace' => NS_USER_TALK,
- 'wl_title' => $wluser->user_ip,
- 'wl_notificationtimestamp' => '19700101000000'
- ), 'updaters.inc::do_watchlist_update2'
- );
- echo 'ENOTIF: ====> watchlist: user_id=0 '.$wluser->user_ip."\n";
- }
- } else { # normal users ... have user_ids
- $user->setID($wluser->user_id);
+ $res = $wgDatabase->safeQuery( 'SELECT user_id, user_ip FROM !',
+ $wgDatabase->tableName( 'user_newtalk' ) );
+ $num_newtalks=$wgDatabase->numRows($res);
+ echo "Now converting ".$num_newtalks." user_newtalk entries to watchlist table entries ... \n";
+
+ $user = new User();
+ for ( $i = 1; $i <= $num_newtalks; $i++ ) {
+ $wluser = $wgDatabase->fetchObject( $res );
+ if ($wluser->user_id == 0) { # anonymous users ... have IP numbers as "names"
+ if ($user->isIP($wluser->user_ip)) { # do only if it really looks like an IP number (double checked)
$wgDatabase->replace( 'watchlist',
array(array('wl_user','wl_namespace', 'wl_title', 'wl_notificationtimestamp' )),
- array('wl_user' => $user->getID(),
+ array('wl_user' => 0,
'wl_namespace' => NS_USER_TALK,
- 'wl_title' => $user->getName(),
+ 'wl_title' => $wluser->user_ip,
'wl_notificationtimestamp' => '19700101000000'
- ), 'updaters.inc::do_watchlist_update3'
+ ), 'updaters.inc::do_watchlist_update2'
);
- echo 'ENOTIF: ====> watchlist: user_id='.$user->getID().' '.$user->getName()."\n";
}
+ } else { # normal users ... have user_ids
+ $user->setID($wluser->user_id);
+ $wgDatabase->replace( 'watchlist',
+ array(array('wl_user','wl_namespace', 'wl_title', 'wl_notificationtimestamp' )),
+ array('wl_user' => $user->getID(),
+ 'wl_namespace' => NS_USER_TALK,
+ 'wl_title' => $user->getName(),
+ 'wl_notificationtimestamp' => '19700101000000'
+ ), 'updaters.inc::do_watchlist_update3'
+ );
}
- echo "ENOTIF: The watchlist table has got the former user_newtalk entries.\n";
- dbsource( "maintenance/archives/patch-drop-user_newtalk.sql", $wgDatabase );
- echo "ENOTIF: Deleting the user_newtalk table as its entries are now in the watchlist table.\n";
- } else {
- echo "ENOTIF: No user_newtalk table found. Nothing to convert to watchlist table entries.\n";
}
+ echo "Done.\n";
}