29 MediaWikiServices::getInstance()->getMainConfig()
32 $importer->doImport();
33 $title = Title::newFromText( $title );
36 $this->
assertEquals( WikiPage::factory( $title )->getContent()->getText(), $text );
44<mediawiki xmlns=
"http://www.mediawiki.org/xml/export-0.10/" xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=
"http://www.mediawiki.org/xml/export-0.10/ http://www.mediawiki.org/xml/export-0.10.xsd" version=
"0.10" xml:lang=
"en">
45 <page unknown=
"123" dontknow=
"533">
47 <unknowntag>Should be ignored</unknowntag>
49 <
id unknown=
"123" dontknow=
"533">14</
id>
51 <
id unknown=
"123" dontknow=
"533">15</
id>
52 <unknowntag>Should be ignored</unknowntag>
53 <timestamp>2016-01-03
T11:18:43Z</timestamp>
55 <unknowntag>Should be ignored</unknowntag>
56 <username unknown=
"123" dontknow=
"533">Admin</username>
59 <model>wikitext</model>
60 <format>text/x-wiki</format>
61 <text
xml:space=
"preserve" bytes=
"0">noitazinagro tseb eht si ikiWaideM</text>
62 <sha1>phoiac9h4m842xq45sp7s6u21eteeq1</sha1>
63 <unknowntag>Should be ignored</unknowntag>
66 <unknowntag>Should be ignored</unknowntag>
70 'noitazinagro tseb eht si ikiWaideM',
90 $redirect = $pageInfo[
'redirect'];
96 MediaWikiServices::getInstance()->getMainConfig()
98 $importer->setPageOutCallback( $callback );
99 $importer->doImport();
109<mediawiki xmlns=
"http://www.mediawiki.org/xml/export-0.10/" xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=
"http://www.mediawiki.org/xml/export-0.10/ http://www.mediawiki.org/xml/export-0.10.xsd" version=
"0.10" xml:lang=
"en">
117 <timestamp>2014-05-27
T10:00:00Z</timestamp>
119 <username>Admin</username>
122 <comment>Admin moved page [[Test]] to [[
Test22]]</comment>
123 <model>wikitext</model>
124 <format>text/x-wiki</format>
125 <text
xml:space=
"preserve" bytes=
"20">#REDIRECT [[
Test22]]</text>
126 <sha1>tq456o9x3abm7r9ozi6km8yrbbc56o6</sha1>
136<mediawiki xmlns=
"http://www.mediawiki.org/xml/export-0.9/" xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=
"http://www.mediawiki.org/xml/export-0.9/ http://www.mediawiki.org/xml/export-0.9.xsd" version=
"0.9" xml:lang=
"en">
143 <timestamp>2014-05-27
T11:00:00Z</timestamp>
145 <username>Admin</username>
148 <text
xml:space=
"preserve" bytes=
"4">Abcd</text>
149 <sha1>n7uomjq96szt60fy5w3x7ahf7q8m8rh</sha1>
150 <model>wikitext</model>
151 <format>text/x-wiki</format>
172 $importNamespaces =
null;
174 $importNamespaces = $siteinfo[
'_namespaces'];
179 MediaWikiServices::getInstance()->getMainConfig()
181 $importer->setSiteInfoCallback( $callback );
182 $importer->doImport();
192<mediawiki xmlns=
"http://www.mediawiki.org/xml/export-0.10/" xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=
"http://www.mediawiki.org/xml/export-0.10/ http://www.mediawiki.org/xml/export-0.10.xsd" version=
"0.10" xml:lang=
"en">
195 <
namespace key=
"-2" case=
"first-letter">Media</
namespace>
196 <
namespace key=
"-1" case=
"first-letter">Special</
namespace>
197 <
namespace key=
"0" case=
"first-letter" />
198 <
namespace key=
"1" case=
"first-letter">Talk</
namespace>
199 <
namespace key=
"2" case=
"first-letter">
User</
namespace>
200 <
namespace key=
"3" case=
"first-letter">
User talk</
namespace>
201 <
namespace key=
"100" case=
"first-letter">Portal</
namespace>
202 <
namespace key=
"101" case=
"first-letter">Portal talk</
namespace>
216 '101' =>
'Portal talk',
234 'ImportHandleUnknownUser' => [
function ( $name ) use ( $assign, $create, &$hookId ) {
236 $this->fail(
'ImportHandleUnknownUser was called unexpectedly' );
243 $hookId = $user->getId();
252 $n = ( $assign ? 1 : 0 ) + ( $create ? 2 : 0 );
256<mediawiki xmlns=
"http://www.mediawiki.org/xml/export-0.10/" xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=
"http://www.mediawiki.org/xml/export-0.10/ http://www.mediawiki.org/xml/export-0.10.xsd" version=
"0.10" xml:lang=
"en">
263 <timestamp>2016-01-01
T0$n:00:00Z</timestamp>
265 <username>UserDoesNotExist</username>
268 <model>wikitext</model>
269 <format>text/x-wiki</format>
270 <text
xml:space=
"preserve" bytes=
"3">foo</text>
271 <sha1>1e6gpc3ehk0mu2jqu8cg42g009s796b</sha1>
275 <timestamp>2016-01-01
T0$n:00:01Z</timestamp>
277 <username>{$user->getName()}</username>
278 <
id>{$user->getId()}</
id>
280 <model>wikitext</model>
281 <format>text/x-wiki</format>
282 <text
xml:space=
"preserve" bytes=
"3">bar</text>
283 <sha1>bjhlo6dxh5wivnszm93u4b78fheiy4t</sha1>
291 $importer =
new WikiImporter(
$source, MediaWikiServices::getInstance()->getMainConfig() );
292 $importer->setUsernamePrefix(
'Xxx', $assign );
293 $importer->doImport();
301 [
'rev_timestamp' =>
$db->
timestamp(
"201601010{$n}0000" ) ],
307 $assign && $create ?
'UserDoesNotExist' :
'Xxx>UserDoesNotExist',
310 $this->
assertSame( $assign && $create ? $hookId : 0, (
int)$row->rev_user );
315 [
'rev_timestamp' =>
$db->
timestamp(
"201601010{$n}0001" ) ],
320 $this->
assertSame( ( $assign ?
'' :
'Xxx>' ) . $user->getName(), $row->rev_user_text );
321 $this->
assertSame( $assign ? $user->getId() : 0, (
int)$row->rev_user );
326 'no assign' => [
false,
false ],
327 'assign, no create' => [
true,
false ],
328 'assign, create' => [
true,
true ],
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second redirect
to move a page</td >< td > &*You are moving the page across namespaces
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
A simple, immutable structure to hold the title of a page on a foreign MediaWiki installation.
Used for importing XML dumps where the content of the dump is in a string.
Test class for Import methods.
testSiteInfoContainsNamespaces( $xml, $namespaces)
WikiImporter::handleSiteInfo getSiteInfoXML.
testUnknownXMLTags( $xml, $text, $title)
WikiImporter getUnknownTagsXML.
static provideUnknownUserHandling()
testHandlePageContainsRedirect( $xml, $redirectTitle)
WikiImporter::handlePage getRedirectXML.
testUnknownUserHandling( $assign, $create)
provideUnknownUserHandling WikiImporter::setUsernamePrefix ExternalUserNames::addPrefix ExternalUserN...
static getQueryInfo( $options=[])
Return the tables, fields, and join conditions to be selected to create a new revision object.
Represents a title within MediaWiki.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static createNew( $name, $params=[])
Add a user to the database, return the user object.
XML file reader for the page data importer.
namespace and then decline to actually register it & $namespaces
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message key
namespace and then decline to actually register it file or subcat img or subcat $title
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
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 just before the function returns a value If you return true
processing should stop and the error should be shown to the user * false
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))