29 private $loadBalancer;
32 private $languageNameUtils;
35 private $titleFormatter;
46 private $page =
false;
62 $this->loadBalancer = $loadBalancer;
63 $this->languageNameUtils = $languageNameUtils;
64 $this->titleFormatter = $titleFormatter;
65 $this->titleParser = $titleParser;
66 $this->pageLookup = $pageLookup;
73 if ( $this->page === false ) {
74 $this->page = $this->pageLookup->getExistingPageByText(
87 $page = $this->getPage();
96 if ( !$this->
getAuthority()->authorizeRead(
'read', $page ) ) {
105 ->createJson( $this->fetchLinks( $page->getId() ) );
108 private function fetchLinks( $pageId ) {
114 [
'll_from' => $pageId ],
116 [
'ORDER BY' =>
'll_lang' ]
118 foreach (
$res as $item ) {
120 $targetTitle = $this->titleParser->parseTitle( $item->ll_title );
122 'code' => $item->ll_lang,
123 'name' => $this->languageNameUtils->getLanguageName( $item->ll_lang ),
124 'key' => $this->titleFormatter->getPrefixedDBkey( $targetTitle ),
125 'title' => $this->titleFormatter->getPrefixedText( $targetTitle )
141 self::PARAM_SOURCE =>
'path',
142 ParamValidator::PARAM_TYPE =>
'string',
143 ParamValidator::PARAM_REQUIRED =>
true,
152 $page = $this->getPage();
158 return '"' . $page->getLatest() .
'@' .
wfTimestamp( TS_MW, $page->getTouched() ) .
'"';
165 $page = $this->getPage();
170 return $page->getTouched();
177 return (
bool)$this->getPage();
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
if(!defined('MW_SETUP_CALLBACK'))
The persistent session ID (if any) loaded at startup.
Service for looking up information about wiki pages.
A title parser service for MediaWiki.