*
* $cf = new CategoryFinder;
* $cf->seed(
- * array( 12345 ),
- * array( 'Category 1', 'Category 2' ),
+ * [ 12345 ],
+ * [ 'Category 1', 'Category 2' ],
* 'AND'
* );
* $a = $cf->run();
/** @var array Array of DBKEY category names for categories that don't have a page */
protected $deadend = [];
- /** @var array Array of [ID => array()] */
+ /** @var array Array of [ ID => [] ] */
protected $parents = [];
/** @var array Array of article/category IDs */
// Get pageIDs data from the `page` table
$res = $db->select( 'page', $pageFlds, $set, __METHOD__ );
- // Hack: get the ns:titles stored in array(ns => array(titles)) format
+ // Hack: get the ns:titles stored in [ns => array(titles)] format
$this->initFromQueryResult( $res, $linkBatch->data, true );
}
}
/**
* This class represents the result of the API operations.
- * It simply wraps a nested array() structure, adding some functions to simplify
+ * It simply wraps a nested array structure, adding some functions to simplify
* array's modifications. As various modules execute, they add different pieces
* of information to this result, structuring it as it will be given to the client.
*
* @param mixed $conds Array or string, condition(s) for WHERE
* @param string $fname Calling function name (use __METHOD__) for logs/profiling
* @param array $options Associative array of options (e.g.
- * array('GROUP BY' => 'page_title')), see Database::makeSelectOptions
+ * [ 'GROUP BY' => 'page_title' ]), see Database::makeSelectOptions
* code for list of supported stuff
* @param array $join_conds Associative array of table join conditions
- * (optional) (e.g. array( 'page' => array('LEFT JOIN','page_latest=rev_id') )
+ * (optional) (e.g. [ 'page' => [ 'LEFT JOIN','page_latest=rev_id' ] ]
* @return mixed Database result resource (feed to Database::fetchObject
* or whatever), or false on failure
* @throws DBQueryError
* @param mixed $vars Array or string, field name(s) to be retrieved
* @param mixed $conds Array or string, condition(s) for WHERE
* @param string $fname Calling function name (use __METHOD__) for logs/profiling
- * @param array $options Associative array of options (e.g. array('GROUP BY' => 'page_title')),
+ * @param array $options Associative array of options (e.g. [ 'GROUP BY' => 'page_title' ]),
* see Database::makeSelectOptions code for list of supported stuff
* @param array $join_conds Associative array of table join conditions (optional)
- * (e.g. array( 'page' => array('LEFT JOIN','page_latest=rev_id') )
+ * (e.g. [ 'page' => [ 'LEFT JOIN','page_latest=rev_id' ] ]
* @return string The SQL text
*/
public function selectSQLText( $table, $vars, $conds = '', $fname = __METHOD__,
/**
* INSERT SELECT wrapper
- * $varMap must be an associative array of the form array( 'dest1' => 'source1', ...)
+ * $varMap must be an associative array of the form [ 'dest1' => 'source1', ... ]
* Source items may be literals rather than field names, but strings should
* be quoted with Database::addQuotes().
* @param string $destTable
/**
* INSERT SELECT wrapper
- * $varMap must be an associative array of the form array( 'dest1' => 'source1', ...)
+ * $varMap must be an associative array of the form [ 'dest1' => 'source1', ... ]
* Source items may be literals rather then field names, but strings should
* be quoted with Database::addQuotes()
* $conds may be "*" to copy the whole table
*
* Example:
* $id = $dbw->nextSequenceValue( 'page_page_id_seq' );
- * $dbw->insert( 'page', array( 'page_id' => $id ) );
+ * $dbw->insert( 'page', [ 'page_id' => $id ] );
* $id = $dbw->insertId();
*
* @return int
* May be either an array of table names, or a single string holding a table
* name. If an array is given, table aliases can be specified, for example:
*
- * array( 'a' => 'user' )
+ * [ 'a' => 'user' ]
*
* This includes the user table in the query, with the alias "a" available
* for use in field names (e.g. a.user_name).
* can be complete fragments of SQL, for direct inclusion into the SELECT
* query. If an array is given, field aliases can be specified, for example:
*
- * array( 'maxrev' => 'MAX(rev_id)' )
+ * [ 'maxrev' => 'MAX(rev_id)' ]
*
* This includes an expression with the alias "maxrev" in the query.
*
* including them in the array as a string value with a numeric key, for
* example:
*
- * array( 'FOR UPDATE' )
+ * [ 'FOR UPDATE' ]
*
* The supported options are:
*
* an SQL fragment, or an array where the string keys are equality and the
* numeric keys are SQL fragments all AND'd together. For example:
*
- * array( 'page' => array( 'LEFT JOIN', 'page_latest=rev_id' ) )
+ * [ 'page' => [ 'LEFT JOIN', 'page_latest=rev_id' ] ]
*
* @return ResultWrapper|bool If the query returned no rows, a ResultWrapper
* with no rows in it will be returned. If there was a query error, a
* The keys on each level may be either integers or strings.
*
* @param array $data Organized as 2-d
- * array(baseKeyVal => array(subKeyVal => [ignored], ...), ...)
+ * [ baseKeyVal => [ subKeyVal => [ignored], ... ], ... ]
* @param string $baseKey Field name to match the base-level keys to (eg 'pl_namespace')
* @param string $subKey Field name to match the sub-level keys to (eg 'pl_title')
* @return string|bool SQL fragment, or false if no items in array
* Example: $dbr->buildLike( 'My_page_title/', $dbr->anyString() ) returns
* a LIKE clause that searches for subpages of 'My page title'.
* Alternatively:
- * $pattern = array( 'My_page_title/', $dbr->anyString() );
+ * $pattern = [ 'My_page_title/', $dbr->anyString() ];
* $query .= $dbr->buildLike( $pattern );
*
* @since 1.16
* to include in a join.
*
* @param array $varMap Must be an associative array of the form
- * array( 'dest1' => 'source1', ...). Source items may be literals
+ * [ 'dest1' => 'source1', ... ]. Source items may be literals
* rather than field names, but strings should be quoted with
* IDatabase::addQuotes()
*
*
* sectionLoads A 2-d map. For each section, gives a map of server names to
* load ratios. For example:
- * array(
- * 'section1' => array(
+ * [
+ * 'section1' => [
* 'db1' => 100,
* 'db2' => 100
- * )
- * )
+ * ]
+ * ]
*
* serverTemplate A server info associative array as documented for $wgDBservers.
* The host, hostName and load entries will be overridden.
*
* groupLoadsBySection A 3-d map giving server load ratios for each section and group.
* For example:
- * array(
- * 'section1' => array(
- * 'group1' => array(
+ * [
+ * 'section1' => [
+ * 'group1' => [
* 'db1' => 100,
* 'db2' => 100
- * )
- * )
- * )
+ * ]
+ * ]
+ * ]
*
* groupLoadsByDB A 3-d map giving server load ratios by DB name.
*
/**
* This can happen in code like:
* foreach ( $dbs as $db ) {
- * $conn = $lb->getConnection( DB_SLAVE, array(), $db );
+ * $conn = $lb->getConnection( DB_SLAVE, [], $db );
* ...
* $lb->reuseConnection( $conn );
* }
* `=` conditions while the final key uses a `>` condition
*
* Example output:
- * array( '( foo = 42 AND bar > 7 ) OR ( foo > 42 )' )
+ * [ '( foo = 42 AND bar > 7 ) OR ( foo > 42 )' ]
*
* @return array The SQL conditions necessary to select the next set
* of rows in the batched query