static function permalinkUrlWithQuery($thread, $query, $relative = true) { if (!is_array($query)) { $query = wfCGIToArray($query); } return self::permalinkUrl($thread, null, null, $query, $relative); }
public function execute() { $pageName = $this->getArg(0); $this->pageTitle = Title::newFromText($pageName); if (!$this->pageTitle) { $this->error('Invalid page title', true); } $continue = true; $pagerParams = array('vtllimit' => 1); $topics = array(); $headerContent = ''; $headerData = $this->flowApi($this->pageTitle, 'view-header', array('vhformat' => 'wikitext'), 'header'); $headerRevision = $headerData['header']['revision']; if (isset($headerRevision['content'])) { $headerContent = $headerRevision['content']; } while ($continue) { $continue = false; $flowData = $this->flowApi($this->pageTitle, 'view-topiclist', $pagerParams, 'topiclist'); $topicListBlock = $flowData['topiclist']; foreach ($topicListBlock['roots'] as $rootPostId) { $revisionId = reset($topicListBlock['posts'][$rootPostId]); $revision = $topicListBlock['revisions'][$revisionId]; $topicOutput = '==' . $revision['content']['content'] . '==' . "\n"; $topicOutput .= $this->processPostCollection($topicListBlock, $revision['replies']); $topics[] = $topicOutput; } $paginationLinks = $topicListBlock['links']['pagination']; if (isset($paginationLinks['fwd'])) { list($junk, $query) = explode('?', $paginationLinks['fwd']['url']); $queryParams = wfCGIToArray($query); $pagerParams = array('vtloffset-id' => $queryParams['topiclist_offset-id'], 'vtloffset-dir' => 'fwd', 'vtloffset-limit' => '1'); $continue = true; } } print $headerContent . implode("\n", array_reverse($topics)); }