dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix parserTests: Set scriptPath in setupGlobals() as well
[lhc/web/wiklou.git]
/
includes
/
CategoryFinder.php
diff --git
a/includes/CategoryFinder.php
b/includes/CategoryFinder.php
index
77c43bf
..
3f0528e
100644
(file)
--- a/
includes/CategoryFinder.php
+++ b/
includes/CategoryFinder.php
@@
-44,27
+44,27
@@
*/
class CategoryFinder {
/** @var int[] The original article IDs passed to the seed function */
*/
class CategoryFinder {
/** @var int[] The original article IDs passed to the seed function */
- protected $articles =
array()
;
+ protected $articles =
[]
;
/** @var array Array of DBKEY category names for categories that don't have a page */
/** @var array Array of DBKEY category names for categories that don't have a page */
- protected $deadend =
array()
;
+ protected $deadend =
[]
;
/** @var array Array of [ID => array()] */
/** @var array Array of [ID => array()] */
- protected $parents =
array()
;
+ protected $parents =
[]
;
/** @var array Array of article/category IDs */
/** @var array Array of article/category IDs */
- protected $next =
array()
;
+ protected $next =
[]
;
/** @var array Array of DBKEY category names */
/** @var array Array of DBKEY category names */
- protected $targets =
array()
;
+ protected $targets =
[]
;
/** @var array */
/** @var array */
- protected $name2id =
array()
;
+ protected $name2id =
[]
;
/** @var string "AND" or "OR" */
protected $mode;
/** @var string "AND" or "OR" */
protected $mode;
- /** @var
DatabaseB
ase Read-DB slave */
+ /** @var
IDatab
ase Read-DB slave */
protected $dbr;
/**
protected $dbr;
/**
@@
-80,7
+80,7
@@
class CategoryFinder {
$this->mode = $mode;
# Set the list of target categories; convert them to DBKEY form first
$this->mode = $mode;
# Set the list of target categories; convert them to DBKEY form first
- $this->targets =
array()
;
+ $this->targets =
[]
;
foreach ( $categories as $c ) {
$ct = Title::makeTitleSafe( NS_CATEGORY, $c );
if ( $ct ) {
foreach ( $categories as $c ) {
$ct = Title::makeTitleSafe( NS_CATEGORY, $c );
if ( $ct ) {
@@
-102,7
+102,7
@@
class CategoryFinder {
}
# Now check if this applies to the individual articles
}
# Now check if this applies to the individual articles
- $ret =
array()
;
+ $ret =
[]
;
foreach ( $this->articles as $article ) {
$conds = $this->targets;
foreach ( $this->articles as $article ) {
$conds = $this->targets;
@@
-129,7
+129,7
@@
class CategoryFinder {
* @param array $path Used to check for recursion loops
* @return bool Does this match the conditions?
*/
* @param array $path Used to check for recursion loops
* @return bool Does this match the conditions?
*/
- private function check( $id, &$conds, $path =
array()
) {
+ private function check( $id, &$conds, $path =
[]
) {
// Check for loops and stop!
if ( in_array( $id, $path ) ) {
return false;
// Check for loops and stop!
if ( in_array( $id, $path ) ) {
return false;
@@
-155,7
+155,7
@@
class CategoryFinder {
# This key is in the category list!
if ( $this->mode == 'OR' ) {
# One found, that's enough!
# This key is in the category list!
if ( $this->mode == 'OR' ) {
# One found, that's enough!
- $conds =
array()
;
+ $conds =
[]
;
return true;
} else {
# Assuming "AND" as default
return true;
} else {
# Assuming "AND" as default
@@
-187,11
+187,11
@@
class CategoryFinder {
private function scanNextLayer() {
# Find all parents of the article currently in $this->next
private function scanNextLayer() {
# Find all parents of the article currently in $this->next
- $layer =
array()
;
+ $layer =
[]
;
$res = $this->dbr->select(
/* FROM */ 'categorylinks',
/* SELECT */ '*',
$res = $this->dbr->select(
/* FROM */ 'categorylinks',
/* SELECT */ '*',
- /* WHERE */
array( 'cl_from' => $this->next )
,
+ /* WHERE */
[ 'cl_from' => $this->next ]
,
__METHOD__ . '-1'
);
foreach ( $res as $o ) {
__METHOD__ . '-1'
);
foreach ( $res as $o ) {
@@
-199,7
+199,7
@@
class CategoryFinder {
# Update parent tree
if ( !isset( $this->parents[$o->cl_from] ) ) {
# Update parent tree
if ( !isset( $this->parents[$o->cl_from] ) ) {
- $this->parents[$o->cl_from] =
array()
;
+ $this->parents[$o->cl_from] =
[]
;
}
$this->parents[$o->cl_from][$k] = $o;
}
$this->parents[$o->cl_from][$k] = $o;
@@
-216,14
+216,14
@@
class CategoryFinder {
$layer[$k] = $k;
}
$layer[$k] = $k;
}
- $this->next =
array()
;
+ $this->next =
[]
;
# Find the IDs of all category pages in $layer, if they exist
if ( count( $layer ) > 0 ) {
$res = $this->dbr->select(
/* FROM */ 'page',
# Find the IDs of all category pages in $layer, if they exist
if ( count( $layer ) > 0 ) {
$res = $this->dbr->select(
/* FROM */ 'page',
- /* SELECT */
array( 'page_id', 'page_title' )
,
- /* WHERE */
array( 'page_namespace' => NS_CATEGORY, 'page_title' => $layer )
,
+ /* SELECT */
[ 'page_id', 'page_title' ]
,
+ /* WHERE */
[ 'page_namespace' => NS_CATEGORY, 'page_title' => $layer ]
,
__METHOD__ . '-2'
);
foreach ( $res as $o ) {
__METHOD__ . '-2'
);
foreach ( $res as $o ) {