Last modified: 2011-11-21 23:21:24 UTC
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; # show the option ** $wgEmailNotificationForNewPagesAllowedForAll = true; # false means: only Sysops, Bureaucrats and Developers see the option * remark: new pages are notified, but not automatically added to watchlists.
Created attachment 492 [details] patchlet #2: adds e-mail notification to ENotif (cumulative patch; includes patchlet #1 which is bugzilla 2014)
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
Comment on attachment 492 [details] 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 ).
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".