44 'xmlns' =>
"http://www.mediawiki.org/xml/export-$ver/",
45 'xmlns:xsi' =>
"http://www.w3.org/2001/XMLSchema-instance",
56 'xsi:schemaLocation' =>
"http://www.mediawiki.org/xml/export-$ver/ " .
57 "http://www.mediawiki.org/xml/export-$ver.xsd",
59 'xml:lang' => $wgLanguageCode ],
76 return " <siteinfo>\n " .
77 implode(
"\n ", $info ) .
102 return Xml::element(
'generator', [],
"MediaWiki $wgVersion" );
118 $sensitivity = $wgCapitalLinks ?
'first-letter' :
'case-sensitive';
127 $spaces =
"<namespaces>\n";
128 foreach ( $wgContLang->getFormattedNamespaces()
as $ns =>
$title ) {
136 $spaces .=
" </namespaces>";
147 return "</mediawiki>\n";
161 $out .=
' ' .
Xml::element(
'ns', [], strval( $row->page_namespace ) ) .
"\n";
163 if ( $row->page_is_redirect ) {
165 $redirect =
$page->getRedirectTarget();
166 if ( $redirect instanceof
Title && $redirect->isValidRedirectTarget() ) {
168 $out .=
Xml::element(
'redirect', [
'title' => self::canonicalTitle( $redirect ) ] );
173 if ( $row->page_restrictions !=
'' ) {
175 strval( $row->page_restrictions ) ) .
"\n";
203 $out =
" <revision>\n";
205 if ( isset( $row->rev_parent_id ) && $row->rev_parent_id ) {
206 $out .=
" " .
Xml::element(
'parentid', null, strval( $row->rev_parent_id ) ) .
"\n";
212 $out .=
" " .
Xml::element(
'contributor', [
'deleted' =>
'deleted' ] ) .
"\n";
217 if ( isset( $row->rev_minor_edit ) && $row->rev_minor_edit ) {
218 $out .=
" <minor/>\n";
222 } elseif ( $row->rev_comment !=
'' ) {
226 if ( isset( $row->rev_content_model ) && !is_null( $row->rev_content_model ) ) {
227 $content_model = strval( $row->rev_content_model );
236 if ( isset( $row->rev_content_format ) && !is_null( $row->rev_content_format ) ) {
237 $content_format = strval( $row->rev_content_format );
240 $content_format = $content_handler->getDefaultFormat();
243 $out .=
" " .
Xml::element(
'model', null, strval( $content_model ) ) .
"\n";
244 $out .=
" " .
Xml::element(
'format', null, strval( $content_format ) ) .
"\n";
249 } elseif ( isset( $row->old_text ) ) {
252 $text = $content_handler->exportTransform( $text, $content_format );
254 [
'xml:space' =>
'preserve',
'bytes' => intval( $row->rev_len ) ],
255 strval( $text ) ) .
"\n";
259 [
'id' => $row->rev_text_id,
'bytes' => intval( $row->rev_len ) ],
263 if ( isset( $row->rev_sha1 )
267 $out .=
" " .
Xml::element(
'sha1', null, strval( $row->rev_sha1 ) ) .
"\n";
269 $out .=
" <sha1/>\n";
272 Hooks::run(
'XmlDumpWriterWriteRevision', [ &$this, &
$out, $row, $text ] );
274 $out .=
" </revision>\n";
289 $out =
" <logitem>\n";
295 $out .=
" " .
Xml::element(
'contributor', [
'deleted' =>
'deleted' ] ) .
"\n";
302 } elseif ( $row->log_comment !=
'' ) {
306 $out .=
" " .
Xml::element(
'type', null, strval( $row->log_type ) ) .
"\n";
307 $out .=
" " .
Xml::element(
'action', null, strval( $row->log_action ) ) .
"\n";
315 [
'xml:space' =>
'preserve' ],
316 strval( $row->log_params ) ) .
"\n";
319 $out .=
" </logitem>\n";
331 return $indent .
Xml::element(
'timestamp', null, $ts ) .
"\n";
341 $out = $indent .
"<contributor>\n";
348 $out .= $indent .
"</contributor>\n";
359 if ( $row->page_namespace ==
NS_FILE ) {
361 if ( $img && $img->exists() ) {
363 foreach ( array_reverse( $img->getHistory() )
as $ver ) {
379 if ( $file->isOld() ) {
381 Xml::element(
'archivename', null, $file->getArchiveName() ) .
"\n";
385 if ( $dumpContents ) {
386 $be = $file->getRepo()->getBackend();
387 # Dump file as base64
388 # Uses only XML-safe characters, so does not need escaping
389 # @todo Too bad this loads the contents into memory (script might swap)
390 $contents =
' <contents encoding="base64">' .
391 chunk_split( base64_encode(
392 $be->getFileContents( [
'src' => $file->getPath() ] ) ) ) .
402 return " <upload>\n" .
404 $this->
writeContributor( $file->getUser(
'id' ), $file->getUser(
'text' ) ) .
406 " " .
Xml::element(
'filename', null, $file->getName() ) .
"\n" .
408 " " .
Xml::element(
'src', null, $file->getCanonicalUrl() ) .
"\n" .
409 " " .
Xml::element(
'size', null, $file->getSize() ) .
"\n" .
410 " " .
Xml::element(
'sha1base36', null, $file->getSha1() ) .
"\n" .
411 " " .
Xml::element(
'rel', null, $file->getRel() ) .
"\n" .
432 $prefix = $wgContLang->getFormattedNsText( $title->
getNamespace() );
434 if ( $prefix !==
'' ) {
438 return $prefix . $title->
getText();
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
writeUploads($row, $dumpContents=false)
Warning! This data is potentially inconsistent.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
static getRevisionText($row, $prefix= 'old_', $wiki=false)
Get revision text associated with an old or archive row $row is usually an object from wfFetchRow()...
$wgVersion
MediaWiki version number.
$wgSitename
Name of the site.
static element($element, $attribs=null, $contents= '', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
getText()
Get the text form (spaces not underscores) of the main part.
static newMainPage()
Create a new Title for the Main Page.
static getForModelID($modelId)
Returns the ContentHandler singleton for the given model ID.
static getDefaultModelFor(Title $title)
Returns the name of the default content model to be used for the page with the given title...
closePage()
Closes a "
" section on the output stream.
getPrefixedText()
Get the prefixed title with spaces.
closeStream()
Closes the output stream with the closing root element.
when a variable name is used in a it is silently declared as a new local masking the global
const TS_ISO_8601
ISO 8601 format with no timezone: 1986-02-09T20:00:00Z.
wfLocalFile($title)
Get an object referring to a locally registered file.
writeRevision($row)
Dumps a "" section on the output stream, with data filled in from the given database row...
static isCapitalized($index)
Is the namespace first-letter capitalized?
wfTimestamp($outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
$wgLanguageCode
Site language code.
isExternal()
Is this Title interwiki?
$wgCapitalLinks
Set this to false to avoid forcing the first letter of links to capitals.
writeLogItem($row)
Dumps a "" section on the output stream, with data filled in from the given database row...
writeContributor($id, $text, $indent=" ")
static isValid($ip)
Validate an IP address.
static elementClean($element, $attribs=[], $contents= '')
Format an XML element as with self::element(), but run text through the $wgContLang->normalize() vali...
namespace and then decline to actually register it file or subcat img or subcat $title
openStream()
Opens the XML output stream's root "" element.
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
getNamespace()
Get the namespace index, i.e.
writeUpload($file, $dumpContents=false)
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
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
static schemaVersion()
Returns the export schema version.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
writeTimestamp($timestamp, $indent=" ")
controlled by $wgMainCacheType controlled by $wgParserCacheType controlled by $wgMessageCacheType If you set CACHE_NONE to one of the three control default value for MediaWiki still create a but requests to it are no ops and we always fall through to the database If the cache daemon can t be it should also disable itself fairly smoothly By $wgMemc is used but when it is $parserMemc or $messageMemc this is mentioned $wgDBname
static makeTitle($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
static canonicalTitle(Title $title)
Return prefixed text form of title, but using the content language's canonical namespace.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page
openPage($row)
Opens a "
" section on the output stream, with data from the given database row.