示例#1
0
 function run()
 {
     $enotif = new EmailNotification();
     // Get the user from ID (rename safe). Anons are 0, so defer to name.
     if (isset($this->params['editorID']) && $this->params['editorID']) {
         $editor = User::newFromId($this->params['editorID']);
         // B/C, only the name might be given.
     } else {
         $editor = User::newFromName($this->params['editor'], false);
     }
     $enotif->actuallyNotifyOnPageChange($editor, $this->title, $this->params['timestamp'], $this->params['summary'], $this->params['minorEdit'], $this->params['oldid'], $this->params['watchers']);
     return true;
 }
示例#2
0
 /**
  * main entry point
  *
  * @access public
  */
 public function run()
 {
     global $wgUseEnotif;
     wfProfileIn(__METHOD__);
     if (!$wgUseEnotif) {
         wfProfileOut(__METHOD__);
         return true;
     }
     if ($this->mParams['user_id']) {
         /* registered User */
         $editor = User::newFromID($this->mParams['user_id']);
     } elseif ($this->mParams['user_name']) {
         /* anons */
         $editor = User::newFromName($this->mParams['user_name'], false);
     } else {
         /* invalid user */
         wfProfileOut(__METHOD__);
         return true;
     }
     /**
      * get title of page, take main part from this title which will be
      * main page for user blogs (listing)
      */
     $ownerTitle = BlogArticle::getOwnerTitle($this->title);
     /**
      * check who watches this page
      */
     $dbr = wfGetDB(DB_SLAVE);
     $res = $dbr->select(array("watchlist"), array("wl_user"), array("wl_namespace" => $ownerTitle->getNamespace(), "wl_title" => $ownerTitle->getDBKey()), __METHOD__);
     while ($row = $dbr->fetchObject($res)) {
         $watchers[] = intval($row->wl_user);
     }
     if (!empty($watchers)) {
         $enotif = new EmailNotification();
         $title = Title::makeTitle($ownerTitle->getNamespace(), $ownerTitle->getDBKey());
         $enotif->actuallyNotifyOnPageChange($editor, $title, $this->params['timestamp'], $this->params['comment'], $this->params['minor'], 0, $watchers, $this->params['log_action']);
         /* Update wl_notificationtimestamp for all watching users except the editor */
         $dbw = wfGetDB(DB_MASTER);
         $dbw->begin();
         $dbw->update('watchlist', array('wl_notificationtimestamp' => $dbw->timestamp(wfTimestampNow())), array('wl_title' => $ownerTitle->getDBkey(), 'wl_namespace' => $ownerTitle->getNamespace(), 'wl_user' => $watchers), __METHOD__);
         $dbw->commit();
     }
     wfProfileOut(__METHOD__);
     return true;
 }
 function run()
 {
     $enotif = new EmailNotification();
     $enotif->actuallyNotifyOnPageChange(User::newFromName($this->params['editor'], false), $this->title, $this->params['timestamp'], $this->params['summary'], $this->params['minorEdit'], $this->params['oldid']);
     return true;
 }