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' );
57 $t->mArticleID = $id; # XXX:
this is fugly
60 $po->setTitleText(
$t->getPrefixedText() );
84 'pl_from = ' . self::$testingPageId,
89 ], $update->getAddedLinks() );
92 $po->setTitleText(
$t->getPrefixedText() );
103 'pl_from = ' . self::$testingPageId,
112 ], $update->getAddedLinks() );
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' );
165 $wikiPage->doEditContent(
new WikitextContent(
'[[Category:Foo]]' ),
'added category' );
172 [ [
'Foo',
'[[:Testing]] added to category' ] ]
175 $wikiPage->doEditContent(
new WikitextContent(
'[[Category:Bar]]' ),
'replaced category' );
183 [
'Foo',
'[[:Testing]] added to category' ],
184 [
'Foo',
'[[:Testing]] removed from category' ],
193 [
'Bar',
'[[:Testing]] added to category' ],
199 $this->
setMwGlobals(
'wgCategoryCollation',
'uppercase' );
202 $templatePage =
new WikiPage( $templateTitle );
205 $wikiPage->doEditContent(
new WikitextContent(
'{{TestingTemplate}}' ),
'added template' );
209 $otherWikiPage->doEditContent(
new WikitextContent(
'{{TestingTemplate}}' ),
'added template' );
219 $templatePage->doEditContent(
new WikitextContent(
'[[Category:Baz]]' ),
'added category' );
228 '[[:Template:TestingTemplate]] added to category, ' .
229 '[[Special:WhatLinksHere/Template:TestingTemplate|this page is included within other pages]]'
242 $po->addInterwikiLink( $target );
248 'iwl_prefix, iwl_title',
249 'iwl_from = ' . self::$testingPageId,
250 [ [
'linksupdatetest',
'Foo' ] ]
269 'tl_from = ' . self::$testingPageId,
281 $po->addImage(
"Foo.png" );
288 'il_from = ' . self::$testingPageId,
298 'wgCapitalLinks' =>
true,
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" ];
341 if ( $wgPagePropsHaveSortkey ) {
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 );
373 $update->beginTransaction();
375 $update->commitTransaction();
377 $this->
assertSelect( $table, $fields, $condition, $expectedRows );
386 'rc_title, rc_comment',
390 'rc_title' => $categoryTitle->
getDBkey()
398 while (
$job = $queueGroup->pop(
'refreshLinksPrioritized' ) ) {
400 $queueGroup->ack(
$job );
402 while (
$job = $queueGroup->pop(
'categoryMembershipChange' ) ) {
404 $queueGroup->ack(
$job );
testUpdate_page_props_without_sortkey()
makeTitleAndParserOutput($name, $id)
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
wfGetDB($db, $groups=[], $wiki=false)
Get a Database object.
the array() calling protocol came about after MediaWiki 1.4rc1.
$wgPagePropsHaveSortkey
Whether the page_props table has a pp_sortkey column.
Class the manages updates of *_link tables as well as similar extension-managed tables.
Set options of the Parser.
testUpdate_iwlinks()
ParserOutput::addInterwikiLink.
static newFromText($text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Represents a title within MediaWiki.
when a variable name is used in a it is silently declared as a new local masking the global
testUpdate_imagelinks()
ParserOutput::addImage.
testUpdate_pagelinks()
ParserOutput::addLink.
testUpdate_page_props()
ParserOutput::setProperty.
testUpdate_externallinks()
ParserOutput::addExternalLink.
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
Some quick notes on the file repository architecture Functionality is
testUpdate_templatelinks()
ParserOutput::addTemplate.
getDBkey()
Get the main part with underscores.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context $parserOutput
LinksUpdate Database ^— make sure temporary tables are used.
static makeTitleSafe($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
Allows to change the fields on the form that will be generated are created Can be used to omit specific feeds from being outputted You must not use this hook to add use OutputPage::addFeedLink() instead.&$feedLinks conditions will AND in the final query as a Content object as a Content object $title
testUpdate_langlinks()
ParserOutput::addLanguageLink.
Content object for wiki text pages.
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
testOnAddingAndRemovingCategoryToTemplates_embeddingPagesAreIgnored()
static singleton($wiki=false)
Class representing a MediaWiki article and history.
testOnAddingAndRemovingCategory_recentChangesRowIsAdded()
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
assertRecentChangeByCategorization(Title $pageTitle, ParserOutput $parserOutput, Title $categoryTitle, $expectedRows)
assertLinksUpdate(Title $title, ParserOutput $parserOutput, $table, $fields, $condition, array $expectedRows)
__construct($name=null, array $data=[], $dataName= '')
getParserOutput(Title $title, $revId=null, ParserOptions $options=null, $generateHtml=true)
Parse the Content object and generate a ParserOutput from the result.
testUpdate_categorylinks()
ParserOutput::addCategory.
static makeTitle($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
Allows to change the fields on the form that will be generated $name