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


PHP ManualLogEntry::setLegacy方法代码示例

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


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

示例1: addEntry

 /**
  * Add a log entry
  *
  * @param string $action One of '', 'block', 'protect', 'rights', 'delete',
  *   'upload', 'move', 'move_redir'
  * @param Title $target Title object
  * @param string $comment Description associated
  * @param array $params Parameters passed later to wfMessage function
  * @param null|int|User $doer The user doing the action. null for $wgUser
  *
  * @return int The log_id of the inserted log entry
  */
 public function addEntry($action, $target, $comment, $params = array(), $doer = null)
 {
     global $wgContLang;
     if (!is_array($params)) {
         $params = array($params);
     }
     if ($comment === null) {
         $comment = '';
     }
     # Trim spaces on user supplied text
     $comment = trim($comment);
     # Truncate for whole multibyte characters.
     $comment = $wgContLang->truncate($comment, 255);
     $this->action = $action;
     $this->target = $target;
     $this->comment = $comment;
     $this->params = LogPage::makeParamBlob($params);
     if ($doer === null) {
         global $wgUser;
         $doer = $wgUser;
     } elseif (!is_object($doer)) {
         $doer = User::newFromId($doer);
     }
     $this->doer = $doer;
     $logEntry = new ManualLogEntry($this->type, $action);
     $logEntry->setTarget($target);
     $logEntry->setPerformer($doer);
     $logEntry->setParameters($params);
     // All log entries using the LogPage to insert into the logging table
     // are using the old logging system and therefore the legacy flag is
     // needed to say the LogFormatter the parameters have numeric keys
     $logEntry->setLegacy(true);
     $formatter = LogFormatter::newFromEntry($logEntry);
     $context = RequestContext::newExtraneousContext($target);
     $formatter->setContext($context);
     $this->actionText = $formatter->getPlainActionText();
     $this->ircActionText = $formatter->getIRCActionText();
     return $this->saveContent();
 }
开发者ID:T282,项目名称:mediawiki,代码行数:51,代码来源:LogPage.php

示例2: addLogParams

 /**
  * @deprecated since 1.25 Use LogFormatter::formatParametersForApi instead
  * @param ApiResult $result
  * @param array $vals
  * @param string $params
  * @param string $type
  * @param string $action
  * @param string $ts
  * @param bool $legacy
  * @return array
  */
 public static function addLogParams($result, &$vals, $params, $type, $action, $ts, $legacy = false)
 {
     wfDeprecated(__METHOD__, '1.25');
     $entry = new ManualLogEntry($type, $action);
     $entry->setParameters($params);
     $entry->setTimestamp($ts);
     $entry->setLegacy($legacy);
     $formatter = LogFormatter::newFromEntry($entry);
     $vals['params'] = $formatter->formatParametersForApi();
     return $vals;
 }
开发者ID:Acidburn0zzz,项目名称:mediawiki,代码行数:22,代码来源:ApiQueryLogEvents.php

示例3: assertIRCComment

 /**
  * @param string $expected Expected IRC text without colors codes
  * @param string $type Log type (move, delete, suppress, patrol ...)
  * @param string $action A log type action
  * @param array $params
  * @param string $comment (optional) A comment for the log action
  * @param string $msg (optional) A message for PHPUnit :-)
  */
 protected function assertIRCComment($expected, $type, $action, $params, $comment = null, $msg = '', $legacy = false)
 {
     $logEntry = new ManualLogEntry($type, $action);
     $logEntry->setPerformer($this->user);
     $logEntry->setTarget($this->title);
     if ($comment !== null) {
         $logEntry->setComment($comment);
     }
     $logEntry->setParameters($params);
     $logEntry->setLegacy($legacy);
     $formatter = LogFormatter::newFromEntry($logEntry);
     $formatter->setContext($this->context);
     // Apply the same transformation as done in IRCColourfulRCFeedFormatter::getLine for rc_comment
     $ircRcComment = IRCColourfulRCFeedFormatter::cleanupForIRC($formatter->getIRCActionComment());
     $this->assertEquals($expected, $ircRcComment, $msg);
 }
开发者ID:natebrunette,项目名称:sphericalcow,代码行数:24,代码来源:RecentChangeTest.php


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