/**
* The offset and limit in use, as passed to the query() function
*
- * @var integer
+ * @var int
*/
var $offset = 0;
var $limit = 0;
/**
* A mutator for $this->listoutput;
*
- * @param $bool Boolean
+ * @param bool $bool
*/
function setListoutput( $bool ) {
$this->listoutput = $bool;
/**
* Override to sort by increasing values
*
- * @return Boolean
+ * @return bool
*/
function sortDescending() {
return true;
* don't let it run in miser mode. $wgDisableQueryPages causes all query
* pages to be declared expensive. Some query pages are always expensive.
*
- * @return Boolean
+ * @return bool
*/
function isExpensive() {
global $wgDisableQueryPages;
* Is the output of this query cacheable? Non-cacheable expensive pages
* will be disabled in miser mode and will not have their results written
* to the querycache table.
- * @return Boolean
+ * @return bool
* @since 1.18
*/
public function isCacheable() {
* Whether or not the output of the page in question is retrieved from
* the database cache.
*
- * @return Boolean
+ * @return bool
*/
function isCached() {
global $wgMiserMode;
/**
* Sometime we don't want to build rss / atom feeds.
*
- * @return Boolean
+ * @return bool
*/
function isSyndicated() {
return true;
* skin; you can use it for making links. The result is a single row of
* result data. You should be able to grab SQL results off of it.
* If the function returns false, the line output will be skipped.
- * @param $skin Skin
- * @param $result object Result row
- * @return mixed String or false to skip
- *
- * @param $skin Skin object
- * @param $result Object: database row
+ * @param Skin $skin
+ * @param object $result Result row
+ * @return string|bool String or false to skip
*/
abstract function formatResult( $skin, $result );
/**
* The content returned by this function will be output before any result
*
- * @return String
+ * @return string
*/
function getPageHeader() {
return '';
* as an associative array. They will be encoded and added to the paging
* links (prev/next/lengths).
*
- * @return Array
+ * @return array
*/
function linkParameters() {
return array();
/**
* Clear the cache and save new results
*
- * @param $limit Integer: limit for SQL statement
- * @param $ignoreErrors Boolean: whether to ignore database errors
+ * @param int|bool $limit Limit for SQL statement
+ * @param bool $ignoreErrors Whether to ignore database errors
+ * @throws DBError|Exception
* @return bool|int
*/
function recache( $limit, $ignoreErrors = true ) {
/**
* Run the query and return the result
- * @param $limit mixed Numerical limit or false for no limit
- * @param $offset mixed Numerical offset or false for no offset
+ * @param int|bool $limit Numerical limit or false for no limit
+ * @param int|bool $offset Numerical offset or false for no offset
* @return ResultWrapper
* @since 1.18
*/
$dbr = wfGetDB( DB_SLAVE );
$query = $this->getQueryInfo();
$order = $this->getOrderFields();
+
if ( $this->sortDescending() ) {
foreach ( $order as &$field ) {
$field .= ' DESC';
}
}
+
if ( is_array( $query ) ) {
$tables = isset( $query['tables'] ) ? (array)$query['tables'] : array();
$fields = isset( $query['fields'] ) ? (array)$query['fields'] : array();
$conds = isset( $query['conds'] ) ? (array)$query['conds'] : array();
$options = isset( $query['options'] ) ? (array)$query['options'] : array();
$join_conds = isset( $query['join_conds'] ) ? (array)$query['join_conds'] : array();
+
if ( count( $order ) ) {
$options['ORDER BY'] = $order;
}
+
if ( $limit !== false ) {
$options['LIMIT'] = intval( $limit );
}
+
if ( $offset !== false ) {
$options['OFFSET'] = intval( $offset );
}
$sql = $dbr->limitResult( $sql, $limit, $offset );
$res = $dbr->query( $sql, $fname );
}
+
return $dbr->resultObject( $res );
}
/**
* Somewhat deprecated, you probably want to be using execute()
+ * @param int|bool $offset
+ * @oaram int|bool $limit
* @return ResultWrapper
*/
function doQuery( $offset = false, $limit = false ) {
/**
* Fetch the query results from the query cache
- * @param $limit mixed Numerical limit or false for no limit
- * @param $offset mixed Numerical offset or false for no offset
+ * @param int|bool $limit Numerical limit or false for no limit
+ * @param int|bool $offset Numerical offset or false for no offset
* @return ResultWrapper
* @since 1.18
*/
/**
* This is the actual workhorse. It does everything needed to make a
* real, honest-to-gosh query page.
+ * @para $par
* @return int
*/
function execute( $par ) {
* Format and output report results using the given information plus
* OutputPage
*
- * @param $out OutputPage to print to
- * @param $skin Skin: user skin to use
- * @param $dbr Database (read) connection to use
- * @param $res Integer: result pointer
- * @param $num Integer: number of available result rows
- * @param $offset Integer: paging offset
+ * @param OutputPage $out OutputPage to print to
+ * @param Skin $skin User skin to use
+ * @param DatabaseBase $dbr Database (read) connection to use
+ * @param int $res Result pointer
+ * @param int $num Number of available result rows
+ * @param int $offset Paging offset
*/
protected function outputResults( $out, $skin, $dbr, $res, $num, $offset ) {
global $wgContLang;
/**
* Do any necessary preprocessing of the result object.
+ * @param DatabaseBase $db
+ * @param ResultWrapper $res
*/
function preprocessResults( $db, $res ) {}
/**
* Similar to above, but packaging in a syndicated feed instead of a web page
+ * @param string $class
+ * @param int $limit
* @return bool
*/
function doFeed( $class = '', $limit = 50 ) {
/**
* Override for custom handling. If the titles/links are ok, just do
* feedItemDesc()
+ * @param object $row
* @return FeedItem|null
*/
function feedResult( $row ) {
* WantedPages, WantedTemplates, etc
*/
abstract class WantedQueryPage extends QueryPage {
-
function isExpensive() {
return true;
}
/**
* Cache page existence for performance
+ * @param DatabaseBase $db
+ * @param ResultWrapper $res
*/
function preprocessResults( $db, $res ) {
if ( !$res->numRows() ) {
/**
* Format an individual result
*
- * @param $skin Skin to use for UI elements
- * @param $result Result row
+ * @param Skin $skin Skin to use for UI elements
+ * @param object $result Result row
* @return string
*/
public function formatResult( $skin, $result ) {
/**
* Make a "what links here" link for a given title
*
- * @param $title Title to make the link for
- * @param $result Object: result row
+ * @param Title $title Title to make the link for
+ * @param object $result Result row
* @return string
*/
private function makeWlhLink( $title, $result ) {