Exemplo n.º 1
0
 public function emailFollowNotifications($initiatingUser, $aWatchers, $iUserId, $iNamespace, $sMessage, $sAction)
 {
     $wg = F::app()->wg;
     $wg->DBname = WikiFactory::IDtoDB($this->getWikiId());
     $wg->Server = trim(WikiFactory::DBtoUrl(F::app()->wg->DBname), '/');
     if (!empty($wg->DevelEnvironment)) {
         $wg->Server = WikiFactory::getLocalEnvURL($wg->Server);
     }
     $wg->User = User::newFromId($initiatingUser);
     $targetUser = User::newFromId($iUserId);
     $this->logWatchers($aWatchers, $sAction);
     foreach ($aWatchers as $sKey => $sValue) {
         $oTitle = Title::makeTitle($iNamespace, $sKey);
         $oEmailNotification = new EmailNotification($targetUser, $oTitle, wfTimestampNow(), $sMessage, false, $currentRevId = 0, $previousRevId = 0, $sAction, ['notisnull' => 1, 'childTitle' => $this->title]);
         $oEmailNotification->notifyOnPageChange();
     }
 }
Exemplo n.º 2
0
 public function save()
 {
     global $wgLocalInterwiki, $wgPutIPinRC, $wgRC2UDPAddress, $wgRC2UDPOmitBots;
     $fname = 'RecentChange::save';
     $dbw = wfGetDB(DB_MASTER);
     if (!is_array($this->mExtra)) {
         $this->mExtra = array();
     }
     $this->mExtra['lang'] = $wgLocalInterwiki;
     if (!$wgPutIPinRC) {
         $this->mAttribs['rc_ip'] = '';
     }
     # If our database is strict about IP addresses, use NULL instead of an empty string
     if ($dbw->strictIPs() and $this->mAttribs['rc_ip'] == '') {
         unset($this->mAttribs['rc_ip']);
     }
     # Fixup database timestamps
     $this->mAttribs['rc_timestamp'] = $dbw->timestamp($this->mAttribs['rc_timestamp']);
     $this->mAttribs['rc_cur_time'] = $dbw->timestamp($this->mAttribs['rc_cur_time']);
     $this->mAttribs['rc_id'] = $dbw->nextSequenceValue('recentchanges_rc_id_seq');
     ## If we are using foreign keys, an entry of 0 for the page_id will fail, so use NULL
     if ($dbw->cascadingDeletes() and $this->mAttribs['rc_cur_id'] == 0) {
         unset($this->mAttribs['rc_cur_id']);
     }
     # Insert new row
     $dbw->insert('recentchanges', $this->mAttribs, $fname);
     # Set the ID
     $this->mAttribs['rc_id'] = $dbw->insertId();
     # Notify extensions
     wfRunHooks('RecentChange_save', array(&$this));
     # Notify external application via UDP
     if ($wgRC2UDPAddress && (!$this->mAttribs['rc_bot'] || !$wgRC2UDPOmitBots)) {
         self::sendToUDP($this->getIRCLine());
     }
     # E-mail notifications
     global $wgUseEnotif, $wgShowUpdatedMarker, $wgUser;
     if ($wgUseEnotif || $wgShowUpdatedMarker) {
         // Users
         if ($this->mAttribs['rc_user']) {
             $editor = $wgUser->getId() == $this->mAttribs['rc_user'] ? $wgUser : User::newFromID($this->mAttribs['rc_user']);
             // Anons
         } else {
             $editor = $wgUser->getName() == $this->mAttribs['rc_user_text'] ? $wgUser : User::newFromName($this->mAttribs['rc_user_text'], false);
         }
         # FIXME: this would be better as an extension hook
         $enotif = new EmailNotification();
         $title = Title::makeTitle($this->mAttribs['rc_namespace'], $this->mAttribs['rc_title']);
         $enotif->notifyOnPageChange($editor, $title, $this->mAttribs['rc_timestamp'], $this->mAttribs['rc_comment'], $this->mAttribs['rc_minor'], $this->mAttribs['rc_last_oldid']);
     }
 }
Exemplo n.º 3
0
 /**
  * Writes the data in this object to the database
  * @param bool $noudp
  */
 public function save($noudp = false)
 {
     global $wgPutIPinRC, $wgUseEnotif, $wgShowUpdatedMarker, $wgContLang;
     $dbw = wfGetDB(DB_MASTER);
     if (!is_array($this->mExtra)) {
         $this->mExtra = array();
     }
     if (!$wgPutIPinRC) {
         $this->mAttribs['rc_ip'] = '';
     }
     # If our database is strict about IP addresses, use NULL instead of an empty string
     if ($dbw->strictIPs() && $this->mAttribs['rc_ip'] == '') {
         unset($this->mAttribs['rc_ip']);
     }
     # Trim spaces on user supplied text
     $this->mAttribs['rc_comment'] = trim($this->mAttribs['rc_comment']);
     # Make sure summary is truncated (whole multibyte characters)
     $this->mAttribs['rc_comment'] = $wgContLang->truncate($this->mAttribs['rc_comment'], 255);
     # Fixup database timestamps
     $this->mAttribs['rc_timestamp'] = $dbw->timestamp($this->mAttribs['rc_timestamp']);
     $this->mAttribs['rc_id'] = $dbw->nextSequenceValue('recentchanges_rc_id_seq');
     # # If we are using foreign keys, an entry of 0 for the page_id will fail, so use NULL
     if ($dbw->cascadingDeletes() && $this->mAttribs['rc_cur_id'] == 0) {
         unset($this->mAttribs['rc_cur_id']);
     }
     # Insert new row
     $dbw->insert('recentchanges', $this->mAttribs, __METHOD__);
     # Set the ID
     $this->mAttribs['rc_id'] = $dbw->insertId();
     # Notify extensions
     Hooks::run('RecentChange_save', array(&$this));
     # Notify external application via UDP
     if (!$noudp) {
         $this->notifyRCFeeds();
     }
     # E-mail notifications
     if ($wgUseEnotif || $wgShowUpdatedMarker) {
         $editor = $this->getPerformer();
         $title = $this->getTitle();
         // Never send an RC notification email about categorization changes
         if ($this->mAttribs['rc_type'] != RC_CATEGORIZE) {
             if (Hooks::run('AbortEmailNotification', array($editor, $title, $this))) {
                 # @todo FIXME: This would be better as an extension hook
                 $enotif = new EmailNotification();
                 $enotif->notifyOnPageChange($editor, $title, $this->mAttribs['rc_timestamp'], $this->mAttribs['rc_comment'], $this->mAttribs['rc_minor'], $this->mAttribs['rc_last_oldid'], $this->mExtra['pageStatus']);
             }
         }
     }
     // Update the cached list of active users
     if ($this->mAttribs['rc_user'] > 0) {
         JobQueueGroup::singleton()->lazyPush(RecentChangesUpdateJob::newCacheUpdateJob());
     }
 }
Exemplo n.º 4
0
 /**
  * Writes the data in this object to the database
  * @param $noudp bool
  */
 public function save($noudp = false)
 {
     global $wgLocalInterwiki, $wgPutIPinRC, $wgContLang;
     $dbw = wfGetDB(DB_MASTER);
     if (!is_array($this->mExtra)) {
         $this->mExtra = array();
     }
     $this->mExtra['lang'] = $wgLocalInterwiki;
     if (!$wgPutIPinRC) {
         $this->mAttribs['rc_ip'] = '';
     }
     # If our database is strict about IP addresses, use NULL instead of an empty string
     if ($dbw->strictIPs() and $this->mAttribs['rc_ip'] == '') {
         unset($this->mAttribs['rc_ip']);
     }
     # Make sure summary is truncated (whole multibyte characters)
     $this->mAttribs['rc_comment'] = $wgContLang->truncate($this->mAttribs['rc_comment'], 255);
     # Fixup database timestamps
     $this->mAttribs['rc_timestamp'] = $dbw->timestamp($this->mAttribs['rc_timestamp']);
     $this->mAttribs['rc_cur_time'] = $dbw->timestamp($this->mAttribs['rc_cur_time']);
     $this->mAttribs['rc_id'] = $dbw->nextSequenceValue('recentchanges_rc_id_seq');
     ## If we are using foreign keys, an entry of 0 for the page_id will fail, so use NULL
     if ($dbw->cascadingDeletes() and $this->mAttribs['rc_cur_id'] == 0) {
         unset($this->mAttribs['rc_cur_id']);
     }
     /* Wikia change begin - @author: Macbre */
     /* Wysiwyg: add extra data before row is added */
     wfRunHooks('RecentChange_beforeSave', array(&$this));
     /* Wikia change end */
     # Insert new row
     $dbw->insert('recentchanges', $this->mAttribs, __METHOD__);
     # Set the ID
     $this->mAttribs['rc_id'] = $dbw->insertId();
     # Notify extensions
     wfRunHooks('RecentChange_save', array(&$this));
     # Notify external application via UDP
     if (!$noudp) {
         $this->notifyRC2UDP();
     }
     # E-mail notifications
     global $wgUseEnotif, $wgShowUpdatedMarker, $wgUser;
     if ($wgUseEnotif || $wgShowUpdatedMarker) {
         // Users
         if ($this->mAttribs['rc_user']) {
             $editor = $wgUser->getId() == $this->mAttribs['rc_user'] ? $wgUser : User::newFromID($this->mAttribs['rc_user']);
             // Anons
         } else {
             $editor = $wgUser->getName() == $this->mAttribs['rc_user_text'] ? $wgUser : User::newFromName($this->mAttribs['rc_user_text'], false);
         }
         $title = Title::makeTitle($this->mAttribs['rc_namespace'], $this->mAttribs['rc_title']);
         # @todo FIXME: This would be better as an extension hook
         $enotif = new EmailNotification($editor, $title, $this->mAttribs['rc_timestamp'], $this->mAttribs['rc_comment'], $this->mAttribs['rc_minor'], $this->mAttribs['rc_this_oldid'], $this->mAttribs['rc_last_oldid'], $this->mAttribs['rc_log_action']);
         $enotif->notifyOnPageChange();
     }
     // temporary code begin /Inez
     if ($this->mAttribs['rc_type'] == RC_NEW) {
         $eventType = 'new';
     } else {
         if ($this->mAttribs['rc_type'] == RC_EDIT) {
             $eventType = 'edit';
         } else {
             if ($this->mAttribs['rc_type'] == RC_LOG && $this->mAttribs['rc_namespace'] == NS_IMAGE) {
                 $eventType = 'upload';
             }
         }
     }
     if (!empty($eventType)) {
         global $wgMemc;
         $key = $eventType . gmdate('Ymd_Hi00');
         $ret = $wgMemc->incr($key);
         if (empty($ret)) {
             $wgMemc->set($key, 1, 60 * 5);
         }
     }
     // temporary code end
 }
 /**
  * Writes the data in this object to the database
  * @param $noudp bool
  */
 public function save($noudp = false)
 {
     global $wgLocalInterwiki, $wgPutIPinRC, $wgUseEnotif, $wgShowUpdatedMarker, $wgContLang;
     $dbw = wfGetDB(DB_MASTER);
     if (!is_array($this->mExtra)) {
         $this->mExtra = array();
     }
     $this->mExtra['lang'] = $wgLocalInterwiki;
     if (!$wgPutIPinRC) {
         $this->mAttribs['rc_ip'] = '';
     }
     # If our database is strict about IP addresses, use NULL instead of an empty string
     if ($dbw->strictIPs() and $this->mAttribs['rc_ip'] == '') {
         unset($this->mAttribs['rc_ip']);
     }
     # Trim spaces on user supplied text
     $this->mAttribs['rc_comment'] = trim($this->mAttribs['rc_comment']);
     # Make sure summary is truncated (whole multibyte characters)
     $this->mAttribs['rc_comment'] = $wgContLang->truncate($this->mAttribs['rc_comment'], 255);
     # Fixup database timestamps
     $this->mAttribs['rc_timestamp'] = $dbw->timestamp($this->mAttribs['rc_timestamp']);
     $this->mAttribs['rc_cur_time'] = $dbw->timestamp($this->mAttribs['rc_cur_time']);
     $this->mAttribs['rc_id'] = $dbw->nextSequenceValue('recentchanges_rc_id_seq');
     ## If we are using foreign keys, an entry of 0 for the page_id will fail, so use NULL
     if ($dbw->cascadingDeletes() and $this->mAttribs['rc_cur_id'] == 0) {
         unset($this->mAttribs['rc_cur_id']);
     }
     # Insert new row
     $dbw->insert('recentchanges', $this->mAttribs, __METHOD__);
     # Set the ID
     $this->mAttribs['rc_id'] = $dbw->insertId();
     # Notify extensions
     wfRunHooks('RecentChange_save', array(&$this));
     # Notify external application via UDP
     if (!$noudp) {
         $this->notifyRC2UDP();
     }
     # E-mail notifications
     if ($wgUseEnotif || $wgShowUpdatedMarker) {
         $editor = $this->getPerformer();
         $title = $this->getTitle();
         if (wfRunHooks('AbortEmailNotification', array($editor, $title))) {
             # @todo FIXME: This would be better as an extension hook
             $enotif = new EmailNotification();
             $enotif->notifyOnPageChange($editor, $title, $this->mAttribs['rc_timestamp'], $this->mAttribs['rc_comment'], $this->mAttribs['rc_minor'], $this->mAttribs['rc_last_oldid'], $this->mExtra['pageStatus']);
         }
     }
 }
Exemplo n.º 6
0
 /**
  * emailNotification -- sent Notification for all related article  ,
  *
  * @static
  * @access public
  *
  *
  * @return bool
  */
 function emailNotification($childTitle, $list, $namespace, $user, $action, $message)
 {
     global $wgTitle;
     wfProfileIn(__METHOD__);
     if (count($list) < 1) {
         wfProfileOut(__METHOD__);
         return true;
     }
     $dbw = wfGetDB(DB_SLAVE);
     $queryIn = array();
     foreach ($list as $value) {
         $queryIn[] = $dbw->addQuotes($value);
     }
     /* Wikia change begin - @author: wladek */
     /* RT#55604: Add a timeout to the watchlist email block */
     global $wgEnableWatchlistNotificationTimeout, $wgWatchlistNotificationTimeout;
     $now = wfTimestampNow();
     if (!empty($wgEnableWatchlistNotificationTimeout) && isset($wgWatchlistNotificationTimeout)) {
         // not using !empty() to allow setting integer value 0
         $blockTimeout = wfTimestamp(TS_MW, wfTimestamp(TS_UNIX, $now) - intval($wgWatchlistNotificationTimeout));
         $notificationTimeoutSql = "(wl_notificationtimestamp IS NULL OR wl_notificationtimestamp < '{$blockTimeout}')";
     } else {
         $notificationTimeoutSql = "wl_notificationtimestamp IS NULL";
     }
     if ($action == "blogpost") {
         $notificationTimeoutSql = "1";
     }
     $res = $dbw->select(array('watchlist'), array('wl_user, wl_title'), array('wl_user != ' . intval($user->getID()), 'wl_namespace' => $namespace, 'wl_title in(' . implode(",", $queryIn) . ') ', $notificationTimeoutSql), __METHOD__);
     $watchers = array();
     while ($row = $dbw->fetchObject($res)) {
         if (empty($watchers[$row->wl_title])) {
             $watchers[$row->wl_title] = array($row->wl_user);
         } else {
             if (in_array($row->wl_user, $watchers[$row->wl_title])) {
                 $watchers[$row->wl_title][] = $row->wl_user;
             }
         }
     }
     foreach ($watchers as $key => $value) {
         $enotif = new EmailNotification();
         $title = Title::makeTitle($namespace, $key);
         $enotif->notifyOnPageChange($user, $title, $now, $message, 0, 0, $action, array('notisnull' => 1, 'childTitle' => $childTitle));
     }
     wfProfileOut(__METHOD__);
 }
Exemplo n.º 7
0
function removeTag($action, $article)
{
    if ($action != 'removeTag') {
        return true;
    }
    global $wgRequest, $wgOut, $wgUser;
    wfProfileIn(__METHOD__);
    $wgOut->setArticleBodyOnly(true);
    $tagID = $wgRequest->getVal('tagID');
    $tagName = $wgRequest->getText('tagName');
    $imgName = $wgRequest->getText('imgName');
    $userText = $wgUser->getName();
    $tagID = preg_replace("/[\"'<>]/", '', $tagID);
    $tagName = preg_replace("/[\"'<>]/", '', $tagName);
    $imgName = preg_replace("/[\"'<>]/", '', $imgName);
    $img = wfFindFile($imgName);
    if ($img) {
        $imgTitle = $img->getTitle();
        wfPurgeTitle($imgTitle);
        $dbw = wfGetDB(DB_MASTER);
        $dbw->delete('imagetags', array('unique_id' => $tagID), __METHOD__);
        $wgOut->clearHTML();
        $wgOut->addHTML('<!-- removed tag from the database! -->');
        $wgOut->addHTML(wfGetImageTags($img, $imgName));
        $logPage = new LogPage('tag');
        $logComment = wfMsg('imagetagging-logentry', $tagName, $userText);
        $logPage->addEntry('tag', $imgTitle, $logComment);
        $enotif = new EmailNotification();
        $enotif->notifyOnPageChange($wgUser, $imgTitle, wfTimestampNow(), $logComment, false);
    } else {
        $wgOut->clearHTML();
        $wgOut->addHTML("<!-- ERROR: img named {$imgName} -->\n\t\t\t<script type='text/javascript'>\n\t\t\talert(\"Error removing tag!\");\n\t\t\t</script>");
    }
    wfProfileOut(__METHOD__);
    return false;
}
Exemplo n.º 8
0
 /**
  * Writes the data in this object to the database
  * @param bool $noudp
  */
 public function save($noudp = false)
 {
     global $wgPutIPinRC, $wgUseEnotif, $wgShowUpdatedMarker, $wgContLang;
     $dbw = wfGetDB(DB_MASTER);
     if (!is_array($this->mExtra)) {
         $this->mExtra = [];
     }
     if (!$wgPutIPinRC) {
         $this->mAttribs['rc_ip'] = '';
     }
     # Strict mode fixups (not-NULL fields)
     foreach (['minor', 'bot', 'new', 'patrolled', 'deleted'] as $field) {
         $this->mAttribs["rc_{$field}"] = (int) $this->mAttribs["rc_{$field}"];
     }
     # ...more fixups (NULL fields)
     foreach (['old_len', 'new_len'] as $field) {
         $this->mAttribs["rc_{$field}"] = isset($this->mAttribs["rc_{$field}"]) ? (int) $this->mAttribs["rc_{$field}"] : null;
     }
     # If our database is strict about IP addresses, use NULL instead of an empty string
     $strictIPs = in_array($dbw->getType(), ['oracle', 'postgres']);
     // legacy
     if ($strictIPs && $this->mAttribs['rc_ip'] == '') {
         unset($this->mAttribs['rc_ip']);
     }
     # Trim spaces on user supplied text
     $this->mAttribs['rc_comment'] = trim($this->mAttribs['rc_comment']);
     # Make sure summary is truncated (whole multibyte characters)
     $this->mAttribs['rc_comment'] = $wgContLang->truncate($this->mAttribs['rc_comment'], 255);
     # Fixup database timestamps
     $this->mAttribs['rc_timestamp'] = $dbw->timestamp($this->mAttribs['rc_timestamp']);
     $this->mAttribs['rc_id'] = $dbw->nextSequenceValue('recentchanges_rc_id_seq');
     # # If we are using foreign keys, an entry of 0 for the page_id will fail, so use NULL
     if ($this->mAttribs['rc_cur_id'] == 0) {
         unset($this->mAttribs['rc_cur_id']);
     }
     # Insert new row
     $dbw->insert('recentchanges', $this->mAttribs, __METHOD__);
     # Set the ID
     $this->mAttribs['rc_id'] = $dbw->insertId();
     # Notify extensions
     Hooks::run('RecentChange_save', [&$this]);
     if (count($this->tags)) {
         ChangeTags::addTags($this->tags, $this->mAttribs['rc_id'], $this->mAttribs['rc_this_oldid'], $this->mAttribs['rc_logid'], null, $this);
     }
     # Notify external application via UDP
     if (!$noudp) {
         $this->notifyRCFeeds();
     }
     # E-mail notifications
     if ($wgUseEnotif || $wgShowUpdatedMarker) {
         $editor = $this->getPerformer();
         $title = $this->getTitle();
         // Never send an RC notification email about categorization changes
         if ($this->mAttribs['rc_type'] != RC_CATEGORIZE && Hooks::run('AbortEmailNotification', [$editor, $title, $this])) {
             // @FIXME: This would be better as an extension hook
             // Send emails or email jobs once this row is safely committed
             $dbw->onTransactionIdle(function () use($editor, $title) {
                 $enotif = new EmailNotification();
                 $enotif->notifyOnPageChange($editor, $title, $this->mAttribs['rc_timestamp'], $this->mAttribs['rc_comment'], $this->mAttribs['rc_minor'], $this->mAttribs['rc_last_oldid'], $this->mExtra['pageStatus']);
             }, __METHOD__);
         }
     }
     // Update the cached list of active users
     if ($this->mAttribs['rc_user'] > 0) {
         JobQueueGroup::singleton()->lazyPush(RecentChangesUpdateJob::newCacheUpdateJob());
     }
 }
Exemplo n.º 9
0
 function save()
 {
     global $wgLocalInterwiki, $wgPutIPinRC, $wgRC2UDPAddress, $wgRC2UDPPort, $wgRC2UDPPrefix;
     $fname = 'RecentChange::save';
     $dbw = wfGetDB(DB_MASTER);
     if (!is_array($this->mExtra)) {
         $this->mExtra = array();
     }
     $this->mExtra['lang'] = $wgLocalInterwiki;
     if (!$wgPutIPinRC) {
         $this->mAttribs['rc_ip'] = '';
     }
     ## If our database is strict about IP addresses, use NULL instead of an empty string
     if ($dbw->strictIPs() and $this->mAttribs['rc_ip'] == '') {
         unset($this->mAttribs['rc_ip']);
     }
     # Fixup database timestamps
     $this->mAttribs['rc_timestamp'] = $dbw->timestamp($this->mAttribs['rc_timestamp']);
     $this->mAttribs['rc_cur_time'] = $dbw->timestamp($this->mAttribs['rc_cur_time']);
     $this->mAttribs['rc_id'] = $dbw->nextSequenceValue('rc_rc_id_seq');
     ## If we are using foreign keys, an entry of 0 for the page_id will fail, so use NULL
     if ($dbw->cascadingDeletes() and $this->mAttribs['rc_cur_id'] == 0) {
         unset($this->mAttribs['rc_cur_id']);
     }
     # Insert new row
     $dbw->insert('recentchanges', $this->mAttribs, $fname);
     # Set the ID
     $this->mAttribs['rc_id'] = $dbw->insertId();
     # Update old rows, if necessary
     if ($this->mAttribs['rc_type'] == RC_EDIT) {
         $lastTime = $this->mExtra['lastTimestamp'];
         #$now = $this->mAttribs['rc_timestamp'];
         #$curId = $this->mAttribs['rc_cur_id'];
         # Don't bother looking for entries that have probably
         # been purged, it just locks up the indexes needlessly.
         global $wgRCMaxAge;
         $age = time() - wfTimestamp(TS_UNIX, $lastTime);
         if ($age < $wgRCMaxAge) {
             # live hack, will commit once tested - kate
             # Update rc_this_oldid for the entries which were current
             #
             #$oldid = $this->mAttribs['rc_last_oldid'];
             #$ns = $this->mAttribs['rc_namespace'];
             #$title = $this->mAttribs['rc_title'];
             #
             #$dbw->update( 'recentchanges',
             #	array( /* SET */
             #		'rc_this_oldid' => $oldid
             #	), array( /* WHERE */
             #		'rc_namespace' => $ns,
             #		'rc_title' => $title,
             #		'rc_timestamp' => $dbw->timestamp( $lastTime )
             #	), $fname
             #);
         }
         # Update rc_cur_time
         #$dbw->update( 'recentchanges', array( 'rc_cur_time' => $now ),
         #	array( 'rc_cur_id' => $curId ), $fname );
     }
     # Notify external application via UDP
     if ($wgRC2UDPAddress) {
         $conn = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
         if ($conn) {
             $line = $wgRC2UDPPrefix . $this->getIRCLine();
             socket_sendto($conn, $line, strlen($line), 0, $wgRC2UDPAddress, $wgRC2UDPPort);
             socket_close($conn);
         }
     }
     # E-mail notifications
     global $wgUseEnotif;
     if ($wgUseEnotif) {
         # this would be better as an extension hook
         global $wgUser;
         $enotif = new EmailNotification();
         $title = Title::makeTitle($this->mAttribs['rc_namespace'], $this->mAttribs['rc_title']);
         $enotif->notifyOnPageChange($wgUser, $title, $this->mAttribs['rc_timestamp'], $this->mAttribs['rc_comment'], $this->mAttribs['rc_minor'], $this->mAttribs['rc_last_oldid']);
     }
     # Notify extensions
     wfRunHooks('RecentChange_save', array(&$this));
 }
Exemplo n.º 10
0
 /**
  * After we've either updated or inserted the article, update
  * the link tables and redirect to the new page.
  */
 function showArticle($text, $subtitle, $sectionanchor = '', $me2, $now, $summary, $oldid)
 {
     global $wgUseDumbLinkUpdate, $wgAntiLockFlags, $wgOut, $wgUser, $wgLinkCache, $wgEnotif;
     global $wgUseEnotif;
     $fname = 'Article::showArticle';
     wfProfileIn($fname);
     $wgLinkCache = new LinkCache();
     if (!$wgUseDumbLinkUpdate) {
         # Preload links to reduce lock time
         if ($wgAntiLockFlags & ALF_PRELOAD_LINKS) {
             $wgLinkCache->preFill($this->mTitle);
             $wgLinkCache->clear();
         }
     }
     # Parse the text and replace links with placeholders
     $wgOut = new OutputPage();
     # Pass the current title along in case we're creating a wiki page
     # which is different than the currently displayed one (e.g. image
     # pages created on file uploads); otherwise, link updates will
     # go wrong.
     $wgOut->addWikiTextWithTitle($text, $this->mTitle);
     if (!$wgUseDumbLinkUpdate) {
         # Move the current links back to the second register
         $wgLinkCache->swapRegisters();
         # Get old version of link table to allow incremental link updates
         # Lock this data now since it is needed for an update
         $wgLinkCache->forUpdate(true);
         $wgLinkCache->preFill($this->mTitle);
         # Swap this old version back into its rightful place
         $wgLinkCache->swapRegisters();
     }
     if ($this->isRedirect($text)) {
         $r = 'redirect=no';
     } else {
         $r = '';
     }
     $wgOut->redirect($this->mTitle->getFullURL($r) . $sectionanchor);
     if ($wgUseEnotif) {
         # this would be better as an extension hook
         include_once "UserMailer.php";
         $wgEnotif = new EmailNotification();
         $wgEnotif->notifyOnPageChange($this->mTitle, $now, $summary, $me2, $oldid);
     }
     wfProfileOut($fname);
 }