本文整理汇总了PHP中RecentChange::newLogEntry方法的典型用法代码示例。如果您正苦于以下问题:PHP RecentChange::newLogEntry方法的具体用法?PHP RecentChange::newLogEntry怎么用?PHP RecentChange::newLogEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RecentChange
的用法示例。
在下文中一共展示了RecentChange::newLogEntry方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveContent
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);
} else {
if ($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;
}
示例2: getRecentChange
/**
* Get a RecentChanges object for the log entry
* @param int $newId
* @return RecentChange
* @since 1.23
*/
public function getRecentChange($newId = 0)
{
$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();
}
}
return RecentChange::newLogEntry($this->getTimestamp(), $logpage, $user, $formatter->getPlainActionText(), $ip, $this->getType(), $this->getSubtype(), $this->getTarget(), $this->getComment(), LogEntryBase::makeParamBlob($this->getParameters()), $newId, $formatter->getIRCActionComment());
}
示例3: publish
/**
* 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();
}
}
示例4: publish
/**
* 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();
}
}