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


PHP ApiBase::dieDebug方法代码示例

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


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

示例1: execute

 public function execute()
 {
     $prop = null;
     extract($this->extractRequestParams());
     foreach ($prop as $p) {
         switch ($p) {
             case 'general':
                 global $wgSitename, $wgVersion, $wgCapitalLinks;
                 $data = array();
                 $mainPage = Title::newFromText(wfMsgForContent('mainpage'));
                 $data['mainpage'] = $mainPage->getText();
                 $data['base'] = $mainPage->getFullUrl();
                 $data['sitename'] = $wgSitename;
                 $data['generator'] = "MediaWiki {$wgVersion}";
                 $data['case'] = $wgCapitalLinks ? 'first-letter' : 'case-sensitive';
                 // 'case-insensitive' option is reserved for future
                 $this->getResult()->addValue('query', $p, $data);
                 break;
             case 'namespaces':
                 global $wgContLang;
                 $data = array();
                 foreach ($wgContLang->getFormattedNamespaces() as $ns => $title) {
                     $data[$ns] = array('id' => $ns);
                     ApiResult::setContent($data[$ns], $title);
                 }
                 ApiResult::setIndexedTagName($data, 'ns');
                 $this->getResult()->addValue('query', $p, $data);
                 break;
             default:
                 ApiBase::dieDebug(__METHOD__, "Unknown prop={$p}");
         }
     }
 }
开发者ID:puring0815,项目名称:OpenKore,代码行数:33,代码来源:ApiQuerySiteinfo.php

示例2: setGeneratorMode

 /**
  * Switch this module to generator mode. By default, generator mode is
  * switched off and the module acts like a normal query module.
  * @since 1.21 requires pageset parameter
  * @param ApiPageSet $generatorPageSet ApiPageSet object that the module will get
  *        by calling getPageSet() when in generator mode.
  */
 public function setGeneratorMode(ApiPageSet $generatorPageSet)
 {
     if ($generatorPageSet === null) {
         ApiBase::dieDebug(__METHOD__, 'Required parameter missing - $generatorPageSet');
     }
     $this->mGeneratorPageSet = $generatorPageSet;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:14,代码来源:ApiQueryGeneratorBase.php

示例3: execute

 public function execute()
 {
     global $wgUser;
     $this->checkPermission($wgUser);
     $params = $this->extractRequestParams();
     $res = array();
     $concurrencyCheck = new ConcurrencyCheck($params['resourcetype'], $wgUser);
     switch ($params['ccaction']) {
         case 'checkout':
         case 'checkin':
             if ($concurrencyCheck->{$params}['ccaction']($params['record'])) {
                 $res['result'] = 'success';
             } else {
                 $res['result'] = 'failure';
             }
             // data to be utilized by the caller for checkout
             if ($params['ccaction'] === 'checkout') {
                 $lastCheckout = $concurrencyCheck->checkoutResult();
                 if ($res['result'] === 'success') {
                     $user = $wgUser;
                 } else {
                     $user = User::newFromId(intval($lastCheckout['userId']));
                 }
                 if (!$user->isAnon()) {
                     $res['userid'] = $user->getId();
                     $res['username'] = $user->getName();
                 }
                 $res['expiration'] = $lastCheckout['expiration'];
             }
             break;
         default:
             ApiBase::dieDebug(__METHOD__, "Unhandled concurrency action: {$params['ccaction']}");
     }
     $this->getResult()->addValue(null, $this->getModuleName(), $res);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:35,代码来源:ApiConcurrency.php

示例4: __construct

 public function __construct($query, $moduleName)
 {
     switch ($moduleName) {
         case 'alllinks':
             $prefix = 'al';
             $this->table = 'pagelinks';
             $this->tablePrefix = 'pl_';
             $this->dfltNamespace = NS_MAIN;
             $this->indexTag = 'l';
             $this->description = 'Enumerate all links that point to a given namespace';
             $this->descriptionLink = 'link';
             $this->descriptionLinked = 'linked';
             $this->descriptionLinking = 'linking';
             break;
         case 'alltransclusions':
             $prefix = 'at';
             $this->table = 'templatelinks';
             $this->tablePrefix = 'tl_';
             $this->dfltNamespace = NS_TEMPLATE;
             $this->indexTag = 't';
             $this->description = 'List all transclusions (pages embedded using {{x}}), including non-existing';
             $this->descriptionLink = 'transclusion';
             $this->descriptionLinked = 'transcluded';
             $this->descriptionLinking = 'transcluding';
             break;
         default:
             ApiBase::dieDebug(__METHOD__, 'Unknown module name');
     }
     parent::__construct($query, $moduleName, $prefix);
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:30,代码来源:ApiQueryAllLinks.php

示例5: run

 private function run($resultPageSet = null)
 {
     if ($this->getPageSet()->getGoodTitleCount() == 0) {
         return;
     }
     // nothing to do
     $params = $this->extractRequestParams();
     $prop = $params['prop'];
     $this->addFields(array('cl_from', 'cl_to'));
     $fld_sortkey = false;
     if (!is_null($prop)) {
         foreach ($prop as $p) {
             switch ($p) {
                 case 'sortkey':
                     $this->addFields('cl_sortkey');
                     $fld_sortkey = true;
                     break;
                 default:
                     ApiBase::dieDebug(__METHOD__, "Unknown prop={$p}");
             }
         }
     }
     $this->addTables('categorylinks');
     $this->addWhereFld('cl_from', array_keys($this->getPageSet()->getGoodTitles()));
     $this->addOption('ORDER BY', "cl_from, cl_to");
     $db = $this->getDB();
     $res = $this->select(__METHOD__);
     if (is_null($resultPageSet)) {
         $data = array();
         $lastId = 0;
         // database has no ID 0
         while ($row = $db->fetchObject($res)) {
             if ($lastId != $row->cl_from) {
                 if ($lastId != 0) {
                     $this->addPageSubItems($lastId, $data);
                     $data = array();
                 }
                 $lastId = $row->cl_from;
             }
             $title = Title::makeTitle(NS_CATEGORY, $row->cl_to);
             $vals = array();
             ApiQueryBase::addTitleInfo($vals, $title);
             if ($fld_sortkey) {
                 $vals['sortkey'] = $row->cl_sortkey;
             }
             $data[] = $vals;
         }
         if ($lastId != 0) {
             $this->addPageSubItems($lastId, $data);
         }
     } else {
         $titles = array();
         while ($row = $db->fetchObject($res)) {
             $titles[] = Title::makeTitle(NS_CATEGORY, $row->cl_to);
         }
         $resultPageSet->populateFromTitles($titles);
     }
     $db->freeResult($res);
 }
开发者ID:mediawiki-extensions,项目名称:bizzwiki,代码行数:59,代码来源:ApiQueryCategories.php

示例6: execute

 public function execute()
 {
     $data = $this->getResultData();
     if (isset($data['error'])) {
         $this->mErrorFallback->execute();
         return;
     }
     if (!isset($data['text'])) {
         ApiBase::dieDebug(__METHOD__, 'No text given for raw formatter');
     }
     $this->printText($data['text']);
 }
开发者ID:tuxmania87,项目名称:GalaxyAdventures,代码行数:12,代码来源:ApiFormatRaw.php

示例7: addTables

 protected function addTables($tables, $alias = null)
 {
     if (is_array($tables)) {
         if (!is_null($alias)) {
             ApiBase::dieDebug(__METHOD__, 'Multiple table aliases not supported');
         }
         $this->tables = array_merge($this->tables, $tables);
     } else {
         if (!is_null($alias)) {
             $tables = $this->getDB()->tableName($tables) . ' ' . $alias;
         }
         $this->tables[] = $tables;
     }
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:14,代码来源:ApiQueryBase.php

示例8: execute

 public function execute()
 {
     $data = $this->getResult()->getResultData();
     if (isset($data['error'])) {
         $this->errorFallback->execute();
         return;
     }
     if (isset($data['file'])) {
         $this->file = $data['file'];
     } elseif (isset($data['text'])) {
         $this->printText($data['text']);
     } else {
         ApiBase::dieDebug(__METHOD__, 'No text or file given for file formatter');
     }
 }
开发者ID:saper,项目名称:organic-extensions,代码行数:15,代码来源:ApiFormatFile.php

示例9: execute

 public function execute()
 {
     global $wgUser;
     // Before doing anything at all, let's check permissions
     if (!$wgUser->isAllowed('codereview-use')) {
         $this->dieUsage('You don\'t have permission to update code', 'permissiondenied');
     }
     $params = $this->extractRequestParams();
     $repo = CodeRepository::newFromName($params['repo']);
     if (!$repo) {
         $this->dieUsage("Invalid repo ``{$params['repo']}''", 'invalidrepo');
     }
     $svn = SubversionAdaptor::newFromRepo($repo->getPath());
     $lastStoredRev = $repo->getLastStoredRev();
     if ($lastStoredRev >= $params['rev']) {
         // Nothing to do, we're up to date.
         // Return an empty result
         $this->getResult()->addValue(null, $this->getModuleName(), array());
         return;
     }
     // FIXME: this could be a lot?
     $log = $svn->getLog('', $lastStoredRev + 1, $params['rev']);
     if (!$log) {
         // FIXME: When and how often does this happen?
         // Should we use dieUsage() here instead?
         ApiBase::dieDebug(__METHOD__, 'Something awry...');
     }
     $result = array();
     $revs = array();
     foreach ($log as $data) {
         $codeRev = CodeRevision::newFromSvn($repo, $data);
         $codeRev->save();
         $result[] = array('id' => $codeRev->getId(), 'author' => $codeRev->getAuthor(), 'timestamp' => wfTimestamp(TS_ISO_8601, $codeRev->getTimestamp()), 'message' => $codeRev->getMessage());
         $revs[] = $codeRev;
     }
     // Cache the diffs if there are a only a few.
     // Mainly for WMF post-commit ping hook...
     if (count($revs) <= 2) {
         foreach ($revs as $codeRev) {
             $repo->setDiffCache($codeRev);
             // trigger caching
         }
     }
     $this->getResult()->setIndexedTagName($result, 'rev');
     $this->getResult()->addValue(null, $this->getModuleName(), $result);
 }
开发者ID:yusufchang,项目名称:app,代码行数:46,代码来源:ApiCodeUpdate.php

示例10: __construct

 public function __construct($query, $moduleName)
 {
     switch ($moduleName) {
         case self::LINKS:
             $this->table = 'pagelinks';
             $this->prefix = 'pl';
             $this->description = 'link';
             break;
         case self::TEMPLATES:
             $this->table = 'templatelinks';
             $this->prefix = 'tl';
             $this->description = 'template';
             break;
         default:
             ApiBase::dieDebug(__METHOD__, 'Unknown module name');
     }
     parent::__construct($query, $moduleName, $this->prefix);
 }
开发者ID:josephdye,项目名称:wikireader,代码行数:18,代码来源:ApiQueryLinks.php

示例11: execute

	public function execute() {
		$params = $this->extractRequestParams();

		$result = array();

		switch ( $params['field'] ) {
			case "username":
				$mUser = User::newFromName( $params['inputVal'], 'creatable' );
				if ( !is_object( $mUser ) ) {
					$result['result'] = wfMsg( 'signupapi-noname' );
					$result['icon'] = 'MW-Icon-AlertMark.png';
				}

				if ( 0 != $mUser->idForName() ) {
					$result['result'] = wfMsg( 'signupapi-userexists' );
					$result['icon'] = "MW-Icon-NoMark.png";
				} else {
					$result['result'] = wfMsg( 'signupapi-ok' );
					$result['icon'] = "MW-Icon-CheckMark.png";
				}
				break;

			case "email" :
				$valid = User::isValidEmailAddr( $params['inputVal'] );
				if ( $valid ) {
					 $result['result']= wfMsg( 'signupapi-ok' );
					 $result['icon'] = "MW-Icon-CheckMark.png";
				} else {
					$result['result']= wfMsg( 'signupapi-invalidemailaddress' );
					$result['icon'] = "MW-Icon-NoMark.png";
				}
				break;

			case "passwordlength" :
				global $wgMinimalPasswordLength;
				$result['result'] = $wgMinimalPasswordLength;
				break;

			default :
				ApiBase::dieDebug( __METHOD__, "Unhandled case value: {$params['field']}" );
		}

		$this->getResult()->addValue( null, 'signup', $result );
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:44,代码来源:ApiValidateSignup.php

示例12: __construct

 public function __construct(ApiQuery $query, $moduleName)
 {
     switch ($moduleName) {
         case self::LINKS:
             $this->table = 'pagelinks';
             $this->prefix = 'pl';
             $this->titlesParam = 'titles';
             $this->helpUrl = 'https://www.mediawiki.org/wiki/API:Links';
             break;
         case self::TEMPLATES:
             $this->table = 'templatelinks';
             $this->prefix = 'tl';
             $this->titlesParam = 'templates';
             $this->helpUrl = 'https://www.mediawiki.org/wiki/API:Templates';
             break;
         default:
             ApiBase::dieDebug(__METHOD__, 'Unknown module name');
     }
     parent::__construct($query, $moduleName, $this->prefix);
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:20,代码来源:ApiQueryLinks.php

示例13: execute

 public function execute()
 {
     global $wgUser;
     $this->checkPermission($wgUser);
     $params = $this->extractRequestParams();
     $res = array();
     $concurrencyCheck = new ConcurrencyCheck($params['resourcetype'], $wgUser);
     switch ($params['ccaction']) {
         case 'checkout':
         case 'checkin':
             if ($concurrencyCheck->{$params}['ccaction']($params['record'])) {
                 $res['result'] = 'success';
             } else {
                 $res['result'] = 'failure';
             }
             break;
         default:
             ApiBase::dieDebug(__METHOD__, "Unhandled concurrency action: {$params['ccaction']}");
     }
     $this->getResult()->addValue(null, $this->getModuleName(), $res);
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:21,代码来源:ApiConcurrency.php

示例14: execute

 public function execute()
 {
     $name = $password = $domain = null;
     extract($this->extractRequestParams());
     $params = new FauxRequest(array('wpName' => $name, 'wpPassword' => $password, 'wpDomain' => $domain, 'wpRemember' => ''));
     $result = array();
     $loginForm = new LoginForm($params);
     switch ($loginForm->authenticateUserData()) {
         case LoginForm::SUCCESS:
             global $wgUser;
             $wgUser->setOption('rememberpassword', 1);
             $wgUser->setCookies();
             $result['result'] = 'Success';
             $result['lguserid'] = $_SESSION['wsUserID'];
             $result['lgusername'] = $_SESSION['wsUserName'];
             $result['lgtoken'] = $_SESSION['wsToken'];
             break;
         case LoginForm::NO_NAME:
             $result['result'] = 'NoName';
             break;
         case LoginForm::ILLEGAL:
             $result['result'] = 'Illegal';
             break;
         case LoginForm::WRONG_PLUGIN_PASS:
             $result['result'] = 'WrongPluginPass';
             break;
         case LoginForm::NOT_EXISTS:
             $result['result'] = 'NotExists';
             break;
         case LoginForm::WRONG_PASS:
             $result['result'] = 'WrongPass';
             break;
         case LoginForm::EMPTY_PASS:
             $result['result'] = 'EmptyPass';
             break;
         default:
             ApiBase::dieDebug(__METHOD__, 'Unhandled case value');
     }
     $this->getResult()->addValue(null, 'login', $result);
 }
开发者ID:puring0815,项目名称:OpenKore,代码行数:40,代码来源:ApiLogin.php

示例15: __construct

 public function __construct(ApiQuery $query, $moduleName)
 {
     switch ($moduleName) {
         case 'alllinks':
             $prefix = 'al';
             $this->table = 'pagelinks';
             $this->tablePrefix = 'pl_';
             $this->useIndex = 'pl_namespace';
             $this->indexTag = 'l';
             break;
         case 'alltransclusions':
             $prefix = 'at';
             $this->table = 'templatelinks';
             $this->tablePrefix = 'tl_';
             $this->dfltNamespace = NS_TEMPLATE;
             $this->useIndex = 'tl_namespace';
             $this->indexTag = 't';
             break;
         case 'allfileusages':
             $prefix = 'af';
             $this->table = 'imagelinks';
             $this->tablePrefix = 'il_';
             $this->fieldTitle = 'to';
             $this->dfltNamespace = NS_FILE;
             $this->hasNamespace = false;
             $this->indexTag = 'f';
             break;
         case 'allredirects':
             $prefix = 'ar';
             $this->table = 'redirect';
             $this->tablePrefix = 'rd_';
             $this->indexTag = 'r';
             $this->props = array('fragment' => 'rd_fragment', 'interwiki' => 'rd_interwiki');
             break;
         default:
             ApiBase::dieDebug(__METHOD__, 'Unknown module name');
     }
     parent::__construct($query, $moduleName, $prefix);
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:39,代码来源:ApiQueryAllLinks.php


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