11 function __construct( $name =
null, array $data = [], $dataName =
'' ) {
12 parent::__construct( $name, $data, $dataName );
14 $this->tablesUsed = array_merge( $this->tablesUsed,
37 'iw_prefix' =>
'linksupdatetest',
38 'iw_url' =>
'http://testing.com/wiki/$1',
39 'iw_api' =>
'http://testing.com/w/api.php',
42 'iw_wikiid' =>
'linksupdatetest',
45 $this->
setMwGlobals(
'wgRCWatchCategoryMembership',
true );
50 self::$testingPageId =
$res[
'id'];
52 $this->
insertPage(
'Template:TestingTemplate' );
56 $t = Title::newFromText( $name );
57 $t->mArticleID = $id; # XXX:
this is fugly
60 $po->setTitleText(
$t->getPrefixedText() );
73 $po->addLink( Title::newFromText(
"Foo" ) );
74 $po->addLink( Title::newFromText(
"Special:Foo" ) );
75 $po->addLink( Title::newFromText(
"linksupdatetest:Foo" ) );
76 $po->addLink( Title::newFromText(
"#Foo" ) );
84 'pl_from = ' . self::$testingPageId,
88 Title::makeTitle(
NS_MAIN,
'Foo' ),
89 ], $update->getAddedLinks() );
92 $po->setTitleText(
$t->getPrefixedText() );
94 $po->addLink( Title::newFromText(
"Bar" ) );
95 $po->addLink( Title::newFromText(
"Talk:Bar" ) );
103 'pl_from = ' . self::$testingPageId,
110 Title::makeTitle(
NS_MAIN,
'Bar' ),
111 Title::makeTitle(
NS_TALK,
'Bar' ),
112 ], $update->getAddedLinks() );
114 Title::makeTitle(
NS_MAIN,
'Foo' ),
115 ], $update->getRemovedLinks() );
125 $po->addExternalLink(
"http://testing.com/wiki/Foo" );
132 'el_from = ' . self::$testingPageId,
134 [
'http://testing.com/wiki/Foo',
'http://com.testing./wiki/Foo' ],
144 $this->
setMwGlobals(
'wgCategoryCollation',
'uppercase' );
148 $po->addCategory(
"Foo",
"FOO" );
155 'cl_from = ' . self::$testingPageId,
156 [ [
'Foo',
"FOO\nTESTING" ] ]
161 $this->
setMwGlobals(
'wgCategoryCollation',
'uppercase' );
163 $title = Title::newFromText(
'Testing' );
165 $wikiPage->doEditContent(
new WikitextContent(
'[[Category:Foo]]' ),
'added category' );
170 $wikiPage->getParserOutput( ParserOptions::newCanonical() ),
171 Title::newFromText(
'Category:Foo' ),
172 [ [
'Foo',
'[[:Testing]] added to category' ] ]
175 $wikiPage->doEditContent(
new WikitextContent(
'[[Category:Bar]]' ),
'replaced category' );
180 $wikiPage->getParserOutput( ParserOptions::newCanonical() ),
181 Title::newFromText(
'Category:Foo' ),
183 [
'Foo',
'[[:Testing]] added to category' ],
184 [
'Foo',
'[[:Testing]] removed from category' ],
190 $wikiPage->getParserOutput( ParserOptions::newCanonical() ),
191 Title::newFromText(
'Category:Bar' ),
193 [
'Bar',
'[[:Testing]] added to category' ],
199 $this->
setMwGlobals(
'wgCategoryCollation',
'uppercase' );
201 $templateTitle = Title::newFromText(
'Template:TestingTemplate' );
202 $templatePage =
new WikiPage( $templateTitle );
204 $wikiPage =
new WikiPage( Title::newFromText(
'Testing' ) );
205 $wikiPage->doEditContent(
new WikitextContent(
'{{TestingTemplate}}' ),
'added template' );
208 $otherWikiPage =
new WikiPage( Title::newFromText(
'Some_other_page' ) );
209 $otherWikiPage->doEditContent(
new WikitextContent(
'{{TestingTemplate}}' ),
'added template' );
214 $templatePage->getParserOutput( ParserOptions::newCanonical() ),
215 Title::newFromText(
'Baz' ),
219 $templatePage->doEditContent(
new WikitextContent(
'[[Category:Baz]]' ),
'added category' );
224 $templatePage->getParserOutput( ParserOptions::newCanonical() ),
225 Title::newFromText(
'Baz' ),
228 '[[:Template:TestingTemplate]] added to category, ' .
229 '[[Special:WhatLinksHere/Template:TestingTemplate|this page is included within other pages]]'
241 $target = Title::makeTitleSafe(
NS_MAIN,
"Foo",
'',
'linksupdatetest' );
242 $po->addInterwikiLink( $target );
248 'iwl_prefix, iwl_title',
249 'iwl_from = ' . self::$testingPageId,
250 [ [
'linksupdatetest',
'Foo' ] ]
261 $po->addTemplate( Title::newFromText(
"Template:Foo" ), 23, 42 );
269 'tl_from = ' . self::$testingPageId,
281 $po->addImage(
"Foo.png" );
288 'il_from = ' . self::$testingPageId,
298 'wgCapitalLinks' =>
true,
304 $po->addLanguageLink( Title::newFromText(
"en:Foo" )->getFullText() );
311 'll_from = ' . self::$testingPageId,
325 $fields = [
'pp_propname',
'pp_value' ];
328 $po->setProperty(
"bool",
true );
329 $expected[] = [
"bool",
true ];
331 $po->setProperty(
"float", 4.0 + 1.0 / 4.0 );
332 $expected[] = [
"float", 4.0 + 1.0 / 4.0 ];
334 $po->setProperty(
"int", -7 );
335 $expected[] = [
"int", -7 ];
337 $po->setProperty(
"string",
"33 bar" );
338 $expected[] = [
"string",
"33 bar" ];
342 $fields[] =
'pp_sortkey';
344 foreach ( $expected as &$row ) {
348 $row[] = floatval(
$value );
356 $t, $po,
'page_props', $fields,
'pp_page = ' . self::$testingPageId, $expected );
368 $table, $fields, $condition, array $expectedRows
370 $update =
new LinksUpdate( $title, $parserOutput );
374 $this->
assertSelect( $table, $fields, $condition, $expectedRows );
386 'rc_title, rc_comment',
390 'rc_title' => $categoryTitle->
getDBkey()
397 [
'recentchanges',
'comment' ],
398 'rc_title, comment_text',
402 'rc_title' => $categoryTitle->
getDBkey(),
403 'comment_id = rc_comment_id',
412 while (
$job = $queueGroup->pop(
'refreshLinksPrioritized' ) ) {
414 $queueGroup->ack(
$job );
416 while (
$job = $queueGroup->pop(
'categoryMembershipChange' ) ) {
418 $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( $wiki=false)
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