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


PHP ManualLogEntry::setParameters方法代码示例

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


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

示例1: executeRejectAll

 public function executeRejectAll()
 {
     $out = $this->mSpecial->getOutput();
     $userpage = $this->mSpecial->getUserpageByModId($this->id);
     if (!$userpage) {
         throw new ModerationError('moderation-edit-not-found');
     }
     $dbw = wfGetDB(DB_MASTER);
     # Need latest data without lag
     $res = $dbw->select('moderation', array('mod_id AS id'), array('mod_user_text' => $userpage->getText(), 'mod_rejected' => 0, 'mod_merged_revid' => 0), __METHOD__, array('USE INDEX' => 'moderation_rejectall'));
     if (!$res || $res->numRows() == 0) {
         throw new ModerationError('moderation-nothing-to-rejectall');
     }
     $ids = array();
     foreach ($res as $row) {
         $ids[] = $row->id;
     }
     $dbw->update('moderation', array('mod_rejected' => 1, 'mod_rejected_by_user' => $this->moderator->getId(), 'mod_rejected_by_user_text' => $this->moderator->getName(), 'mod_rejected_batch' => 1, 'mod_preloadable' => 0), array('mod_id' => $ids), __METHOD__);
     $nrows = $dbw->affectedRows();
     if ($nrows) {
         $logEntry = new ManualLogEntry('moderation', 'rejectall');
         $logEntry->setPerformer($this->moderator);
         $logEntry->setTarget($userpage);
         $logEntry->setParameters(array('4::count' => $nrows));
         $logid = $logEntry->insert();
         $logEntry->publish($logid);
     }
     $out->addWikiMsg('moderation-rejected-ok', $nrows);
 }
开发者ID:ATCARES,项目名称:mediawiki-moderation,代码行数:29,代码来源:ModerationActionReject.php

示例2: record

 /**
  * Record a log event for a change being patrolled
  *
  * @param mixed $rc Change identifier or RecentChange object
  * @param bool $auto Was this patrol event automatic?
  * @param User $user User performing the action or null to use $wgUser
  *
  * @return bool
  */
 public static function record($rc, $auto = false, User $user = null)
 {
     global $wgLogAutopatrol;
     // do not log autopatrolled edits if setting disables it
     if ($auto && !$wgLogAutopatrol) {
         return false;
     }
     if (!$rc instanceof RecentChange) {
         $rc = RecentChange::newFromId($rc);
         if (!is_object($rc)) {
             return false;
         }
     }
     if (!$user) {
         global $wgUser;
         $user = $wgUser;
     }
     $entry = new ManualLogEntry('patrol', 'patrol');
     $entry->setTarget($rc->getTitle());
     $entry->setParameters(self::buildParams($rc, $auto));
     $entry->setPerformer($user);
     $logid = $entry->insert();
     if (!$auto) {
         $entry->publish($logid, 'udp');
     }
     return true;
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:36,代码来源:PatrolLog.php

示例3: logTagAdded

 protected function logTagAdded($tags, $revId, $user, $reason)
 {
     // log it
     $logEntry = new ManualLogEntry('tag', 'update');
     $logEntry->setPerformer($user);
     $logEntry->setComment($reason);
     // find the appropriate target page
     if ($revId) {
         $rev = Revision::newFromId($revId);
         if ($rev) {
             $logEntry->setTarget($rev->getTitle());
         }
     }
     if (!$logEntry->getTarget()) {
         // target is required, so we have to set something
         $logEntry->setTarget(SpecialPage::getTitleFor('Tags'));
     }
     $logParams = array('4::revid' => $revId, '6:list:tagsAdded' => $tags, '7:number:tagsAddedCount' => count($tags));
     $logEntry->setParameters($logParams);
     $logEntry->setRelations(array('Tag' => $tags));
     $dbw = wfGetDB(DB_MASTER);
     $logId = $logEntry->insert($dbw);
     // Only send this to UDP, not RC, similar to patrol events
     $logEntry->publish($logId, 'udp');
     //$logEntry->publish( $logId );
 }
开发者ID:kolzchut,项目名称:mediawiki-extensions-MarkMajorChanges,代码行数:26,代码来源:MarkMajorChangeAction.php

示例4: onSubmit

 public function onSubmit(array $formData)
 {
     global $IP, $wgCreateWikiSQLfiles;
     $DBname = $formData['dbname'];
     $founderName = $formData['founder'];
     $siteName = $formData['sitename'];
     $language = $formData['language'];
     $private = $formData['private'];
     $reason = $formData['reason'];
     $dbw = wfGetDB(DB_MASTER);
     $farmerLogEntry = new ManualLogEntry('farmer', 'createwiki');
     $farmerLogEntry->setPerformer($this->getUser());
     $farmerLogEntry->setTarget($this->getTitle());
     $farmerLogEntry->setComment($reason);
     $farmerLogEntry->setParameters(array('4::wiki' => $DBname));
     $farmerLogID = $farmerLogEntry->insert();
     $farmerLogEntry->publish($farmerLogID);
     $dbw->query('SET storage_engine=InnoDB;');
     $dbw->query('CREATE DATABASE ' . $dbw->addIdentifierQuotes($DBname) . ';');
     $dbw->selectDB($DBname);
     foreach ($wgCreateWikiSQLfiles as $sqlfile) {
         $dbw->sourceFile($sqlfile);
     }
     $this->writeToDBlist($DBname, $siteName, $language, $private);
     $this->createMainPage($language);
     $shcreateaccount = exec("/usr/bin/php " . "{$IP}/extensions/CentralAuth/maintenance/createLocalAccount.php " . wfEscapeShellArg($founderName) . " --wiki " . wfEscapeShellArg($DBname));
     if (!strpos($shcreateaccount, 'created')) {
         wfDebugLog('CreateWiki', 'Failed to create local account for founder. - error: ' . $shcreateaccount);
         return wfMessage('createwiki-error-usernotcreated')->escaped();
     }
     $shpromoteaccount = exec("/usr/bin/php " . "{$IP}/maintenance/createAndPromote.php " . wfEscapeShellArg($founderName) . " --bureaucrat --sysop --force --wiki " . wfEscapeShellArg($DBname));
     $this->getOutput()->addHTML('<div class="successbox">' . wfMessage('createwiki-success')->escaped() . '</div>');
     return true;
 }
开发者ID:reviforks,项目名称:miraheze-cw,代码行数:34,代码来源:SpecialCreateWiki.php

示例5: newLogEntry

 public function newLogEntry($action, $params)
 {
     $logEntry = new ManualLogEntry('phpunit', $action);
     $logEntry->setPerformer($this->user);
     $logEntry->setTarget($this->title);
     $logEntry->setComment('A very good reason');
     $logEntry->setParameters($params);
     return $logEntry;
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:9,代码来源:LogFormatterTest.php

示例6: logPromotion

 /**
  * Log the promotion of a local unattached to a global
  *
  * @param string $oldName
  * @param string $wiki
  * @param string $newName
  * @param string $reason
  */
 public function logPromotion($oldName, $wiki, $newName, $reason)
 {
     $logEntry = new ManualLogEntry('gblrename', 'promote');
     $logEntry->setPerformer($this->performingUser);
     $logEntry->setTarget(Title::makeTitleSafe(NS_SPECIAL, 'CentralAuth/' . $newName));
     $logEntry->setComment($reason);
     $logEntry->setParameters(array('4::olduser' => $oldName, '5::newuser' => $newName, '6::oldwiki' => $wiki));
     $logEntry->setRelations(array('oldname' => $oldName));
     $logid = $logEntry->insert();
     $logEntry->publish($logid);
 }
开发者ID:NDKilla,项目名称:mediawiki-extensions-CentralAuth,代码行数:19,代码来源:GlobalRenameUserLogger.php

示例7: log

 /**
  * @param CentralAuthUser[] $oldNames
  * @param string $newName
  * @param string $reason
  */
 public function log(array $oldNames, $newName, $reason)
 {
     $logEntry = new ManualLogEntry('gblrename', 'merge');
     $logEntry->setPerformer($this->performingUser);
     $logEntry->setTarget(Title::makeTitleSafe(NS_SPECIAL, 'CentralAuth/' . $newName));
     $imploded = implode('|', array_map(function (CentralAuthUser $user) {
         return $user->getName();
     }, $oldNames));
     $logEntry->setComment($reason);
     $logEntry->setParameters(array('4::olduser' => $imploded, '5::newuser' => $newName));
     $logid = $logEntry->insert();
     $logEntry->publish($logid);
 }
开发者ID:NDKilla,项目名称:mediawiki-extensions-CentralAuth,代码行数:18,代码来源:GlobalUserMergeLogger.php

示例8: addLogEntry

 /**
  * adds a log entry to the database.
  *
  * @param $type string: type of the log entry
  * @param $subtype string: subtype of the log entry
  * @param $user User: user that performs the logged operation
  * @param $ns int: number of the namespace for the entry's target's title
  * @param $title string: title of the entry's target
  * @param $comment string: comment of the log entry
  * @param $parameters Array: (optional) accompanying data that is attached
  *               to the entry
  *
  * @return int id of the added log entry
  */
 private function addLogEntry($type, $subtype, User $user, $ns, $title, $comment = null, $parameters = null)
 {
     $logEntry = new ManualLogEntry($type, $subtype);
     $logEntry->setPerformer($user);
     $logEntry->setTarget(Title::newFromText($title, $ns));
     if ($comment !== null) {
         $logEntry->setComment($comment);
     }
     if ($parameters !== null) {
         $logEntry->setParameters($parameters);
     }
     return $logEntry->insert();
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:27,代码来源:backup_LogTest.php

示例9: run

 function run()
 {
     // Unfortunately the global is needed until bug is fixed:
     // https://phabricator.wikimedia.org/T51086
     // Once MW >= 1.24 is supported, can use MovePage class.
     global $wgUser;
     // Initialization
     $title = $this->title;
     // Other stuff
     $user = $this->getUser();
     $summary = $this->getSummary();
     $target = $this->getTarget();
     $base = $this->params['base-source'];
     $doer = User::newFromName($this->getPerformer());
     PageTranslationHooks::$allowTargetEdit = true;
     PageTranslationHooks::$jobQueueRunning = true;
     $oldUser = $wgUser;
     $wgUser = $user;
     self::forceRedirects(false);
     // Don't check perms, don't leave a redirect
     $ok = $title->moveTo($target, false, $summary, false);
     if (!$ok) {
         $params = array('target' => $target->getPrefixedText(), 'error' => $ok);
         $entry = new ManualLogEntry('pagetranslation', 'movenok');
         $entry->setPerformer($doer);
         $entry->setTarget($title);
         $entry->setParameters($params);
         $logid = $entry->insert();
         $entry->publish($logid);
     }
     self::forceRedirects(true);
     PageTranslationHooks::$allowTargetEdit = false;
     $this->unlock();
     $cache = wfGetCache(CACHE_ANYTHING);
     $key = wfMemcKey('translate-pt-move', $base);
     $count = $cache->decr($key);
     $last = strval($count) === '0';
     if ($last) {
         $cache->delete($key);
         $params = array('target' => $this->params['base-target']);
         $entry = new ManualLogEntry('pagetranslation', 'moveok');
         $entry->setPerformer($doer);
         $entry->setParameters($params);
         $entry->setTarget(Title::newFromText($base));
         $logid = $entry->insert();
         $entry->publish($logid);
         PageTranslationHooks::$jobQueueRunning = false;
     }
     $wgUser = $oldUser;
     return true;
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:51,代码来源:TranslateMoveJob.php

示例10: newLogEntry

 /**
  * Create new Log entry
  *
  * @param string $action Action name as defined above
  * @param integer $mapId Map id
  * @param string $comment Comment
  * @param array $params Additional params
  * @return ManualLogEntry
  */
 public static function newLogEntry($action, $user, $mapId, $comment, $params = [])
 {
     $logEntry = new ManualLogEntry(self::LOG_TYPE_NAME, $action);
     $logEntry->setPerformer($user);
     $logEntry->setTarget(SpecialPage::getTitleFor(WikiaMapsSpecialController::PAGE_NAME, $mapId));
     $logEntry->setComment($comment);
     if (!empty($params)) {
         // we can't allow to pass those elements
         // more info: https://www.mediawiki.org/wiki/Manual:Logging_to_Special:Log#1.19_and_later
         unset($params[1], $params[2], $params[3]);
         $logEntry->setParameters($params);
     }
     return $logEntry;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:23,代码来源:WikiaMapsLogger.class.php

示例11: log

 /**
  * Create a log entry using the provided info.
  * Takes care about the logging interface changes in MediaWiki 1.19.
  * 
  * @since 0.1
  * 
  * @param array $info
  */
 public static function log(array $info)
 {
     $user = array_key_exists('user', $info) ? $info['user'] : $GLOBALS['wgUser'];
     $logEntry = new ManualLogEntry($info['type'], $info['subtype']);
     $logEntry->setPerformer($user);
     $logEntry->setTarget($info['title']);
     if (array_key_exists('comment', $info)) {
         $logEntry->setComment($info['comment']);
     }
     if (array_key_exists('parameters', $info)) {
         $logEntry->setParameters($info['parameters']);
     }
     $logid = $logEntry->insert();
     $logEntry->publish($logid);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:23,代码来源:EPUtils.php

示例12: run

 function run()
 {
     // Initialization
     $title = $this->title;
     // Other stuff
     $user = $this->getUser();
     $summary = $this->getSummary();
     $base = $this->getBase();
     $doer = User::newFromName($this->getPerformer());
     PageTranslationHooks::$allowTargetEdit = true;
     $error = '';
     $wikipage = new WikiPage($title);
     $ok = $wikipage->doDeleteArticle($summary, false, 0, true, $error, $user);
     if (!$ok) {
         $params = array('target' => $base, 'error' => $ok);
         $type = $this->getFull() ? 'deletefnok' : 'deletelnok';
         $entry = new ManualLogEntry('pagetranslation', $type);
         $entry->setPerformer($doer);
         $entry->setTarget($title);
         $entry->setParameters($params);
         $logid = $entry->insert();
         $entry->publish($logid);
     }
     PageTranslationHooks::$allowTargetEdit = false;
     $cache = wfGetCache(CACHE_DB);
     $pages = (array) $cache->get(wfMemcKey('pt-base', $base));
     $lastitem = array_pop($pages);
     if ($title->getPrefixedText() === $lastitem) {
         $cache->delete(wfMemcKey('pt-base', $base));
         $type = $this->getFull() ? 'deletefok' : 'deletelok';
         $entry = new ManualLogEntry('pagetranslation', $type);
         $entry->setPerformer($doer);
         $entry->setTarget(Title::newFromText($base));
         $logid = $entry->insert();
         $entry->publish($logid);
         $tpage = TranslatablePage::newFromTitle($title);
         $tpage->getTranslationPercentages(true);
         foreach ($tpage->getTranslationPages() as $page) {
             $page->invalidateCache();
         }
         $title->invalidateCache();
     }
     return true;
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:44,代码来源:TranslateDeleteJob.php

示例13: onSubmitInput

 function onSubmitInput(array $params)
 {
     if (!$this->getUser()->isAllowed('managewiki')) {
         throw new MWException("User '{$this->getUser()->getName()}' without managewiki right tried to change wiki settings!");
     }
     $values = array('wiki_sitename' => $params['sitename'], 'wiki_language' => $params['language'], 'wiki_closed' => $params['closed'] == true ? 1 : 0);
     if ($this->getUser()->isAllowed('managewiki-restricted')) {
         $values['wiki_private'] = $params['private'] == true ? 1 : 0;
     }
     $dbw = wfGetDB(DB_MASTER);
     $dbw->update('cw_wikis', $values, array('wiki_dbname' => $params['dbname']), __METHOD__);
     $farmerLogEntry = new ManualLogEntry('farmer', 'managewiki');
     $farmerLogEntry->setPerformer($this->getUser());
     $farmerLogEntry->setTarget($this->getTitle());
     $farmerLogEntry->setComment($params['reason']);
     $farmerLogEntry->setParameters(array('4::wiki' => $params['dbname']));
     $farmerLogID = $farmerLogEntry->insert();
     $farmerLogEntry->publish($farmerLogID);
     $this->getOutput()->addHTML('<div class="successbox">' . wfMessage('managewiki-success')->escaped() . '</div>');
     return true;
 }
开发者ID:Reception123,项目名称:CreateWiki,代码行数:21,代码来源:SpecialManageWiki.php

示例14: changeState

 public static function changeState(MessageGroup $group, $code, $newState, User $user)
 {
     $currentState = self::getState($group, $code);
     if ($currentState === $newState) {
         return false;
     }
     $table = 'translate_groupreviews';
     $index = array('tgr_group', 'tgr_language');
     $row = array('tgr_group' => $group->getId(), 'tgr_lang' => $code, 'tgr_state' => $newState);
     $dbw = wfGetDB(DB_MASTER);
     $dbw->replace($table, array($index), $row, __METHOD__);
     $entry = new ManualLogEntry('translationreview', 'group');
     $entry->setPerformer($user);
     $entry->setTarget(SpecialPage::getTitleFor('Translate', $group->getId()));
     // @todo
     // $entry->setComment( $comment );
     $entry->setParameters(array('4::language' => $code, '5::group-label' => $group->getLabel(), '6::old-state' => $currentState, '7::new-state' => $newState));
     $logid = $entry->insert();
     $entry->publish($logid);
     Hooks::run('TranslateEventMessageGroupStateChange', array($group, $code, $currentState, $newState));
     return true;
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:22,代码来源:ApiGroupReview.php

示例15: doImport

 private function doImport(array $json)
 {
     global $wgTriggerFlowThreadHooks;
     $wgTriggerFlowThreadHooks = false;
     $output = $this->getOutput();
     foreach ($json as $articles) {
         $title = \Title::newFromText($articles->title);
         $count = count($articles->posts);
         $skipped = 0;
         // Skip non-existent title
         if ($title === null || !$title->exists()) {
             $output->addWikiMsg('flowthreadimport-failed', $articles->title, $count);
             continue;
         }
         $titleId = $title->getArticleID();
         foreach ($articles->posts as $postJson) {
             $data = array('id' => UUID::fromHex($postJson->id), 'pageid' => $titleId, 'userid' => $postJson->userid, 'username' => $postJson->username, 'text' => $postJson->text, 'parentid' => $postJson->parentid ? UUID::fromHex($postJson->parentid) : null, 'status' => $postJson->status, 'like' => 0, 'report' => 0);
             $postObject = new Post($data);
             try {
                 $postObject->post();
             } catch (\Exception $ex) {
                 $count--;
                 $skipped++;
             }
         }
         if ($count) {
             $logEntry = new \ManualLogEntry('comments', 'import');
             $logEntry->setPerformer($this->getUser());
             $logEntry->setTarget($title);
             $logEntry->setParameters(array('4::count' => $count));
             $logId = $logEntry->insert();
             $logEntry->publish($logId, 'udp');
             $output->addWikiMsg('flowthreadimport-success', $articles->title, $count);
         }
         if ($skipped) {
             $output->addWikiMsg('flowthreadimport-skipped', $articles->title, $skipped);
         }
     }
 }
开发者ID:nbdd0121,项目名称:MW-FlowThread,代码行数:39,代码来源:Import.php


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