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


PHP MWDebug::getLog方法代码示例

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


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

示例1: testAvoidNonConsecutivesDuplicateDeprecations

 /**
  * @covers MWDebug::deprecated
  */
 public function testAvoidNonConsecutivesDuplicateDeprecations()
 {
     MWDebug::deprecated('wfOldFunction', '1.0', 'component');
     MWDebug::warning('some warning');
     MWDebug::log('we could have logged something too');
     // Another deprecation
     MWDebug::deprecated('wfOldFunction', '1.0', 'component');
     // assertCount() not available on WMF integration server
     $this->assertEquals(3, count(MWDebug::getLog()), "Only one deprecated warning per function should be kept");
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:13,代码来源:MWDebugTest.php

示例2: execute

 function execute($par)
 {
     global $wgOut, $wgRequest, $wgUser, $wgParser, $wgDebugToolbar;
     $user = $this->getUser();
     wfLoadExtensionMessages("TipsPatrol");
     if ($user->isBlocked()) {
         $wgOut->blockedPage();
         return;
     }
     if ($user->isAnon() || self::isBlockedFromTipsPatrol($user)) {
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     $this->skipTool = new ToolSkip("tiptool", "tipsandwarnings", "tw_checkout", "tw_checkout_user", "tw_id");
     if ($wgRequest->wasPosted()) {
         $wgOut->disable();
         $result = array();
         try {
             $tipId = $wgRequest->getVal('tipId');
             if ($wgRequest->getVal('coachTip')) {
                 $tip = $wgRequest->getVal('tip');
                 $this->coachResult($tipId, $tip, &$result);
             } elseif ($tipId != null && $wgRequest->getVal('skipTip')) {
                 $this->logTip($tipId, self::TIP_ACTION_SKIP);
                 $this->skipTool->skipItem($tipId);
                 $this->skipTool->unUseItem($tipId);
             } elseif ($wgRequest->getVal('deleteTip')) {
                 $tip = $wgRequest->getVal('tip');
                 $this->logTip($tipId, self::TIP_ACTION_DELETE, $tip);
                 $articleId = $wgRequest->getVal('articleId');
                 $this->deleteTip($tipId, $articleId, $tip);
             } elseif ($wgRequest->getVal('keepTip')) {
                 $articleId = $wgRequest->getVal('articleId');
                 $tip = $wgRequest->getVal('tip');
                 $qcId = $this->addToQG($tipId, $articleId, $tip);
                 $this->logTip($tipId, self::TIP_ACTION_KEEP, $tip, $qcId);
                 $dbw = wfGetDB(DB_MASTER);
                 $dbw->delete('tipsandwarnings', array('tw_id' => $tipId));
             }
             $this->getNextTip(&$result);
             // if debug toolbark pass logs back in response
             if ($wgDebugToolbar) {
                 $result['debug']['log'] = MWDebug::getLog();
             }
             echo json_encode($result);
         } catch (MWException $e) {
             $result['error'][] = $e->getText();
             echo json_encode($result);
             throw $e;
         }
         return;
     }
     $wgOut->setHTMLTitle(wfMessage('tipspatrol')->text());
     $wgOut->setPageTitle(wfMessage('tipspatrol')->text());
     $wgOut->addJSCode('mt');
     // Mousetrap library
     $wgOut->addCSSCode('tpc');
     // Tips Patrol CSS
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('tipspatrol.js'), 'extensions/wikihow/tipsandwarnings'));
     if ($wgDebugToolbar) {
         $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('consoledebug.js'), 'extensions/wikihow/debug', false));
     }
     EasyTemplate::set_path(dirname(__FILE__));
     $vars = array();
     $vars['tip_skip_title'] = wfMessage('tip_skip_title')->text();
     $vars['tip_keep_title'] = wfMessage('tip_keep_title')->text();
     $vars['tip_delete_title'] = wfMessage('tip_delete_title')->text();
     $wgOut->addHTML(EasyTemplate::html('TipsPatrol.tmpl.php', $vars));
     $coach = $this->getRequest()->getVal("coach");
     // code to init the tipspatrol javascript.. doing it here lets us pass in extra variables when we init
     $wgOut->addScript("<script>\$(document).ready(function(){WH.tipsPatrol.init({$coach})});</script>");
     $bubbleText = "Only publish this tip if you can make it helpful, clear, and grammatically correct. Most tips should get deleted.";
     InterfaceElements::addBubbleTipToElement('tip_tip', 'tptrl', $bubbleText);
     $this->displayLeaderboards();
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:76,代码来源:TipsPatrol.body.php

示例3: execute

 function execute($par)
 {
     global $wgDebugToolbar;
     $request = $this->getRequest();
     $out = $this->getOutput();
     $this->checkPermissions();
     wfLoadExtensionMessages("UCIPatrol");
     if ($request->getVal("stats")) {
         $out->disable();
         $result = $this->getStats();
         if ($request->getVal("format") == "json") {
             echo json_encode($result);
             return;
         }
         UCIPatrol::printStatsUploads($result['uploads']);
         UCIPatrol::printStatsTitles($result['titles']);
         return;
     }
     if ($request->wasPosted()) {
         $out->disable();
         // wrapping it all in try catch to get any database errors
         try {
             $result = array();
             if ($request->getVal('next')) {
                 $result = $this->getNext();
             } elseif ($request->getVal('skip')) {
                 $this->skip();
             } elseif ($request->getVal('bad')) {
                 $this->downVote();
             } elseif ($request->getVal('good')) {
                 $this->upVote();
             } elseif ($request->getVal('undo')) {
                 $this->undo();
             } elseif ($request->getVal('error')) {
                 $this->error();
                 $result = $this->getNext();
             } elseif ($request->getVal('resetskip')) {
                 $this->resetSkip();
                 $result = $this->getNext();
             } elseif ($request->getVal('flag')) {
                 $this->flag();
                 $result = UCIPatrol::getImagesHTML($request->getVal('hostPage'));
                 echo $result;
                 return;
             }
             // if debug toolbar is active, pass logs back in json response
             if ($wgDebugToolbar) {
                 $result['debug']['log'] = MWDebug::getLog();
             }
             echo json_encode($result);
         } catch (MWException $e) {
             $result = $result ?: array();
             $result['error'][] = $e->getText();
             echo json_encode($result);
             throw $e;
         }
     } else {
         $out->setHTMLTitle(wfMessage('ucipatrol')->text());
         $out->setPageTitle(wfMessage('ucipatrol')->text());
         $out->addJSCode('mt');
         // Mousetrap library
         $out->addCSSCode('ucipc');
         // Tips Patrol CSS
         $out->addScript(HtmlSnips::makeUrlTags('js', array('ucipatrol.js'), 'extensions/wikihow/mobile/ucipatrol', false));
         if ($wgDebugToolbar) {
             $out->addScript(HtmlSnips::makeUrlTags('js', array('consoledebug.js'), 'extensions/wikihow/debug', false));
         }
         EasyTemplate::set_path(dirname(__FILE__));
         $anon = $this->getUser()->isAnon();
         $out->addHTML(EasyTemplate::html('UCIPatrol.tmpl.php', $vars));
         $out->addScript("<script>\$(document).ready(function(){WH.uciPatrol.init({$anon})});</script>");
         $bubbleText = "Help us pick the best user submitted photos to match the article.";
         InterfaceElements::addBubbleTipToElement('uci', 'ucitp', $bubbleText);
         $this->displayLeaderboards();
     }
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:76,代码来源:UCIPatrol.body.php


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