33 'wgExtraNamespaces' => [
35 12313 =>
'Dummy_talk',
37 'wgNamespaceContentModels' => [ 12312 =>
'DUMMY' ],
42 [
'DUMMY' =>
'DummyContentHandlerForTesting' ]
45 if ( !$this->the_properties ) {
46 $this->the_properties = [
47 "property1" =>
"value1",
48 "property2" =>
"value2",
49 "property3" =>
"value3",
50 "property4" =>
"value4"
54 if ( !$this->title1 ) {
56 'PagePropsTest_page_1',
60 $this->title1 = $page->getTitle();
61 $page1ID = $this->title1->getArticleID();
65 if ( !$this->title2 ) {
67 'PagePropsTest_page_2',
71 $this->title2 = $page->getTitle();
72 $page2ID = $this->title2->getArticleID();
83 $page1ID = $this->title1->getArticleID();
84 $result = $pageProps->getProperties( $this->title1,
"property1" );
86 $this->
assertEquals( $result[$page1ID],
"value1",
"Get property" );
95 $page1ID = $this->title1->getArticleID();
96 $page2ID = $this->title2->getArticleID();
101 $result = $pageProps->getProperties(
$titles,
"property1" );
104 $this->
assertEquals( $result[$page1ID],
"value1",
"Get property page 1" );
105 $this->
assertEquals( $result[$page2ID],
"value1",
"Get property page 2" );
114 $page1ID = $this->title1->getArticleID();
115 $page2ID = $this->title2->getArticleID();
124 $result = $pageProps->getProperties(
$titles, $properties );
126 $this->
assertArrayHasKey(
"property1", $result[$page1ID],
"Found page 1 property 1" );
127 $this->
assertArrayHasKey(
"property2", $result[$page1ID],
"Found page 1 property 2" );
129 $this->
assertArrayHasKey(
"property1", $result[$page2ID],
"Found page 2 property 1" );
130 $this->
assertArrayHasKey(
"property2", $result[$page2ID],
"Found page 2 property 2" );
131 $this->
assertEquals( $result[$page1ID][
"property1"],
"value1",
"Get page 1 property 1" );
132 $this->
assertEquals( $result[$page1ID][
"property2"],
"value2",
"Get page 1 property 2" );
133 $this->
assertEquals( $result[$page2ID][
"property1"],
"value1",
"Get page 2 property 1" );
134 $this->
assertEquals( $result[$page2ID][
"property2"],
"value2",
"Get page 2 property 2" );
150 $page1ID = $this->title1->getArticleID();
151 $result = $pageProps->getAllProperties( $this->title1 );
155 $this->
assertEquals( $patched, $properties,
"Get all properties" );
164 $page1ID = $this->title1->getArticleID();
165 $page2ID = $this->title2->getArticleID();
170 $result = $pageProps->getAllProperties(
$titles );
175 $this->
assertEquals( $patched, $properties1,
"Get all properties page 1" );
178 $this->
assertEquals( $patched, $properties2,
"Get all properties page 2" );
189 $page1ID = $this->title1->getArticleID();
190 $value1 = $pageProps->getProperties( $this->title1,
"property1" );
191 $this->
setProperty( $page1ID,
"property1",
"another value" );
192 $value2 = $pageProps->getProperties( $this->title1,
"property1" );
193 $this->
assertEquals( $value1, $value2,
"Single cache" );
204 $page1ID = $this->title1->getArticleID();
205 $properties1 = $pageProps->getAllProperties( $this->title1 );
206 $this->
setProperty( $page1ID,
"property1",
"another value" );
207 $properties2 = $pageProps->getAllProperties( $this->title1 );
208 $this->
assertEquals( $properties1, $properties2,
"Multi Cache" );
221 $page1ID = $this->title1->getArticleID();
222 $pageProps->getProperties( $this->title1,
"property1" );
223 $new_value =
"another value";
224 $this->
setProperty( $page1ID,
"property1", $new_value );
225 $pageProps->getAllProperties( $this->title1 );
226 $result = $pageProps->getProperties( $this->title1,
"property1" );
228 $this->
assertEquals( $result[$page1ID],
"another value",
"Clear cache" );
231 protected function createPage( $page, $text, $model =
null ) {
237 $page = MWNamespace::getCanonicalName( $ns ) .
':' . $page;
240 $page = Title::newFromText( $page );
243 if ( $page instanceof
Title ) {
247 if ( $page->exists() ) {
248 $page->doDeleteArticle(
"done" );
251 $content = ContentHandler::makeContent( $text, $page->getTitle(), $model );
260 foreach ( $properties as $propertyName => $propertyValue ) {
284 protected function setProperty( $pageID, $propertyName, $propertyValue ) {
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.
testClearCache()
Test that getting all properties clears the single properties that have been cached by getting a prop...
testGetSinglePropertyMultiplePages()
Test getting a single property from multiple pages.
setProperty( $pageID, $propertyName, $propertyValue)
testMultiCache()
Test caching when retrieving all properties by getting all properties, saving a new value for a prope...
setProperties( $pageID, $properties)
testGetMultiplePropertiesMultiplePages()
Test getting multiple properties from multiple pages.
testGetAllProperties()
Test getting all properties from a single page.
testGetSingleProperty()
Test getting a single property from a single page.
createPage( $page, $text, $model=null)
testSingleCache()
Test caching when retrieving single properties by getting a property, saving a new value for the prop...
testGetAllPropertiesMultiplePages()
Test getting all properties from multiple pages.
Represents a title within MediaWiki.
Class representing a MediaWiki article and history.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction $rows
const CONTENT_MODEL_WIKITEXT
linkcache txt The LinkCache class maintains a list of article titles and the information about whether or not the article exists in the database This is used to mark up links when displaying a page If the same link appears more than once on any page then it only has to be looked up once In most cases link lookups are done in batches with the LinkBatch class or the equivalent in so the link cache is mostly useful for short snippets of parsed and for links in the navigation areas of the skin The link cache was formerly used to track links used in a document for the purposes of updating the link tables This application is now deprecated To create a you can use the following $titles