/**
  * Publishes the log entry.
  * @param int $newId Id of the log entry.
  * @param string $to One of: rcandudp (default), rc, udp
  */
 public function publish($newId, $to = 'rcandudp')
 {
     $log = new LogPage($this->getType());
     if ($log->isRestricted()) {
         return;
     }
     $rc = $this->getRecentChange($newId);
     if ($to === 'rc' || $to === 'rcandudp') {
         $rc->save('pleasedontudp');
     }
     if ($to === 'udp' || $to === 'rcandudp') {
         $rc->notifyRCFeeds();
     }
 }
Esempio n. 2
0
 /**
  * Publishes the log entry.
  * @param int $newId id of the log entry.
  * @param string $to rcandudp (default), rc, udp
  */
 public function publish($newId, $to = 'rcandudp')
 {
     $log = new LogPage($this->getType());
     if ($log->isRestricted()) {
         return;
     }
     $formatter = LogFormatter::newFromEntry($this);
     $context = RequestContext::newExtraneousContext($this->getTarget());
     $formatter->setContext($context);
     $logpage = SpecialPage::getTitleFor('Log', $this->getType());
     $user = $this->getPerformer();
     $ip = "";
     if ($user->isAnon()) {
         /*
          * "MediaWiki default" and friends may have
          * no IP address in their name
          */
         if (IP::isIPAddress($user->getName())) {
             $ip = $user->getName();
         }
     }
     $rc = RecentChange::newLogEntry($this->getTimestamp(), $logpage, $user, $formatter->getPlainActionText(), $ip, $this->getType(), $this->getSubtype(), $this->getTarget(), $this->getComment(), serialize((array) $this->getParameters()), $newId, $formatter->getIRCActionComment());
     if ($to === 'rc' || $to === 'rcandudp') {
         $rc->save('pleasedontudp');
     }
     if ($to === 'udp' || $to === 'rcandudp') {
         $rc->notifyRC2UDP();
     }
 }
Esempio n. 3
0
 /**
  * Publish the log entry.
  *
  * @param int $newId Id of the log entry.
  * @param string $to One of: rcandudp (default), rc, udp
  * @return RecentChange|null
  */
 public function publish($newId, $to = 'rcandudp')
 {
     $log = new LogPage($this->getType());
     if ($log->isRestricted()) {
         return null;
     }
     $rc = $this->getRecentChange($newId);
     if ($to === 'rc' || $to === 'rcandudp') {
         $rc->save('pleasedontudp');
     }
     if ($to === 'udp' || $to === 'rcandudp') {
         $rc->notifyRCFeeds();
     }
     // Log the autopatrol if the log entry is patrollable
     if ($this->getIsPatrollable() && $rc->getAttribute('rc_patrolled') === 1) {
         PatrolLog::record($rc, true, $this->getPerformer());
     }
     // Add change tags to the log entry and (if applicable) the associated revision
     $tags = $this->getTags();
     if (!is_null($tags)) {
         $rcId = $rc->getAttribute('rc_id');
         $revId = $this->getAssociatedRevId();
         // Use null if $revId is 0
         ChangeTags::addTags($tags, $rcId, $revId > 0 ? $revId : null, $newId);
     }
     return $rc;
 }
Esempio n. 4
0
 /**
  * Publishes the log entry.
  * @param $newId int id of the log entry.
  * @param $to string: rcandudp (default), rc, udp
  */
 public function publish($newId, $to = 'rcandudp')
 {
     $log = new LogPage($this->getType());
     if ($log->isRestricted()) {
         return;
     }
     $formatter = LogFormatter::newFromEntry($this);
     $context = RequestContext::newExtraneousContext($this->getTarget());
     $formatter->setContext($context);
     $logpage = SpecialPage::getTitleFor('Log', $this->getType());
     $user = $this->getPerformer();
     $rc = RecentChange::newLogEntry($this->getTimestamp(), $logpage, $user, $formatter->getPlainActionText(), $user->isAnon() ? $user->getName() : '', $this->getType(), $this->getSubtype(), $this->getTarget(), $this->getComment(), serialize((array) $this->getParameters()), $newId, $formatter->getIRCActionComment());
     if ($to === 'rc' || $to === 'rcandudp') {
         $rc->save('pleasedontudp');
     }
     if ($to === 'udp' || $to === 'rcandudp') {
         $rc->notifyRC2UDP();
     }
 }
Esempio n. 5
0
 /**
  * Publish the log entry.
  *
  * @param int $newId Id of the log entry.
  * @param string $to One of: rcandudp (default), rc, udp
  */
 public function publish($newId, $to = 'rcandudp')
 {
     DeferredUpdates::addCallableUpdate(function () use($newId, $to) {
         $log = new LogPage($this->getType());
         if (!$log->isRestricted()) {
             $rc = $this->getRecentChange($newId);
             if ($to === 'rc' || $to === 'rcandudp') {
                 // save RC, passing tags so they are applied there
                 $tags = $this->getTags();
                 if (is_null($tags)) {
                     $tags = [];
                 }
                 $rc->addTags($tags);
                 $rc->save('pleasedontudp');
             }
             if ($to === 'udp' || $to === 'rcandudp') {
                 $rc->notifyRCFeeds();
             }
             // Log the autopatrol if the log entry is patrollable
             if ($this->getIsPatrollable() && $rc->getAttribute('rc_patrolled') === 1) {
                 PatrolLog::record($rc, true, $this->getPerformer());
             }
         }
     }, DeferredUpdates::POSTSEND, wfGetDB(DB_MASTER));
 }
Esempio n. 6
0
 /**
  * Publish the log entry.
  *
  * @param int $newId Id of the log entry.
  * @param string $to One of: rcandudp (default), rc, udp
  */
 public function publish($newId, $to = 'rcandudp')
 {
     $log = new LogPage($this->getType());
     if ($log->isRestricted()) {
         return;
     }
     $rc = $this->getRecentChange($newId);
     if ($to === 'rc' || $to === 'rcandudp') {
         $rc->save('pleasedontudp');
     }
     if ($to === 'udp' || $to === 'rcandudp') {
         $rc->notifyRCFeeds();
     }
     // Log the autopatrol if an associated rev id was passed
     if ($this->getAssociatedRevId() > 0 && $rc->getAttribute('rc_patrolled') === 1) {
         PatrolLog::record($rc, true, $this->getPerformer());
     }
 }