Page MenuHomePhabricator

adding e-mail notification for _new_ pages to ENotif patch (this is my patchlet #2)
Closed, DeclinedPublic

Description

Brion this is the second patchlet. It adds e-mail notification for new pages.
It includes the first patchlet, bugzilla 2014 and is based on fresh update of today.

  • requires database change in table user (field user_emailnotificationfornewpages is added).
  • tables.sql, updaters.inc, patch-....sql included
  • two switches in DefaultSettings determine behaviour and options for users (or only superusers):
    • $wgEmailNotificationForNewPages = true;
      1. show the option
    • $wgEmailNotificationForNewPagesAllowedForAll = true;
      1. false means: only Sysops, Bureaucrats and Developers see the option
  • remark: new pages are notified, but not automatically added to watchlists.

Version: 1.5.x
Severity: enhancement
URL: http://test.leuksman.com/index.php/User:Wikinaut/To-Do

Details

Reference
bz2066

Related Objects

StatusAssignedTask
InvalidAklapper
InvalidNone
InvalidWikinaut
ResolvedNone
DeclinedNone
ResolvedWikinaut
ResolvedNone
ResolvedNone
DeclinedNone
ResolvedNone
ResolvedNone
ResolvedWikinaut
DeclinedNone
DeclinedNone
ResolvedNone
DeclinedNone
DeclinedAklapper
ResolvedNone
ResolvedNone
ResolvedNone
Resolvedhashar
Resolvedhashar
Resolvedhashar
ResolvedNone
ResolvedNone
Resolvedhashar
Resolvedhashar
Resolvedhashar
Resolvedhashar
ResolvedNone
ResolvedNone
Resolvedhashar
ResolvedNone
DeclinedWikinaut
ResolvedWikinaut
ResolvedWikinaut

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 8:26 PM
bzimport set Reference to bz2066.
bzimport added a subscriber: Unknown Object (MLST).
Wikinaut created this task.May 3 2005, 10:54 PM

Created attachment 492
patchlet #2: adds e-mail notification to ENotif (cumulative patch; includes patchlet #1 which is bugzilla 2014)

attachment cvs.diff ignored as obsolete

A bug for new page notifications exists where two mails were sent out in the special cases of

a) pre-watched pages 
   (not everyone knows, but in all MediaWiki versions  
    you can add pages to your watchlist _before_ they exist) 
 
b) initial edits of user/user_talk pages.

Fix prevents sending of a second mail in special cases.

In UserMailer.php add the marked lines

		if ( $wgEmailNotificationForNewPages && isset($oldid) && $oldid==0 ) { 
			$dbr =& wfGetDB( DB_MASTER ); 
			$res = $dbr->select( 'user', 
					'user_id', 
					'user_emailnotificationfornewpages=1 AND user_id<>'.$pageeditorUserObj->getID(), 
					$fname ); 
			for ($i = 1; $i <= $dbr->numRows( $res ); $i++) { 
				if (!$initialised) { # initialise if not yet done 
					$article->mTimestamp = $timestamp; 
					$article->mSummary = $currentSummary; 
					$article->mMinorEdit = $currentMinorEdit; 
					$article->mNamespace = $currentNs; 
					$article->mTitle = $currentPage; 
					$article->mOldid = $oldid; 
					$mail = $this->composeCommonMailtext( $pageeditorUserObj, $article ); 
					$watchingUserObj = new User(); 
				} 
 
				$wuser = $dbr->fetchObject( $res ); 
				$watchingUserObj->setID($wuser->user_id);
  • # We must not send new page notification to users, who already received an enotif
  • # during the first loop when notifs for watched pages were sent
  • $enotiftimestamp = $dbr->selectField( 'watchlist',
  • 'wl_notificationtimestamp',
  • array (
  • 'wl_title' => $currentPage,
  • 'wl_namespace' => $currentNs,
  • 'wl_user' => $wuser->user_id
  • ),
  • $fname );
  • # two possibilities exist, where an enotif is sent now
  • # a) page is not watched (query failed)
  • # b) page is watched and not yet notified (should not happen here)
  • if ( !$enotiftimestamp || ( $enotiftimestamp == wfTimestampOrNull() ) ) {
					$sent = $this->composeAndSendPersonalisedMail( $watchingUserObj, $mail, $article );
  • }
			} 
		} # notifications for a new page

sumanah wrote:

Comment on attachment 492
patchlet #2: adds e-mail notification to ENotif (cumulative patch; includes patchlet #1 which is bugzilla 2014)

Patch no longer applies to trunk, so marking obsolete (checked by Rusty per
http://lists.wikimedia.org/pipermail/wikitech-l/2011-November/056340.html ).

sumanah wrote:

Thomas, I'm sorry, but your patchlet no longer applies to the current MediaWiki codebase. Is the change still necessary, or has MediaWiki already fixed the problem? Thanks.

Sumana, this is more than six years old. Closing as "WONTFIX".