当前位置: 首页>>代码示例>>PHP>>正文


PHP RecentChange::notifyLog方法代码示例

本文整理汇总了PHP中RecentChange::notifyLog方法的典型用法代码示例。如果您正苦于以下问题:PHP RecentChange::notifyLog方法的具体用法?PHP RecentChange::notifyLog怎么用?PHP RecentChange::notifyLog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RecentChange的用法示例。


在下文中一共展示了RecentChange::notifyLog方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: saveContent

 /**
  * @return bool|int|null
  */
 protected function saveContent()
 {
     global $wgLogRestrictions;
     $dbw = wfGetDB(DB_MASTER);
     $log_id = $dbw->nextSequenceValue('logging_log_id_seq');
     $this->timestamp = $now = wfTimestampNow();
     $data = array('log_id' => $log_id, 'log_type' => $this->type, 'log_action' => $this->action, 'log_timestamp' => $dbw->timestamp($now), 'log_user' => $this->doer->getId(), 'log_user_text' => $this->doer->getName(), 'log_namespace' => $this->target->getNamespace(), 'log_title' => $this->target->getDBkey(), 'log_page' => $this->target->getArticleId(), 'log_comment' => $this->comment, 'log_params' => $this->params);
     $dbw->insert('logging', $data, __METHOD__);
     $newId = !is_null($log_id) ? $log_id : $dbw->insertId();
     # And update recentchanges
     if ($this->updateRecentChanges) {
         $titleObj = SpecialPage::getTitleFor('Log', $this->type);
         RecentChange::notifyLog($now, $titleObj, $this->doer, $this->getRcComment(), '', $this->type, $this->action, $this->target, $this->comment, $this->params, $newId);
     } elseif ($this->sendToUDP) {
         # Don't send private logs to UDP
         if (isset($wgLogRestrictions[$this->type]) && $wgLogRestrictions[$this->type] != '*') {
             return true;
         }
         # Notify external application via UDP.
         # We send this to IRC but do not want to add it the RC table.
         $titleObj = SpecialPage::getTitleFor('Log', $this->type);
         $rc = RecentChange::newLogEntry($now, $titleObj, $this->doer, $this->getRcComment(), '', $this->type, $this->action, $this->target, $this->comment, $this->params, $newId);
         $rc->notifyRC2UDP();
     }
     return $newId;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:29,代码来源:LogPage.php

示例2: saveContent

 function saveContent()
 {
     if (wfReadOnly()) {
         return false;
     }
     global $wgUser;
     $fname = 'LogPage::saveContent';
     $dbw =& wfGetDB(DB_MASTER);
     $uid = $wgUser->getID();
     $this->timestamp = $now = wfTimestampNow();
     $dbw->insert('logging', array('log_type' => $this->type, 'log_action' => $this->action, 'log_timestamp' => $dbw->timestamp($now), 'log_user' => $uid, 'log_namespace' => $this->target->getNamespace(), 'log_title' => $this->target->getDBkey(), 'log_comment' => $this->comment, 'log_params' => $this->params), $fname);
     # And update recentchanges
     if ($this->updateRecentChanges) {
         $titleObj = Title::makeTitle(NS_SPECIAL, 'Log/' . $this->type);
         $rcComment = $this->actionText;
         if ('' != $this->comment) {
             if ($rcComment == '') {
                 $rcComment = $this->comment;
             } else {
                 $rcComment .= ': ' . $this->comment;
             }
         }
         RecentChange::notifyLog($now, $titleObj, $wgUser, $rcComment, '', $this->type, $this->action, $this->target, $this->comment, $this->params);
     }
     return true;
 }
开发者ID:puring0815,项目名称:OpenKore,代码行数:26,代码来源:LogPage.php

示例3: saveContent

 function saveContent()
 {
     if (wfReadOnly()) {
         return false;
     }
     global $wgUser;
     $fname = 'LogPage::saveContent';
     $dbw = wfGetDB(DB_MASTER);
     $uid = $wgUser->getID();
     $log_id = $dbw->nextSequenceValue('log_log_id_seq');
     $this->timestamp = $now = wfTimestampNow();
     $data = array('log_type' => $this->type, 'log_action' => $this->action, 'log_timestamp' => $dbw->timestamp($now), 'log_user' => $uid, 'log_namespace' => $this->target->getNamespace(), 'log_title' => $this->target->getDBkey(), 'log_comment' => $this->comment, 'log_params' => $this->params);
     # log_id doesn't exist on Wikimedia servers yet, and it's a tricky
     # schema update to do. Hack it for now to ignore the field on MySQL.
     if (!is_null($log_id)) {
         $data['log_id'] = $log_id;
     }
     $dbw->insert('logging', $data, $fname);
     # And update recentchanges
     if ($this->updateRecentChanges) {
         $titleObj = SpecialPage::getTitleFor('Log', $this->type);
         $rcComment = $this->getRcComment();
         RecentChange::notifyLog($now, $titleObj, $wgUser, $rcComment, '', $this->type, $this->action, $this->target, $this->comment, $this->params);
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:26,代码来源:LogPage.php

示例4: saveContent

 protected function saveContent()
 {
     global $wgUser, $wgLogRestrictions;
     $fname = 'LogPage::saveContent';
     $dbw = wfGetDB(DB_MASTER);
     $log_id = $dbw->nextSequenceValue('log_log_id_seq');
     $this->timestamp = $now = wfTimestampNow();
     $data = array('log_id' => $log_id, 'log_type' => $this->type, 'log_action' => $this->action, 'log_timestamp' => $dbw->timestamp($now), 'log_user' => $this->doer->getId(), 'log_namespace' => $this->target->getNamespace(), 'log_title' => $this->target->getDBkey(), 'log_comment' => $this->comment, 'log_params' => $this->params);
     $dbw->insert('logging', $data, $fname);
     $newId = !is_null($log_id) ? $log_id : $dbw->insertId();
     if (!($dbw->affectedRows() > 0)) {
         wfDebugLog("logging", "LogPage::saveContent failed to insert row - Error {$dbw->lastErrno()}: {$dbw->lastError()}");
     }
     # And update recentchanges
     if ($this->updateRecentChanges) {
         # Don't add private logs to RC!
         if (!isset($wgLogRestrictions[$this->type]) || $wgLogRestrictions[$this->type] == '*') {
             $titleObj = SpecialPage::getTitleFor('Log', $this->type);
             $rcComment = $this->getRcComment();
             RecentChange::notifyLog($now, $titleObj, $this->doer, $rcComment, '', $this->type, $this->action, $this->target, $this->comment, $this->params, $newId);
         }
     }
     return true;
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:24,代码来源:LogPage.php

示例5: addLog

 /**
  * Add log to RecentChange
  * @param Title $title
  * @param string $action
  * @param string $reason
  */
 public function addLog($title, $action, $reason = '')
 {
     $user = $this->wg->User;
     RecentChange::notifyLog(wfTimestampNow(), $title, $user, '', '', RC_EDIT, $action, $title, $reason, '');
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:11,代码来源:LicensedVideoSwapHelper.class.php

示例6: customActionNotifyRC

 protected function customActionNotifyRC($user, $action, $reason)
 {
     $articleId = $this->getArticleId();
     $target = $this->getTitle();
     RecentChange::notifyLog(wfTimestampNow(), $target, $user, '', '', RC_EDIT, $action, $target, $reason, '', 0);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:6,代码来源:WallMessage.class.php

示例7: doMerge


//.........这里部分代码省略.........
                 } else {
                     $this->addFamilyMembersToRequestData($requestData, $mergingPeople, 'husband', $husbandCount, $this->data[$m][$p]['husbands']);
                     $this->addFamilyMembersToRequestData($requestData, $mergingPeople, 'wife', $wifeCount, $this->data[$m][$p]['wives']);
                     $this->addFamilyMembersToRequestData($requestData, $mergingPeople, 'child', $childrenCount, $this->data[$m][$p]['children']);
                 }
                 $pageContents = $this->mapContents($sourcesMap[$p], $imagesMap[$p], $notesMap[$p], $this->data[$m][$p]['contents']);
                 $this->addContents($contents, $keepKeys[$p], $pageContents);
                 if ($p > 0) {
                     if ($mergeSummary) {
                         $mergeSummary .= ', ';
                     }
                     if ($mainOutput) {
                         $mainOutput .= ', ';
                     }
                     if ($this->data[$m][$p]['gedcom']) {
                         $mergeSummary .= 'gedcom';
                         $mainOutput .= htmlspecialchars(($mergeTargetNs == NS_FAMILY ? 'Family:' : 'Person:') . $this->data[$m][$p]['title']);
                     } else {
                         $title = Title::newFromText($this->data[$m][$p]['title'], $mergeTargetNs);
                         $mergeSummary .= "[[" . $title->getPrefixedText() . "]]";
                         $mainOutput .= $skin->makeKnownLinkObj($title, htmlspecialchars($title->getPrefixedText()), 'redirect=no');
                     }
                 }
             }
         }
         // redirect other pages to merge target
         $redir = "#REDIRECT [[" . $mergeTargetTitle->getPrefixedText() . "]]";
         $talkRedir = "#REDIRECT [[" . $mergeTargetTalkTitle->getPrefixedText() . "]]";
         for ($p = 1; $p < count($this->data[$m]); $p++) {
             if (!$this->data[$m][$p]['gedcom']) {
                 $obj = $this->data[$m][$p]['object'];
                 $comment = $this->makeComment($this->userComment, "merge into [[" . $mergeTargetTitle->getPrefixedText() . "]]" . $mergeCmtFamily, $mergeCmtSuffix);
                 $obj->editPage($emptyRequest, $redir, $comment, $editFlags, false);
                 // redir talk page as well
                 if ($this->data[$m][$p]['talkrevid']) {
                     // if talk page exists
                     $talkTitle = Title::newFromText($this->data[$m][$p]['title'], $mergeTargetTalkNs);
                     $article = new Article($talkTitle, 0);
                     if ($article) {
                         $this->addTalkContents($talkContents, $talkTitle, $article->fetchContent());
                         if ($talkMergeSummary) {
                             $talkMergeSummary .= ', ';
                         }
                         if ($talkOutput) {
                             $talkOutput .= ', ';
                         }
                         $talkMergeSummary .= "[[" . $talkTitle->getPrefixedText() . "]]";
                         $talkOutput .= $skin->makeKnownLinkObj($talkTitle, htmlspecialchars($talkTitle->getPrefixedText()), 'redirect=no');
                         $comment = $this->makeComment($this->userComment, "merge into [[" . $mergeTargetTalkTitle->getPrefixedText() . "]]" . $mergeCmtFamily, $mergeCmtSuffix);
                         $article->doEdit($talkRedir, $comment, $editFlags);
                     }
                 }
             }
         }
         // update merge target talk
         if ($talkContents) {
             $article = new Article($mergeTargetTalkTitle, 0);
             if ($article) {
                 $mergeTargetTalkContents = $article->fetchContent();
                 if ($mergeTargetTalkContents) {
                     $mergeTargetTalkContents = rtrim($mergeTargetTalkContents) . "\n\n";
                 }
                 $comment = $this->makeComment($this->userComment, 'merged with ' . $talkMergeSummary . $mergeCmtFamily, $mergeCmtSuffix);
                 $article->doEdit($mergeTargetTalkContents . $talkContents, $comment, $editFlags);
                 if ($this->addWatches) {
                     StructuredData::addWatch($wgUser, $article, true);
                 }
             }
             $outputRow .= '<li>Merged ' . $talkOutput . ' into ' . $skin->makeKnownLinkObj($mergeTargetTalkTitle, htmlspecialchars($mergeTargetTalkTitle->getPrefixedText())) . "</li>";
         }
         $obj = $this->data[$m][0]['object'];
         if ($mergeTargetNs == NS_PERSON) {
             Person::addGenderToRequestData($requestData, $this->data[$m][0]['gender']);
         } else {
             // family
             $obj->isMerging(true);
             // to read propagated data from person pages, not from prev family revision
         }
         // update merge target
         $req = new FauxRequest($requestData, true);
         $comment = $this->makeComment($this->userComment, ($mergeSummary == 'gedcom' ? 'Add data from gedcom' : 'merged with ' . $mergeSummary) . $mergeCmtFamily, $mergeCmtSuffix);
         $obj->editPage($req, $contents, $comment, $editFlags, $this->addWatches);
         $outputRow .= '<li>Merged ' . $mainOutput . ' into ' . $skin->makeKnownLinkObj($mergeTargetTitle, htmlspecialchars($mergeTargetTitle->getPrefixedText())) . "</li>";
         $outputRows[] = $outputRow;
     }
     // add log and recent changes
     if (!$this->isGedcom()) {
         if (!$mergeSummary) {
             $mergeSummary = 'members of other families';
         }
         $mergeComment = 'Merge [[' . $mergeTargetTitle->getPrefixedText() . ']] and ' . $mergeSummary;
         $log = new LogPage('merge', false);
         $t = Title::makeTitle(NS_SPECIAL, "ReviewMerge/{$mergeLogId}");
         $log->addEntry('merge', $t, $mergeComment);
         RecentChange::notifyLog(wfTimestampNow(), $t, $wgUser, $mergeComment, '', 'merge', 'merge', $t->getPrefixedText(), $mergeComment, '', $isTrustedMerge, 0);
     }
     $nonmergedPages = $this->getNonmergedPages();
     $output .= join("\n", array_reverse($outputRows)) . '</ul>' . ($nonmergedPages ? '<p>In addition to the people listed above, the following have also been included in the target family' . ($this->isGedcom() ? '<br/>(GEDCOM people listed will be added when the GEDCOM is imported)' : '') . $nonmergedPages . "</p>\n" : '') . ($this->isGedcom() ? '' : '<p>' . $skin->makeKnownLinkObj(Title::makeTitle(NS_SPECIAL, 'ReviewMerge/' . $mergeLogId), htmlspecialchars("Review/undo merge")) . '<br>' . $skin->makeKnownLinkObj(Title::makeTitle(NS_SPECIAL, 'ShowDuplicates'), htmlspecialchars("Show more duplicates")) . '</p>');
     return $output;
 }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:101,代码来源:SpecialMerge.php

示例8: unmerge

    public function unmerge()
    {
        global $wgUser;
        $nonFamilyPages = array();
        // contains revid, next_revid, title
        $familyPages = array();
        // ditto
        $manualPages = array();
        // ditto
        $unchangedPages = array();
        // ditto
        $dbw =& wfGetDB(DB_MASTER);
        // break into different arrays
        $seenTitles = array();
        foreach ($this->merges as $merge) {
            $fields = explode('|', $merge);
            $role = $fields[0];
            $revidSets = explode('#', $fields[1]);
            foreach ($revidSets as $revidSet) {
                if ($revidSet) {
                    $revids = explode('/', $revidSet);
                    foreach ($revids as $revid) {
                        if ($revid) {
                            // get two following revisions
                            $rows = $dbw->query('SELECT r2.rev_page, r2.rev_id, r2.rev_comment FROM revision AS r1, revision AS r2' . ' WHERE r1.rev_id = ' . $revid . ' AND r1.rev_page = r2.rev_page AND r2.rev_id > ' . $revid . ' ORDER BY r2.rev_id LIMIT 2');
                            $cnt = 0;
                            $cmt = '';
                            $nextRevid = '';
                            $pageId = '';
                            while ($row = $dbw->fetchObject($rows)) {
                                $cnt++;
                                if ($cnt == 1) {
                                    $pageId = $row->rev_page;
                                    $nextRevid = $row->rev_id;
                                    $cmt = $row->rev_comment;
                                }
                            }
                            $dbw->freeResult($rows);
                            if ($cnt == 0) {
                                $revision = Revision::newFromId($revid);
                                if ($revision) {
                                    $title = $revision->getTitle();
                                } else {
                                    // page must have been deleted
                                    $title = null;
                                }
                            } else {
                                $title = Title::newFromId($pageId);
                            }
                            // TODO if title doesn't exist, then unmerged pages could have red links; oh well
                            if ($title && !@$seenTitles[$title->getPrefixedText()]) {
                                $seenTitles[$title->getPrefixedText()] = 1;
                                $entry = array('revid' => $revid, 'next_revid' => $nextRevid, 'title' => $title);
                                if ($cnt == 0 || strpos($cmt, '[[Special:ReviewMerge/' . $this->mergeId . '|') === false) {
                                    $unchangedPages[] = $entry;
                                    // page was not edited in the merge
                                } else {
                                    if ($cnt > 1) {
                                        $manualPages[] = $entry;
                                    } else {
                                        if ($role == 'Family') {
                                            PropagationManager::addBlacklistPage($title);
                                            $familyPages[] = $entry;
                                        } else {
                                            PropagationManager::addBlacklistPage($title);
                                            $nonFamilyPages[] = $entry;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        // update nonFamilyPages
        foreach ($nonFamilyPages as $page) {
            $this->revert($page, false);
        }
        // update familyPages
        foreach ($familyPages as $page) {
            $this->revert($page, true);
        }
        // update mergelog
        $dbw->update('mergelog', array('ml_unmerge_user' => $wgUser->getID(), 'ml_unmerge_timestamp' => $dbw->timestamp(wfTimestampNow())), array('ml_id' => $this->mergeId), 'ReviewForm::unmerge');
        // add log and RC
        $mergeComment = 'Unmerge [[' . $this->mergeTitle->getPrefixedText() . ']]' . ($this->comment ? ' - ' . $this->comment : '');
        $log = new LogPage('merge', false);
        $t = Title::makeTitle(NS_SPECIAL, "ReviewMerge/{$this->mergeId}");
        $log->addEntry('unmerge', $t, $mergeComment);
        RecentChange::notifyLog(wfTimestampNow(), $t, $wgUser, $mergeComment, '', 'merge', 'unmerge', $t->getPrefixedText(), $mergeComment, '', 0, 0);
        // list pages
        $output = '';
        $skin =& $wgUser->getSkin();
        if (count($manualPages) == 0) {
            $output .= "<h2>Unmerge successful</h2>\n";
        } else {
            $output .= "<h2>Unmerge partially completed</h2><p><b><font color=\"red\">The following page(s) must still be unmerged</font></b></p><ul>";
            foreach ($manualPages as $page) {
                $output .= "<li>" . htmlspecialchars($page['title']->getPrefixedText()) . ' <b>' . $skin->makeKnownLinkObj($page['title'], 'changes to undo', 'diff=' . $page['next_revid'] . '&oldid=' . $page['revid']) . '</b> &nbsp;=>&nbsp; <b>' . $skin->makeKnownLinkObj($page['title'], 'edit', 'action=edit') . "</b></li>\n";
//.........这里部分代码省略.........
开发者ID:k-hasan-19,项目名称:wiki,代码行数:101,代码来源:SpecialReviewMerge.php


注:本文中的RecentChange::notifyLog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。