• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ManualLogEntry类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: execute

 public function execute()
 {
     $out = $this->mSpecial->getOutput();
     $dbw = wfGetDB(DB_MASTER);
     $row = $dbw->selectRow('moderation', array('mod_user AS user', 'mod_user_text AS user_text'), array('mod_id' => $this->id), __METHOD__);
     if (!$row) {
         throw new ModerationError('moderation-edit-not-found');
     }
     $dbw = wfGetDB(DB_MASTER);
     if ($this->actionName == 'block') {
         $dbw->replace('moderation_block', array('mb_address'), array('mb_address' => $row->user_text, 'mb_user' => $row->user, 'mb_by' => $this->moderator->getId(), 'mb_by_text' => $this->moderator->getName(), 'mb_timestamp' => $dbw->timestamp(wfTimestampNow())), __METHOD__);
         $logEntry = new ManualLogEntry('moderation', 'block');
     } else {
         $dbw->delete('moderation_block', array('mb_address' => $row->user_text), __METHOD__);
         $logEntry = new ManualLogEntry('moderation', 'unblock');
     }
     $nrows = $dbw->affectedRows();
     if ($nrows > 0) {
         $logEntry->setPerformer($this->moderator);
         $logEntry->setTarget(Title::makeTitle(NS_USER, $row->user_text));
         $logid = $logEntry->insert();
         $logEntry->publish($logid);
     }
     $out->addWikiMsg('moderation-' . ($this->actionName == 'unblock' ? 'un' : '') . 'block-' . ($nrows ? 'ok' : 'fail'), $row->user_text);
 }
开发者ID:ATCARES,项目名称:mediawiki-moderation,代码行数:25,代码来源:ModerationActionBlock.php


示例2: processUpload

 private function processUpload()
 {
     $request = $this->getRequest();
     $dataurl = $request->getVal('avatar');
     if (!$dataurl || parse_url($dataurl, PHP_URL_SCHEME) !== 'data') {
         $this->displayMessage($this->msg('avatar-notuploaded'));
         return false;
     }
     $img = Thumbnail::open($dataurl);
     global $wgMaxAvatarResolution;
     switch ($img->type) {
         case IMAGETYPE_GIF:
         case IMAGETYPE_PNG:
         case IMAGETYPE_JPEG:
             break;
         default:
             $this->displayMessage($this->msg('avatar-invalid'));
             return false;
     }
     // Must be square
     if ($img->width !== $img->height) {
         $this->displayMessage($this->msg('avatar-notsquare'));
         return false;
     }
     // Check if image is too small
     if ($img->width < 32 || $img->height < 32) {
         $this->displayMessage($this->msg('avatar-toosmall'));
         return false;
     }
     // Check if image is too big
     if ($img->width > $wgMaxAvatarResolution || $img->height > $wgMaxAvatarResolution) {
         $this->displayMessage($this->msg('avatar-toolarge'));
         return false;
     }
     // Avatar directories
     global $wgUploadDirectory;
     $uploadDir = $wgUploadDirectory . '/avatars/' . $this->getUser()->getId() . '/';
     @mkdir($uploadDir, 0777, true);
     // We do this to convert format to png
     $img->createThumbnail($wgMaxAvatarResolution, $uploadDir . 'original.png');
     // We only create thumbnail with default resolution here. Others are generated on demand
     global $wgDefaultAvatarRes;
     $img->createThumbnail($wgDefaultAvatarRes, $uploadDir . $wgDefaultAvatarRes . '.png');
     $img->cleanup();
     $this->displayMessage($this->msg('avatar-saved'));
     $logEntry = new \ManualLogEntry('avatar', 'upload');
     $logEntry->setPerformer($this->getUser());
     $logEntry->setTarget($this->getUser()->getUserPage());
     $logId = $logEntry->insert();
     $logEntry->publish($logId, 'rcandudp');
     return true;
 }
开发者ID:moegirlwiki,项目名称:MW-Avatar,代码行数:52,代码来源:SpecialUpload.php


示例3: 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


示例4: onArticleInsertComplete

 /**
  * Called just after a new Article is created.
  *
  * @since 0.1
  */
 public static function onArticleInsertComplete(&$article, User &$user, $text, $summary, $minoredit, $watchthis, $sectionanchor, &$flags, Revision $revision)
 {
     global $articleProtectionNS;
     if (!in_array($article->getTitle()->getNamespace(), $articleProtectionNS)) {
         return true;
     }
     $dbw = wfGetDB(DB_MASTER);
     $dbw->insert('article_protection', array('article_id' => $article->getID(), 'user_name' => $user->getName(), 'owner' => 1, 'original_owner' => 1, 'edit_permission' => 0));
     $logEntry = new ManualLogEntry('ArticleProtection', 'owner-created-permissions');
     $logEntry->setPerformer($user);
     // User object, the user who performed this action
     $logEntry->setTarget(Title::newFromID($article->getID()));
     // The page that this log entry affects, a Title object
     $logid = $logEntry->insert();
     return true;
 }
开发者ID:nathancarter,项目名称:ArticleProtection,代码行数:21,代码来源:ArticleProtection.hooks.php


示例5: 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


示例6: record

 /**
  * Record a log event for a change being patrolled
  *
  * @param int|RecentChange $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
  * @param string|string[] $tags Change tags to add to the patrol log entry
  *   ($user should be able to add the specified tags before this is called)
  *
  * @return bool
  */
 public static function record($rc, $auto = false, User $user = null, $tags = 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;
     }
     $action = $auto ? 'autopatrol' : 'patrol';
     $entry = new ManualLogEntry('patrol', $action);
     $entry->setTarget($rc->getTitle());
     $entry->setParameters(self::buildParams($rc, $auto));
     $entry->setPerformer($user);
     $entry->setTags($tags);
     $logid = $entry->insert();
     if (!$auto) {
         $entry->publish($logid, 'udp');
     }
     return true;
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:40,代码来源:PatrolLog.php


示例7: 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


示例8: 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


示例9: 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


示例10: 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


示例11: execute

 public function execute($par)
 {
     // Shortcut by using $par
     if ($par) {
         $this->getOutput()->redirect($this->getTitle()->getLinkURL(array('user' => $par)));
         return;
     }
     $this->setHeaders();
     $this->outputHeader();
     // Parse options
     $opt = new \FormOptions();
     $opt->add('user', '');
     $opt->add('delete', '');
     $opt->add('reason', '');
     $opt->fetchValuesFromRequest($this->getRequest());
     // Parse user
     $user = $opt->getValue('user');
     $userObj = \User::newFromName($user);
     $userExists = $userObj && $userObj->getId() !== 0;
     // If current task is delete and user is not allowed
     $canDoAdmin = $this->getUser()->isAllowed('avataradmin');
     if ($opt->getValue('delete')) {
         if (!$canDoAdmin) {
             throw new \PermissionsError('avataradmin');
         }
         // Delete avatar if the user exists
         if ($userExists) {
             if (Avatars::deleteAvatar($userObj)) {
                 global $wgAvatarLogInRC;
                 $logEntry = new \ManualLogEntry('avatar', 'delete');
                 $logEntry->setPerformer($this->getUser());
                 $logEntry->setTarget($userObj->getUserPage());
                 $logEntry->setComment($opt->getValue('reason'));
                 $logId = $logEntry->insert();
                 $logEntry->publish($logId, $wgAvatarLogInRC ? 'rcandudp' : 'udp');
             }
         }
     }
     $this->getOutput()->addModules(array('mediawiki.userSuggest'));
     $this->showForm($user);
     if ($userExists) {
         $haveAvatar = Avatars::hasAvatar($userObj);
         if ($haveAvatar) {
             $html = \Xml::tags('img', array('src' => Avatars::getLinkFor($user, 'original') . '&nocache&ver=' . dechex(time()), 'height' => 400), '');
             $html = \Xml::tags('p', array(), $html);
             $this->getOutput()->addHTML($html);
             // Add a delete button
             if ($canDoAdmin) {
                 $this->showDeleteForm($user);
             }
         } else {
             $this->getOutput()->addWikiMsg('viewavatar-noavatar');
         }
     } else {
         if ($user) {
             $this->getOutput()->addWikiMsg('viewavatar-nouser');
         }
     }
 }
开发者ID:nbdd0121,项目名称:MW-Avatar,代码行数:59,代码来源:SpecialView.php


示例12: 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


示例13: 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


示例14: 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


示例15: 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


示例16: 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


示例17: 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


示例18: 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'];
     if ($info !== false) {
         if (class_exists('ManualLogEntry')) {
             $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);
         } else {
             // Compatibility with MediaWiki 1.18.
             $log = new LogPage($info['type']);
             $log->addEntry($info['subtype'], $info['title'], array_key_exists('comment', $info) ? $info['comment'] : '', array_key_exists('parameters', $info) ? $info['parameters'] : array(), $user);
         }
     }
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:31,代码来源:EPUtils.php


示例19: 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


示例20: 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类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Manufacturer类代码示例发布时间:2022-05-23
下一篇:
PHP MantisEnum类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap