Go to the documentation of this file.
62 parent::__construct(
$type );
75 return str_replace(
' ',
'_',
$title );
100 if ( !is_string( $pageName ) ) {
101 throw new MWException(
'$pageName must be a string' );
105 if ( defined(
'MW_PHPUNIT_TEST' ) ) {
110 return $t->getPrefixedText();
123 'converttitles' =>
true,
125 'titles' => $pageName,
140 if (
$ret ===
false ) {
141 wfDebugLog(
"MediaWikiSite",
"call to external site failed: $url" );
147 if ( !is_array( $data ) ) {
148 wfDebugLog(
"MediaWikiSite",
"call to <$url> returned bad json: " .
$ret );
152 $page = static::extractPageRecord( $data, $pageName );
154 if ( isset( $page[
'missing'] ) ) {
155 wfDebugLog(
"MediaWikiSite",
"call to <$url> returned a marker for a missing page title! " .
$ret );
159 if ( isset( $page[
'invalid'] ) ) {
160 wfDebugLog(
"MediaWikiSite",
"call to <$url> returned a marker for an invalid page title! " .
$ret );
164 if ( !isset( $page[
'title'] ) ) {
165 wfDebugLog(
"MediaWikiSite",
"call to <$url> did not return a page title! " .
$ret );
169 return $page[
'title'];
186 if ( isset( $externalData[
'query'][
'pages'] ) ) {
187 $pages = array_values( $externalData[
'query'][
'pages'] );
188 if ( count( $pages ) === 1 ) {
195 if ( !is_array( $externalData ) || !isset( $externalData[
'query'] ) ) {
200 'normalized' =>
'from',
201 'converted' =>
'from',
202 'redirects' =>
'from',
205 foreach ( $structs
as $listId => $fieldId ) {
207 if ( !isset( $externalData[
'query'][$listId] ) ) {
211 $collectedHits = array_filter(
212 array_values( $externalData[
'query'][$listId] ),
213 function( $a ) use ( $fieldId, $pageTitle ) {
214 return $a[$fieldId] === $pageTitle;
219 if ( $fieldId ===
'from' && is_array( $collectedHits ) ) {
220 switch ( count( $collectedHits ) ) {
224 $pageTitle = $collectedHits[0][
'to'];
231 elseif ( $fieldId ===
'title' && is_array( $collectedHits ) ) {
232 switch ( count( $collectedHits ) ) {
236 return array_shift( $collectedHits );
266 return parse_url( $this->
getPath( self::PATH_PAGE ), PHP_URL_PATH );
277 return parse_url( $this->
getPath( self::PATH_FILE ), PHP_URL_PATH );
319 if ( $url ===
false ) {
323 if ( $pageName !==
false ) {
324 $pageName = $this->
toDBKey( trim( $pageName ) );
325 $url = str_replace(
'$1',
wfUrlencode( $pageName ), $url );
343 $filePath = $this->
getPath( self::PATH_FILE );
345 if ( $filePath !==
false ) {
346 $filePath = str_replace(
'$1',
$path, $filePath );
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
static cleanUp( $string)
The ultimate convenience function! Clean up invalid UTF-8 sequences, and convert to normal form C,...
wfDebugLog( $logGroup, $text, $dest='all')
Send a line to a supplementary debug log file, if configured, or main debug log if not.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
wfUrlencode( $s)
We want some things to be included as literal characters in our title URLs for prettiness,...
getPath( $pathType)
Returns the path of the provided type or false if there is no such path.
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
static get( $url, $timeout='default', $options=array())
Simple wrapper for Http::request( 'GET' )
presenting them properly to the user as errors is done by the caller $title
setPath( $pathType, $fullUrl)
Sets the path used to construct links with.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
getLinkPath()
Returns the path used to construct links with or false if there is no such path.