$this->viewUpdates();
wfProfileOut( $fname );
- include_once( "UserMailer.php" );
- $wgEnotif = new EmailNotification ();
- $wgEnotif->Clear( $wgUser->getID(), $this->mTitle->getDBkey(), $this->mTitle->getNamespace() );
+ $wgUser->clearNotification( $this->mTitle );
}
/**
$wgOut->addHTML( wfMsg( "email_notification_infotext" ) );
- include_once( "UserMailer.php" );
- $wgEnotif = new EmailNotification ();
- $wgEnotif->ClearAll($wgUser->getID());
+ if( $wgRequest->getVal( 'reset' ) == 'all' ) {
+ $wgUser->clearAllNotifications();
+ }
if(($action == "submit") && isset($remove) && is_array($id)) {
$wgOut->addHTML( wfMsg( "removingchecked" ) );
$wl->removeWatch();
$this->invalidateCache();
}
+
+ /**
+ * Clear the user's notification timestamp for the given title.
+ * If e-notif e-mails are on, they will receive notification mails on
+ * the next change of the page if it's watched etc.
+ */
+ function clearNotification( $title ) {
+ $dbw =& wfGetDB( DB_MASTER );
+ $success = $dbw->update( 'watchlist',
+ array( /* SET */
+ 'wl_notificationtimestamp' => 0
+ ), array( /* WHERE */
+ 'wl_title' => $title->getDBkey(),
+ 'wl_namespace' => $title->getNamespace(),
+ 'wl_user' => $this->getId()
+ ), 'User::clearLastVisited'
+ );
+ }
+
/**#@-*/
+ /**
+ * Resets all of the given user's page-change notification timestamps.
+ * If e-notif e-mails are on, they will receive notification mails on
+ * the next change of any watched page.
+ *
+ * @param int $currentUser user ID number
+ * @access public
+ */
+ function clearAllNotifications( $currentUser ) {
+ if( $currentUser != 0 ) {
+
+ $dbw =& wfGetDB( DB_MASTER );
+ $success = $dbw->update( 'watchlist',
+ array( /* SET */
+ 'wl_notificationtimestamp' => 0
+ ), array( /* WHERE */
+ 'wl_user' => $currentUser
+ ), 'UserMailer::clearAll'
+ );
+
+ # we also need to clear here the "you have new message" notification for the own user_talk page
+ # This is cleared one page view later in Article::viewUpdates();
+ }
+ }
+
/**
* @access private
* @return string Encoding options
return (userMailer($to, $mail->from, $mail->subject, $body, $mail->replyto) == '');
}
-function Clear($currentUser, $currentPage, $currentNs) {
- $dbw =& wfGetDB( DB_MASTER );
- $success = $dbw->update( 'watchlist',
- array( /* SET */
- 'wl_notificationtimestamp' => 0
- ), array( /* WHERE */
- 'wl_title' => $currentPage,
- 'wl_namespace' => $currentNs,
- 'wl_user' => $currentUser
- ), 'UserMailer::Clear'
- );
-}
-
-function ClearAll($currentUser) {
- global $_REQUEST;
-
- if ($currentUser != 0) {
-
- if( $_REQUEST['reset'] == 'all') {
-
- $dbw =& wfGetDB( DB_MASTER );
- $success = $dbw->update( 'watchlist',
- array( /* SET */
- 'wl_notificationtimestamp' => 0
- ), array( /* WHERE */
- 'wl_user' => $currentUser
- ), 'UserMailer::ClearAll'
- );
-
- # we also need to clear here the "you have new message" notification for the own user_talk page
- # This is cleared one page view later in Article::viewUpdates();
- }
- }
-}
-
} # end of class EmailNotification
?>