if ( is_array( $propertyNames ) ) {
$gotArray = true;
} else {
- $propertyNames = array( $propertyNames );
+ $propertyNames = [ $propertyNames ];
$gotArray = false;
}
- $values = array();
+ $values = [];
$goodIDs = $this->getGoodIDs( $titles );
- $queryIDs = array();
+ $queryIDs = [];
foreach ( $goodIDs as $pageID ) {
foreach ( $propertyNames as $propertyName ) {
$propertyValue = $this->getCachedProperty( $pageID, $propertyName );
$dbr = wfGetDB( DB_SLAVE );
$result = $dbr->select(
'page_props',
- array(
+ [
'pp_page',
'pp_propname',
'pp_value'
- ),
- array(
+ ],
+ [
'pp_page' => $queryIDs,
'pp_propname' => $propertyNames
- ),
+ ],
__METHOD__
);
* @return array associative array mapping page ID to property value array
*/
public function getAllProperties( $titles ) {
- $values = array();
+ $values = [];
$goodIDs = $this->getGoodIDs( $titles );
- $queryIDs = array();
+ $queryIDs = [];
foreach ( $goodIDs as $pageID ) {
$pageProperties = $this->getCachedProperties( $pageID );
if ( $pageProperties === false ) {
}
}
- if ( $queryIDs != array() ) {
+ if ( $queryIDs != [] ) {
$dbr = wfGetDB( DB_SLAVE );
$result = $dbr->select(
'page_props',
- array(
+ [
'pp_page',
'pp_propname',
'pp_value'
- ),
- array(
+ ],
+ [
'pp_page' => $queryIDs,
- ),
+ ],
__METHOD__
);
$currentPageID = 0;
- $pageProperties = array();
+ $pageProperties = [];
foreach ( $result as $row ) {
$pageID = $row->pp_page;
if ( $currentPageID != $pageID ) {
- if ( $pageProperties != array() ) {
+ if ( $pageProperties != [] ) {
$this->cacheProperties( $currentPageID, $pageProperties );
$values[$currentPageID] = $pageProperties;
}
$currentPageID = $pageID;
- $pageProperties = array();
+ $pageProperties = [];
}
$pageProperties[$row->pp_propname] = $row->pp_value;
}
- if ( $pageProperties != array() ) {
+ if ( $pageProperties != [] ) {
$this->cacheProperties( $pageID, $pageProperties );
$values[$pageID] = $pageProperties;
}
* @return array array of good page IDs
*/
private function getGoodIDs( $titles ) {
- $result = array();
+ $result = [];
if ( is_array( $titles ) ) {
foreach ( $titles as $title ) {
$pageID = $title->getArticleID();