$wgContLang->resetNamespaces(); # reset namespace cache
if ( !$this->the_properties ) {
- $this->the_properties = array(
+ $this->the_properties = [
"property1" => "value1",
"property2" => "value2",
"property3" => "value3",
"property4" => "value4"
- );
+ ];
}
if ( !$this->title1 ) {
$pageProps = PageProps::getInstance();
$page1ID = $this->title1->getArticleID();
$page2ID = $this->title2->getArticleID();
- $titles = array(
+ $titles = [
$this->title1,
$this->title2
- );
+ ];
$result = $pageProps->getProperties( $titles, "property1" );
$this->assertArrayHasKey( $page1ID, $result, "Found page 1 property" );
$this->assertArrayHasKey( $page2ID, $result, "Found page 2 property" );
$pageProps = PageProps::getInstance();
$page1ID = $this->title1->getArticleID();
$page2ID = $this->title2->getArticleID();
- $titles = array(
+ $titles = [
$this->title1,
$this->title2
- );
- $properties = array(
+ ];
+ $properties = [
"property1",
"property2"
- );
+ ];
$result = $pageProps->getProperties( $titles, $properties );
$this->assertArrayHasKey( $page1ID, $result, "Found page 1 property" );
$this->assertArrayHasKey( "property1", $result[$page1ID], "Found page 1 property 1" );
$pageProps = PageProps::getInstance();
$page1ID = $this->title1->getArticleID();
$page2ID = $this->title2->getArticleID();
- $titles = array(
+ $titles = [
$this->title1,
$this->title2
- );
+ ];
$result = $pageProps->getAllProperties( $titles );
$this->assertArrayHasKey( $page1ID, $result, "Found page 1 properties" );
$this->assertArrayHasKey( $page2ID, $result, "Found page 2 properties" );
}
protected function setProperties( $pageID, $properties ) {
-
- $rows = array();
+ $rows = [];
foreach ( $properties as $propertyName => $propertyValue ) {
-
- $row = array(
+ $row = [
'pp_page' => $pageID,
'pp_propname' => $propertyName,
'pp_value' => $propertyValue
- );
+ ];
$rows[] = $row;
}
$dbw = wfGetDB( DB_MASTER );
$dbw->replace(
'page_props',
- array(
- array(
+ [
+ [
'pp_page',
'pp_propname'
- )
- ),
+ ]
+ ],
$rows,
__METHOD__
);
}
protected function setProperty( $pageID, $propertyName, $propertyValue ) {
-
- $properties = array();
+ $properties = [];
$properties[$propertyName] = $propertyValue;
$this->setProperties( $pageID, $properties );
-
}
}