Go to the documentation of this file.
34 $this->mHandle = $handle;
41 return feof( $this->mHandle );
48 return fread( $this->mHandle, 32768 );
56 MediaWiki\suppressWarnings();
57 $file = fopen( $filename,
'rt' );
58 MediaWiki\restoreWarnings();
70 $upload =& $_FILES[$fieldname];
72 if ( $upload ===
null || !$upload[
'name'] ) {
75 if ( !empty( $upload[
'error'] ) ) {
76 switch ( $upload[
'error'] ) {
78 # The uploaded file exceeds the upload_max_filesize directive in php.ini.
81 # The uploaded file exceeds the MAX_FILE_SIZE directive that
82 # was specified in the HTML form.
85 # The uploaded file was only partially uploaded
88 # Missing a temporary folder.
90 # case else: # Currently impossible
94 $fname = $upload[
'tmp_name'];
95 if ( is_uploaded_file(
$fname ) ) {
109 wfDebug( __METHOD__ .
": opening $url\n" );
110 # Use the standard HTTP fetch function; it times out
111 # quicker and sorts out user-agent problems which might
112 # otherwise prevent importing from large sites, such
113 # as the Wikimedia cluster, etc.
118 'followRedirects' =>
true,
123 if ( $data !==
false ) {
125 fwrite( $file, $data );
143 $templates =
false, $pageLinkDepth = 0
149 # Look up the first interwiki prefix, and let the foreign site handle
150 # subsequent interwiki prefixes
151 $firstIwPrefix = strtok( $interwiki,
':' );
152 $interwikiLookup = MediaWikiServices::getInstance()->getInterwikiLookup();
153 $firstIw = $interwikiLookup->fetch( $firstIwPrefix );
158 $additionalIwPrefixes = strtok(
'' );
159 if ( $additionalIwPrefixes ) {
160 $additionalIwPrefixes .=
':';
162 # Have to do a DB-key replacement ourselves; otherwise spaces get
163 # URL-encoded to +, which is wrong in this case. Similar to logic in
165 $link = $firstIw->getURL( strtr(
"${additionalIwPrefixes}Special:Export/$page",
175 if ( $pageLinkDepth ) {
176 $params[
'pagelink-depth'] = $pageLinkDepth;
180 # For interwikis, use POST to avoid redirects.
static request( $method, $url, $options=[], $caller=__METHOD__)
Perform an HTTP request.
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
static newFatal( $message)
Factory function for fatal errors.
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined.
Imports a XML dump from a file (either from file upload, files on disk, or HTTP)
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
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
static newFromFile( $filename)
static newFromURL( $url, $method='GET')
when a variable name is used in a it is silently declared as a new masking the global
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
static newFromInterwiki( $interwiki, $page, $history=false, $templates=false, $pageLinkDepth=0)
static newGood( $value=null)
Factory function for good results.
Source interface for XML import.
usually copyright or history_copyright This message must be in HTML not wikitext & $link
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 MediaWikiServices
$wgHTTPImportTimeout
Timeout for HTTP requests done internally for transwiki imports, in seconds.
static newFromUpload( $fieldname="xmlimport")