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


PHP ApiPageSet类代码示例

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


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

示例1: run

 /**
  * @param ApiPageSet $resultPageSet
  */
 private function run($resultPageSet = null)
 {
     $params = $this->extractRequestParams();
     $search = $params['search'];
     $limit = $params['limit'];
     $namespaces = $params['namespace'];
     $searcher = new TitlePrefixSearch();
     $titles = $searcher->searchWithVariants($search, $limit, $namespaces);
     if ($resultPageSet) {
         $resultPageSet->populateFromTitles($titles);
     } else {
         $result = $this->getResult();
         foreach ($titles as $title) {
             if (!$limit--) {
                 break;
             }
             $vals = array('ns' => intval($title->getNamespace()), 'title' => $title->getPrefixedText());
             if ($title->isSpecialPage()) {
                 $vals['special'] = '';
             } else {
                 $vals['pageid'] = intval($title->getArticleId());
             }
             $fit = $result->addValue(array('query', $this->getModuleName()), null, $vals);
             if (!$fit) {
                 break;
             }
         }
         $result->setIndexedTagName_internal(array('query', $this->getModuleName()), $this->getModulePrefix());
     }
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:33,代码来源:ApiQueryPrefixSearch.php

示例2: executeGenerator

 /**
  * @param ApiPageSet $resultPageSet
  * @return void
  */
 public function executeGenerator($resultPageSet)
 {
     if ($resultPageSet->isResolvingRedirects()) {
         $this->dieUsage('Use "gaifilterredir=nonredirects" option instead of "redirects" ' . 'when using allimages as a generator', 'params');
     }
     $this->run($resultPageSet);
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:11,代码来源:ApiQueryAllImages.php

示例3: testHandleNormalization

 public function testHandleNormalization()
 {
     $context = new RequestContext();
     $context->setRequest(new FauxRequest(['titles' => "a|B|å"]));
     $main = new ApiMain($context);
     $pageSet = new ApiPageSet($main);
     $pageSet->execute();
     $this->assertSame([0 => ['A' => -1, 'B' => -2, 'Å' => -3]], $pageSet->getAllTitlesByNamespace());
     $this->assertSame([['fromencoded' => true, 'from' => 'a%CC%8A', 'to' => 'å'], ['fromencoded' => false, 'from' => 'a', 'to' => 'A'], ['fromencoded' => false, 'from' => 'å', 'to' => 'Å']], $pageSet->getNormalizedTitlesAsResult());
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:10,代码来源:ApiPageSetTest.php

示例4: run

 /**
  * @param ApiPageSet $resultPageSet
  */
 private function run($resultPageSet = null)
 {
     $params = $this->extractRequestParams();
     $search = $params['search'];
     $limit = $params['limit'];
     $namespaces = $params['namespace'];
     $offset = $params['offset'];
     $searchEngine = MediaWikiServices::getInstance()->newSearchEngine();
     $searchEngine->setLimitOffset($limit + 1, $offset);
     $searchEngine->setNamespaces($namespaces);
     $titles = $searchEngine->extractTitles($searchEngine->completionSearchWithVariants($search));
     if ($resultPageSet) {
         $resultPageSet->setRedirectMergePolicy(function (array $current, array $new) {
             if (!isset($current['index']) || $new['index'] < $current['index']) {
                 $current['index'] = $new['index'];
             }
             return $current;
         });
         if (count($titles) > $limit) {
             $this->setContinueEnumParameter('offset', $offset + $params['limit']);
             array_pop($titles);
         }
         $resultPageSet->populateFromTitles($titles);
         foreach ($titles as $index => $title) {
             $resultPageSet->setGeneratorData($title, ['index' => $index + $offset + 1]);
         }
     } else {
         $result = $this->getResult();
         $count = 0;
         foreach ($titles as $title) {
             if (++$count > $limit) {
                 $this->setContinueEnumParameter('offset', $offset + $params['limit']);
                 break;
             }
             $vals = ['ns' => intval($title->getNamespace()), 'title' => $title->getPrefixedText()];
             if ($title->isSpecialPage()) {
                 $vals['special'] = true;
             } else {
                 $vals['pageid'] = intval($title->getArticleID());
             }
             $fit = $result->addValue(['query', $this->getModuleName()], null, $vals);
             if (!$fit) {
                 $this->setContinueEnumParameter('offset', $offset + $count - 1);
                 break;
             }
         }
         $result->addIndexedTagName(['query', $this->getModuleName()], $this->getModulePrefix());
     }
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:52,代码来源:ApiQueryPrefixSearch.php

示例5: runOnPageSet

 protected function runOnPageSet(ApiPageSet $pageSet)
 {
     $articles = array_map(function (Title $item) {
         return Article::newFromTitle($item, RequestContext::getMain());
     }, $pageSet->getGoodTitles());
     /**
      * @var Article $article
      */
     foreach ($articles as $id => $article) {
         $d = $article->getParserOutput()->getProperty(PortableInfoboxDataService::INFOBOXES_PROPERTY_NAME);
         if (is_array($d)) {
             $inf = [];
             foreach (array_keys($d) as $k => $v) {
                 $inf[$k] = [];
             }
             $pageSet->getResult()->setIndexedTagName($inf, 'infobox');
             $pageSet->getResult()->addValue(['query', 'pages', $id], 'infoboxes', $inf);
             foreach ($d as $count => $infobox) {
                 $s = isset($infobox['sources']) ? $infobox['sources'] : [];
                 $pageSet->getResult()->addValue(['query', 'pages', $id, 'infoboxes', $count], 'id', $count);
                 $pageSet->getResult()->setIndexedTagName($s, "source");
                 $pageSet->getResult()->addValue(['query', 'pages', $id, 'infoboxes', $count], 'sources', $s);
             }
         }
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:26,代码来源:ApiQueryPortableInfobox.class.php

示例6: createPageSetWithRedirect

 protected function createPageSetWithRedirect()
 {
     $target = Title::makeTitle(NS_MAIN, 'UTRedirectTarget');
     $sourceA = Title::makeTitle(NS_MAIN, 'UTRedirectSourceA');
     $sourceB = Title::makeTitle(NS_MAIN, 'UTRedirectSourceB');
     self::editPage('UTRedirectTarget', 'api page set test');
     self::editPage('UTRedirectSourceA', '#REDIRECT [[UTRedirectTarget]]');
     self::editPage('UTRedirectSourceB', '#REDIRECT [[UTRedirectTarget]]');
     $request = new FauxRequest(array('redirects' => 1));
     $context = new RequestContext();
     $context->setRequest($request);
     $main = new ApiMain($context);
     $pageSet = new ApiPageSet($main);
     $pageSet->setGeneratorData($sourceA, array('index' => 1));
     $pageSet->setGeneratorData($sourceB, array('index' => 3));
     $pageSet->populateFromTitles(array($sourceA, $sourceB));
     return array($target, $pageSet);
 }
开发者ID:Acidburn0zzz,项目名称:mediawiki,代码行数:18,代码来源:ApiPageSetTest.php

示例7: requestExtraData

 /**
  * @param ApiPageSet $pageSet
  * @return void
  */
 public function requestExtraData($pageSet)
 {
     $pageSet->requestField('page_restrictions');
     // when resolving redirects, no page will have this field
     if (!$pageSet->isResolvingRedirects()) {
         $pageSet->requestField('page_is_redirect');
     }
     $pageSet->requestField('page_is_new');
     $config = $this->getConfig();
     if (!$config->get('DisableCounters')) {
         $pageSet->requestField('page_counter');
     }
     $pageSet->requestField('page_touched');
     $pageSet->requestField('page_latest');
     $pageSet->requestField('page_len');
     if ($config->get('ContentHandlerUseDB')) {
         $pageSet->requestField('page_content_model');
     }
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:23,代码来源:ApiQueryInfo.php

示例8: run

 /**
  * @param ApiPageSet $resultPageSet
  */
 private function run($resultPageSet = null)
 {
     $params = $this->extractRequestParams();
     $search = $params['search'];
     $limit = $params['limit'];
     $namespaces = $params['namespace'];
     $offset = $params['offset'];
     $searcher = new TitlePrefixSearch();
     $titles = $searcher->searchWithVariants($search, $limit + 1, $namespaces, $offset);
     if ($resultPageSet) {
         if (count($titles) > $limit) {
             $this->setContinueEnumParameter('offset', $offset + $params['limit']);
             array_pop($titles);
         }
         $resultPageSet->populateFromTitles($titles);
         foreach ($titles as $index => $title) {
             $resultPageSet->setGeneratorData($title, array('index' => $index + $offset + 1));
         }
     } else {
         $result = $this->getResult();
         $count = 0;
         foreach ($titles as $title) {
             if (++$count > $limit) {
                 $this->setContinueEnumParameter('offset', $offset + $params['limit']);
                 break;
             }
             $vals = array('ns' => intval($title->getNamespace()), 'title' => $title->getPrefixedText());
             if ($title->isSpecialPage()) {
                 $vals['special'] = true;
             } else {
                 $vals['pageid'] = intval($title->getArticleId());
             }
             $fit = $result->addValue(array('query', $this->getModuleName()), null, $vals);
             if (!$fit) {
                 $this->setContinueEnumParameter('offset', $offset + $count - 1);
                 break;
             }
         }
         $result->addIndexedTagName(array('query', $this->getModuleName()), $this->getModulePrefix());
     }
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:44,代码来源:ApiQueryPrefixSearch.php

示例9: requestExtraData

 /**
  * @param ApiPageSet $pageSet
  * @return void
  */
 public function requestExtraData($pageSet)
 {
     $pageSet->requestField('page_restrictions');
     // If the pageset is resolving redirects we won't get page_is_redirect.
     // But we can't know for sure until the pageset is executed (revids may
     // turn it off), so request it unconditionally.
     $pageSet->requestField('page_is_redirect');
     $pageSet->requestField('page_is_new');
     $config = $this->getConfig();
     $pageSet->requestField('page_touched');
     $pageSet->requestField('page_latest');
     $pageSet->requestField('page_len');
     if ($config->get('ContentHandlerUseDB')) {
         $pageSet->requestField('page_content_model');
     }
     if ($config->get('PageLanguageUseDB')) {
         $pageSet->requestField('page_lang');
     }
 }
开发者ID:pirater,项目名称:mediawiki,代码行数:23,代码来源:ApiQueryInfo.php

示例10: run

 /**
  * @param ApiPageSet $resultPageSet
  * @return void
  */
 protected function run(ApiPageSet $resultPageSet = null)
 {
     $user = $this->getUser();
     // Before doing anything at all, let's check permissions
     if (!$user->isAllowed('deletedhistory')) {
         $this->dieUsage('You don\'t have permission to view deleted revision information', 'permissiondenied');
     }
     $db = $this->getDB();
     $params = $this->extractRequestParams(false);
     $result = $this->getResult();
     // If the user wants no namespaces, they get no pages.
     if ($params['namespace'] === []) {
         if ($resultPageSet === null) {
             $result->addValue('query', $this->getModuleName(), []);
         }
         return;
     }
     // This module operates in two modes:
     // 'user': List deleted revs by a certain user
     // 'all': List all deleted revs in NS
     $mode = 'all';
     if (!is_null($params['user'])) {
         $mode = 'user';
     }
     if ($mode == 'user') {
         foreach (['from', 'to', 'prefix', 'excludeuser'] as $param) {
             if (!is_null($params[$param])) {
                 $p = $this->getModulePrefix();
                 $this->dieUsage("The '{$p}{$param}' parameter cannot be used with '{$p}user'", 'badparams');
             }
         }
     } else {
         foreach (['start', 'end'] as $param) {
             if (!is_null($params[$param])) {
                 $p = $this->getModulePrefix();
                 $this->dieUsage("The '{$p}{$param}' parameter may only be used with '{$p}user'", 'badparams');
             }
         }
     }
     // If we're generating titles only, we can use DISTINCT for a better
     // query. But we can't do that in 'user' mode (wrong index), and we can
     // only do it when sorting ASC (because MySQL apparently can't use an
     // index backwards for grouping even though it can for ORDER BY, WTF?)
     $dir = $params['dir'];
     $optimizeGenerateTitles = false;
     if ($mode === 'all' && $params['generatetitles'] && $resultPageSet !== null) {
         if ($dir === 'newer') {
             $optimizeGenerateTitles = true;
         } else {
             $p = $this->getModulePrefix();
             $this->setWarning("For better performance when generating titles, set {$p}dir=newer");
         }
     }
     $this->addTables('archive');
     if ($resultPageSet === null) {
         $this->parseParameters($params);
         $this->addFields(Revision::selectArchiveFields());
         $this->addFields(['ar_title', 'ar_namespace']);
     } else {
         $this->limit = $this->getParameter('limit') ?: 10;
         $this->addFields(['ar_title', 'ar_namespace']);
         if ($optimizeGenerateTitles) {
             $this->addOption('DISTINCT');
         } else {
             $this->addFields(['ar_timestamp', 'ar_rev_id', 'ar_id']);
         }
     }
     if ($this->fld_tags) {
         $this->addTables('tag_summary');
         $this->addJoinConds(['tag_summary' => ['LEFT JOIN', ['ar_rev_id=ts_rev_id']]]);
         $this->addFields('ts_tags');
     }
     if (!is_null($params['tag'])) {
         $this->addTables('change_tag');
         $this->addJoinConds(['change_tag' => ['INNER JOIN', ['ar_rev_id=ct_rev_id']]]);
         $this->addWhereFld('ct_tag', $params['tag']);
     }
     if ($this->fetchContent) {
         // Modern MediaWiki has the content for deleted revs in the 'text'
         // table using fields old_text and old_flags. But revisions deleted
         // pre-1.5 store the content in the 'archive' table directly using
         // fields ar_text and ar_flags, and no corresponding 'text' row. So
         // we have to LEFT JOIN and fetch all four fields.
         $this->addTables('text');
         $this->addJoinConds(['text' => ['LEFT JOIN', ['ar_text_id=old_id']]]);
         $this->addFields(['ar_text', 'ar_flags', 'old_text', 'old_flags']);
         // This also means stricter restrictions
         if (!$user->isAllowedAny('undelete', 'deletedtext')) {
             $this->dieUsage('You don\'t have permission to view deleted revision content', 'permissiondenied');
         }
     }
     $miser_ns = null;
     if ($mode == 'all') {
         if ($params['namespace'] !== null) {
             $namespaces = $params['namespace'];
         } else {
//.........这里部分代码省略.........
开发者ID:paladox,项目名称:mediawiki,代码行数:101,代码来源:ApiQueryAllDeletedRevisions.php

示例11: getVersion

 public function getVersion()
 {
     $psModule = new ApiPageSet($this);
     $vers = array();
     $vers[] = __CLASS__ . ': $Id: ApiQuery.php 24494 2007-07-31 17:53:37Z yurik $';
     $vers[] = $psModule->getVersion();
     return $vers;
 }
开发者ID:mediawiki-extensions,项目名称:bizzwiki,代码行数:8,代码来源:ApiQuery.php

示例12: execute

 public function execute()
 {
     // The data is hot but user-dependent, like page views, so we set vary cookies
     $this->getMain()->setCacheMode('anon-public-user-private');
     // Get parameters
     $params = $this->extractRequestParams();
     $text = $params['text'];
     $title = $params['title'];
     if ($title === null) {
         $titleProvided = false;
         // A title is needed for parsing, so arbitrarily choose one
         $title = 'API';
     } else {
         $titleProvided = true;
     }
     $page = $params['page'];
     $pageid = $params['pageid'];
     $oldid = $params['oldid'];
     $model = $params['contentmodel'];
     $format = $params['contentformat'];
     if (!is_null($page) && (!is_null($text) || $titleProvided)) {
         $this->dieUsage('The page parameter cannot be used together with the text and title parameters', 'params');
     }
     $prop = array_flip($params['prop']);
     if (isset($params['section'])) {
         $this->section = $params['section'];
         if (!preg_match('/^((T-)?\\d+|new)$/', $this->section)) {
             $this->dieUsage("The section parameter must be a valid section id or 'new'", "invalidsection");
         }
     } else {
         $this->section = false;
     }
     // The parser needs $wgTitle to be set, apparently the
     // $title parameter in Parser::parse isn't enough *sigh*
     // TODO: Does this still need $wgTitle?
     global $wgParser, $wgTitle;
     $redirValues = null;
     // Return result
     $result = $this->getResult();
     if (!is_null($oldid) || !is_null($pageid) || !is_null($page)) {
         if ($this->section === 'new') {
             $this->dieUsage('section=new cannot be combined with oldid, pageid or page parameters. ' . 'Please use text', 'params');
         }
         if (!is_null($oldid)) {
             // Don't use the parser cache
             $rev = Revision::newFromId($oldid);
             if (!$rev) {
                 $this->dieUsage("There is no revision ID {$oldid}", 'missingrev');
             }
             if (!$rev->userCan(Revision::DELETED_TEXT, $this->getUser())) {
                 $this->dieUsage("You don't have permission to view deleted revisions", 'permissiondenied');
             }
             $titleObj = $rev->getTitle();
             $wgTitle = $titleObj;
             $pageObj = WikiPage::factory($titleObj);
             $popts = $this->makeParserOptions($pageObj, $params);
             // If for some reason the "oldid" is actually the current revision, it may be cached
             // Deliberately comparing $pageObj->getLatest() with $rev->getId(), rather than
             // checking $rev->isCurrent(), because $pageObj is what actually ends up being used,
             // and if its ->getLatest() is outdated, $rev->isCurrent() won't tell us that.
             if ($rev->getId() == $pageObj->getLatest()) {
                 // May get from/save to parser cache
                 $p_result = $this->getParsedContent($pageObj, $popts, $pageid, isset($prop['wikitext']));
             } else {
                 // This is an old revision, so get the text differently
                 $this->content = $rev->getContent(Revision::FOR_THIS_USER, $this->getUser());
                 if ($this->section !== false) {
                     $this->content = $this->getSectionContent($this->content, 'r' . $rev->getId());
                 }
                 // Should we save old revision parses to the parser cache?
                 $p_result = $this->content->getParserOutput($titleObj, $rev->getId(), $popts);
             }
         } else {
             // Not $oldid, but $pageid or $page
             if ($params['redirects']) {
                 $reqParams = array('redirects' => '');
                 if (!is_null($pageid)) {
                     $reqParams['pageids'] = $pageid;
                 } else {
                     // $page
                     $reqParams['titles'] = $page;
                 }
                 $req = new FauxRequest($reqParams);
                 $main = new ApiMain($req);
                 $pageSet = new ApiPageSet($main);
                 $pageSet->execute();
                 $redirValues = $pageSet->getRedirectTitlesAsResult($this->getResult());
                 $to = $page;
                 foreach ($pageSet->getRedirectTitles() as $title) {
                     $to = $title->getFullText();
                 }
                 $pageParams = array('title' => $to);
             } elseif (!is_null($pageid)) {
                 $pageParams = array('pageid' => $pageid);
             } else {
                 // $page
                 $pageParams = array('title' => $page);
             }
             $pageObj = $this->getTitleOrPageId($pageParams, 'fromdb');
             $titleObj = $pageObj->getTitle();
//.........这里部分代码省略.........
开发者ID:huatuoorg,项目名称:mediawiki,代码行数:101,代码来源:ApiParse.php

示例13: run

 protected function run(ApiPageSet $resultPageSet = null)
 {
     $user = $this->getUser();
     // Before doing anything at all, let's check permissions
     if (!$user->isAllowed('deletedhistory')) {
         $this->dieUsage('You don\'t have permission to view deleted revision information', 'permissiondenied');
     }
     $result = $this->getResult();
     $pageSet = $this->getPageSet();
     $pageMap = $pageSet->getGoodAndMissingTitlesByNamespace();
     $pageCount = count($pageSet->getGoodAndMissingTitles());
     $revCount = $pageSet->getRevisionCount();
     if ($revCount === 0 && $pageCount === 0) {
         // Nothing to do
         return;
     }
     if ($revCount !== 0 && count($pageSet->getDeletedRevisionIDs()) === 0) {
         // Nothing to do, revisions were supplied but none are deleted
         return;
     }
     $params = $this->extractRequestParams(false);
     $db = $this->getDB();
     if (!is_null($params['user']) && !is_null($params['excludeuser'])) {
         $this->dieUsage('user and excludeuser cannot be used together', 'badparams');
     }
     $this->addTables('archive');
     if ($resultPageSet === null) {
         $this->parseParameters($params);
         $this->addFields(Revision::selectArchiveFields());
         $this->addFields(array('ar_title', 'ar_namespace'));
     } else {
         $this->limit = $this->getParameter('limit') ?: 10;
         $this->addFields(array('ar_title', 'ar_namespace', 'ar_timestamp', 'ar_rev_id', 'ar_id'));
     }
     if ($this->fld_tags) {
         $this->addTables('tag_summary');
         $this->addJoinConds(array('tag_summary' => array('LEFT JOIN', array('ar_rev_id=ts_rev_id'))));
         $this->addFields('ts_tags');
     }
     if (!is_null($params['tag'])) {
         $this->addTables('change_tag');
         $this->addJoinConds(array('change_tag' => array('INNER JOIN', array('ar_rev_id=ct_rev_id'))));
         $this->addWhereFld('ct_tag', $params['tag']);
     }
     if ($this->fetchContent) {
         // Modern MediaWiki has the content for deleted revs in the 'text'
         // table using fields old_text and old_flags. But revisions deleted
         // pre-1.5 store the content in the 'archive' table directly using
         // fields ar_text and ar_flags, and no corresponding 'text' row. So
         // we have to LEFT JOIN and fetch all four fields.
         $this->addTables('text');
         $this->addJoinConds(array('text' => array('LEFT JOIN', array('ar_text_id=old_id'))));
         $this->addFields(array('ar_text', 'ar_flags', 'old_text', 'old_flags'));
         // This also means stricter restrictions
         if (!$user->isAllowedAny('undelete', 'deletedtext')) {
             $this->dieUsage('You don\'t have permission to view deleted revision content', 'permissiondenied');
         }
     }
     $dir = $params['dir'];
     if ($revCount !== 0) {
         $this->addWhere(array('ar_rev_id' => array_keys($pageSet->getDeletedRevisionIDs())));
     } else {
         // We need a custom WHERE clause that matches all titles.
         $lb = new LinkBatch($pageSet->getGoodAndMissingTitles());
         $where = $lb->constructSet('ar', $db);
         $this->addWhere($where);
     }
     if (!is_null($params['user'])) {
         $this->addWhereFld('ar_user_text', $params['user']);
     } elseif (!is_null($params['excludeuser'])) {
         $this->addWhere('ar_user_text != ' . $db->addQuotes($params['excludeuser']));
     }
     if (!is_null($params['user']) || !is_null($params['excludeuser'])) {
         // Paranoia: avoid brute force searches (bug 17342)
         // (shouldn't be able to get here without 'deletedhistory', but
         // check it again just in case)
         if (!$user->isAllowed('deletedhistory')) {
             $bitmask = Revision::DELETED_USER;
         } elseif (!$user->isAllowedAny('suppressrevision', 'viewsuppressed')) {
             $bitmask = Revision::DELETED_USER | Revision::DELETED_RESTRICTED;
         } else {
             $bitmask = 0;
         }
         if ($bitmask) {
             $this->addWhere($db->bitAnd('ar_deleted', $bitmask) . " != {$bitmask}");
         }
     }
     if (!is_null($params['continue'])) {
         $cont = explode('|', $params['continue']);
         $op = $dir == 'newer' ? '>' : '<';
         if ($revCount !== 0) {
             $this->dieContinueUsageIf(count($cont) != 2);
             $rev = intval($cont[0]);
             $this->dieContinueUsageIf(strval($rev) !== $cont[0]);
             $ar_id = (int) $cont[1];
             $this->dieContinueUsageIf(strval($ar_id) !== $cont[1]);
             $this->addWhere("ar_rev_id {$op} {$rev} OR " . "(ar_rev_id = {$rev} AND " . "ar_id {$op}= {$ar_id})");
         } else {
             $this->dieContinueUsageIf(count($cont) != 4);
             $ns = intval($cont[0]);
//.........这里部分代码省略.........
开发者ID:D66Ha,项目名称:mediawiki,代码行数:101,代码来源:ApiQueryDeletedRevisions.php

示例14: execute

 /**
  * Query execution happens in the following steps:
  * #1 Create a PageSet object with any pages requested by the user
  * #2 If using a generator, execute it to get a new ApiPageSet object
  * #3 Instantiate all requested modules.
  *    This way the PageSet object will know what shared data is required,
  *    and minimize DB calls.
  * #4 Output all normalization and redirect resolution information
  * #5 Execute all requested modules
  */
 public function execute()
 {
     $this->mParams = $this->extractRequestParams();
     // $pagesetParams is a array of parameter names used by the pageset generator
     //   or null if pageset has already finished and is no longer needed
     // $completeModules is a set of complete modules with the name as key
     $this->initContinue($pagesetParams, $completeModules);
     // Instantiate requested modules
     $allModules = array();
     $this->instantiateModules($allModules, 'prop');
     $propModules = $allModules;
     // Keep a copy
     $this->instantiateModules($allModules, 'list');
     $this->instantiateModules($allModules, 'meta');
     // Filter modules based on continue parameter
     $modules = $this->initModules($allModules, $completeModules, $pagesetParams !== null);
     // Execute pageset if in legacy mode or if pageset is not done
     if ($completeModules === null || $pagesetParams !== null) {
         // Populate page/revision information
         $this->mPageSet->execute();
         // Record page information (title, namespace, if exists, etc)
         $this->outputGeneralPageInfo();
     } else {
         $this->mPageSet->executeDryRun();
     }
     $cacheMode = $this->mPageSet->getCacheMode();
     // Execute all unfinished modules
     /** @var $module ApiQueryBase */
     foreach ($modules as $module) {
         $params = $module->extractRequestParams();
         $cacheMode = $this->mergeCacheMode($cacheMode, $module->getCacheMode($params));
         $module->profileIn();
         $module->execute();
         wfRunHooks('APIQueryAfterExecute', array(&$module));
         $module->profileOut();
     }
     // Set the cache mode
     $this->getMain()->setCacheMode($cacheMode);
     if ($completeModules === null) {
         return;
         // Legacy continue, we are done
     }
     // Reformat query-continue result section
     $result = $this->getResult();
     $qc = $result->getData();
     if (isset($qc['query-continue'])) {
         $qc = $qc['query-continue'];
         $result->unsetValue(null, 'query-continue');
     } elseif ($this->mGeneratorContinue !== null) {
         $qc = array();
     } else {
         // no more "continue"s, we are done!
         return;
     }
     // we are done with all the modules that do not have result in query-continue
     $completeModules = array_merge($completeModules, array_diff_key($modules, $qc));
     if ($pagesetParams !== null) {
         // The pageset is still in use, check if all props have finished
         $incompleteProps = array_intersect_key($propModules, $qc);
         if (count($incompleteProps) > 0) {
             // Properties are not done, continue with the same pageset state - copy current parameters
             $main = $this->getMain();
             $contValues = array();
             foreach ($pagesetParams as $param) {
                 // The param name is already prefix-encoded
                 $contValues[$param] = $main->getVal($param);
             }
         } elseif ($this->mGeneratorContinue !== null) {
             // Move to the next set of pages produced by pageset, properties need to be restarted
             $contValues = $this->mGeneratorContinue;
             $pagesetParams = array_keys($contValues);
             $completeModules = array_diff_key($completeModules, $propModules);
         } else {
             // Done with the pageset, finish up with the the lists and meta modules
             $pagesetParams = null;
         }
     }
     $continue = '||' . implode('|', array_keys($completeModules));
     if ($pagesetParams !== null) {
         // list of all pageset parameters to use in the next request
         $continue = implode('|', $pagesetParams) . $continue;
     } else {
         // we are done with the pageset
         $contValues = array();
         $continue = '-' . $continue;
     }
     $contValues['continue'] = $continue;
     foreach ($qc as $qcModule) {
         foreach ($qcModule as $qcKey => $qcValue) {
             $contValues[$qcKey] = $qcValue;
//.........这里部分代码省略.........
开发者ID:Tarendai,项目名称:spring-website,代码行数:101,代码来源:ApiQuery.php

示例15: getPossibleErrors

 public function getPossibleErrors()
 {
     $psModule = new ApiPageSet($this);
     return array_merge(parent::getPossibleErrors(), $psModule->getPossibleErrors());
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:5,代码来源:ApiPurge.php


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