12 function __construct( $name =
null, array $data = [], $dataName =
'' ) {
13 parent::__construct( $name, $data, $dataName );
15 $this->tablesUsed = array_merge( $this->tablesUsed,
38 'iw_prefix' =>
'linksupdatetest',
39 'iw_url' =>
'http://testing.com/wiki/$1',
40 'iw_api' =>
'http://testing.com/w/api.php',
43 'iw_wikiid' =>
'linksupdatetest',
46 $this->
setMwGlobals(
'wgRCWatchCategoryMembership',
true );
51 self::$testingPageId =
$res[
'id'];
53 $this->
insertPage(
'Template:TestingTemplate' );
57 $t = Title::newFromText( $name );
58 $t->mArticleID = $id; # XXX:
this is fugly
61 $po->setTitleText(
$t->getPrefixedText() );
74 $po->addLink( Title::newFromText(
"Foo" ) );
75 $po->addLink( Title::newFromText(
"Special:Foo" ) );
76 $po->addLink( Title::newFromText(
"linksupdatetest:Foo" ) );
77 $po->addLink( Title::newFromText(
"#Foo" ) );
85 'pl_from = ' . self::$testingPageId,
89 Title::makeTitle(
NS_MAIN,
'Foo' ),
90 ], $update->getAddedLinks() );
93 $po->setTitleText(
$t->getPrefixedText() );
95 $po->addLink( Title::newFromText(
"Bar" ) );
96 $po->addLink( Title::newFromText(
"Talk:Bar" ) );
104 'pl_from = ' . self::$testingPageId,
111 Title::makeTitle(
NS_MAIN,
'Bar' ),
112 Title::makeTitle(
NS_TALK,
'Bar' ),
113 ], $update->getAddedLinks() );
115 Title::makeTitle(
NS_MAIN,
'Foo' ),
116 ], $update->getRemovedLinks() );
126 $po->addExternalLink(
"http://testing.com/wiki/Foo" );
133 'el_from = ' . self::$testingPageId,
135 [
'http://testing.com/wiki/Foo',
'http://com.testing./wiki/Foo' ],
145 $this->
setMwGlobals(
'wgCategoryCollation',
'uppercase' );
149 $po->addCategory(
"Foo",
"FOO" );
156 'cl_from = ' . self::$testingPageId,
157 [ [
'Foo',
"FOO\nTESTING" ] ]
162 $this->
setMwGlobals(
'wgCategoryCollation',
'uppercase' );
164 $title = Title::newFromText(
'Testing' );
166 $wikiPage->doEditContent(
new WikitextContent(
'[[Category:Foo]]' ),
'added category' );
171 $wikiPage->getParserOutput( ParserOptions::newCanonical() ),
172 Title::newFromText(
'Category:Foo' ),
173 [ [
'Foo',
'[[:Testing]] added to category' ] ]
176 $wikiPage->doEditContent(
new WikitextContent(
'[[Category:Bar]]' ),
'replaced category' );
181 $wikiPage->getParserOutput( ParserOptions::newCanonical() ),
182 Title::newFromText(
'Category:Foo' ),
184 [
'Foo',
'[[:Testing]] added to category' ],
185 [
'Foo',
'[[:Testing]] removed from category' ],
191 $wikiPage->getParserOutput( ParserOptions::newCanonical() ),
192 Title::newFromText(
'Category:Bar' ),
194 [
'Bar',
'[[:Testing]] added to category' ],
200 $this->
setMwGlobals(
'wgCategoryCollation',
'uppercase' );
202 $templateTitle = Title::newFromText(
'Template:TestingTemplate' );
203 $templatePage =
new WikiPage( $templateTitle );
205 $wikiPage =
new WikiPage( Title::newFromText(
'Testing' ) );
206 $wikiPage->doEditContent(
new WikitextContent(
'{{TestingTemplate}}' ),
'added template' );
209 $otherWikiPage =
new WikiPage( Title::newFromText(
'Some_other_page' ) );
210 $otherWikiPage->doEditContent(
new WikitextContent(
'{{TestingTemplate}}' ),
'added template' );
215 $templatePage->getParserOutput( ParserOptions::newCanonical() ),
216 Title::newFromText(
'Baz' ),
220 $templatePage->doEditContent(
new WikitextContent(
'[[Category:Baz]]' ),
'added category' );
225 $templatePage->getParserOutput( ParserOptions::newCanonical() ),
226 Title::newFromText(
'Baz' ),
229 '[[:Template:TestingTemplate]] added to category, ' .
230 '[[Special:WhatLinksHere/Template:TestingTemplate|this page is included within other pages]]'
242 $target = Title::makeTitleSafe(
NS_MAIN,
"Foo",
'',
'linksupdatetest' );
243 $po->addInterwikiLink( $target );
249 'iwl_prefix, iwl_title',
250 'iwl_from = ' . self::$testingPageId,
251 [ [
'linksupdatetest',
'Foo' ] ]
262 $po->addTemplate( Title::newFromText(
"Template:Foo" ), 23, 42 );
270 'tl_from = ' . self::$testingPageId,
282 $po->addImage(
"Foo.png" );
289 'il_from = ' . self::$testingPageId,
299 'wgCapitalLinks' =>
true,
305 $po->addLanguageLink( Title::newFromText(
"en:Foo" )->getFullText() );
312 'll_from = ' . self::$testingPageId,
326 $fields = [
'pp_propname',
'pp_value' ];
329 $po->setProperty(
"bool",
true );
330 $expected[] = [
"bool",
true ];
332 $po->setProperty(
"float", 4.0 + 1.0 / 4.0 );
333 $expected[] = [
"float", 4.0 + 1.0 / 4.0 ];
335 $po->setProperty(
"int", -7 );
336 $expected[] = [
"int", -7 ];
338 $po->setProperty(
"string",
"33 bar" );
339 $expected[] = [
"string",
"33 bar" ];
343 $fields[] =
'pp_sortkey';
345 foreach ( $expected as &$row ) {
349 $row[] = floatval(
$value );
357 $t, $po,
'page_props', $fields,
'pp_page = ' . self::$testingPageId, $expected );
369 $table, $fields, $condition, array $expectedRows
371 $update =
new LinksUpdate( $title, $parserOutput );
375 $this->
assertSelect( $table, $fields, $condition, $expectedRows );
387 'rc_title, rc_comment',
391 'rc_title' => $categoryTitle->
getDBkey()
398 [
'recentchanges',
'comment' ],
399 'rc_title, comment_text',
403 'rc_title' => $categoryTitle->
getDBkey(),
404 'comment_id = rc_comment_id',
413 while (
$job = $queueGroup->pop(
'refreshLinksPrioritized' ) ) {
415 $queueGroup->ack(
$job );
417 while (
$job = $queueGroup->pop(
'categoryMembershipChange' ) ) {
419 $queueGroup->ack(
$job );
int $wgCommentTableSchemaMigrationStage
Comment table schema migration stage.
$wgPagePropsHaveSortkey
Whether the page_props table has a pp_sortkey column.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
static singleton( $domain=false)
LinksUpdate LinksUpdate Database ^— make sure temporary tables are used.
assertLinksUpdate(Title $title, ParserOutput $parserOutput, $table, $fields, $condition, array $expectedRows)
testOnAddingAndRemovingCategoryToTemplates_embeddingPagesAreIgnored()
testUpdate_langlinks()
ParserOutput::addLanguageLink.
testOnAddingAndRemovingCategory_recentChangesRowIsAdded()
testUpdate_externallinks()
ParserOutput::addExternalLink.
testUpdate_iwlinks()
ParserOutput::addInterwikiLink.
testUpdate_page_props()
ParserOutput::setProperty.
__construct( $name=null, array $data=[], $dataName='')
makeTitleAndParserOutput( $name, $id)
testUpdate_templatelinks()
ParserOutput::addTemplate.
testUpdate_categorylinks()
ParserOutput::addCategory.
testUpdate_imagelinks()
ParserOutput::addImage.
assertRecentChangeByCategorization(Title $pageTitle, ParserOutput $parserOutput, Title $categoryTitle, $expectedRows)
testUpdate_page_props_without_sortkey()
testUpdate_pagelinks()
ParserOutput::addLink.
Class the manages updates of *_link tables as well as similar extension-managed tables.
Represents a title within MediaWiki.
getDBkey()
Get the main part with underscores.
Class representing a MediaWiki article and history.
Content object for wiki text pages.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
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
const MIGRATION_WRITE_BOTH
if(count( $args)< 1) $job