[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/specialpage/ -> QueryPage.php (summary)

Base code for "query" special pages. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

File Size: 754 lines (22 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 32 functions

  getPages()
  setListoutput()
  getQueryInfo()
  getSQL()
  getOrderFields()
  usesTimestamps()
  sortDescending()
  isExpensive()
  isCacheable()
  isCached()
  isSyndicated()
  getPageHeader()
  linkParameters()
  tryLastResult()
  recache()
  getRecacheDB()
  reallyDoQuery()
  doQuery()
  fetchFromCache()
  getCachedTimestamp()
  execute()
  outputResults()
  openList()
  closeList()
  preprocessResults()
  doFeed()
  feedResult()
  feedItemDesc()
  feedItemAuthor()
  feedTitle()
  feedDesc()
  feedUrl()

Functions
Functions that are not part of a class:

getPages()   X-Ref
Get a list of query page classes and their associated special pages,
for periodic updates.

DO NOT CHANGE THIS LIST without testing that
maintenance/updateSpecialPages.php still works.
return: array

setListoutput( $bool )   X-Ref
A mutator for $this->listoutput;

param: bool $bool

getQueryInfo()   X-Ref
Subclasses return an SQL query here, formatted as an array with the
following keys:
tables => Table(s) for passing to Database::select()
fields => Field(s) for passing to Database::select(), may be *
conds => WHERE conditions
options => options
join_conds => JOIN conditions

Note that the query itself should return the following three columns:
'namespace', 'title', and 'value'. 'value' is used for sorting.

These may be stored in the querycache table for expensive queries,
and that cached data will be returned sometimes, so the presence of
extra fields can't be relied upon. The cached 'value' column will be
an integer; non-numeric values are useful only for sorting the
initial query (except if they're timestamps, see usesTimestamps()).

Don't include an ORDER or LIMIT clause, they will be added.

If this function is not overridden or returns something other than
an array, getSQL() will be used instead. This is for backwards
compatibility only and is strongly deprecated.
return: array

getSQL()   X-Ref
For back-compat, subclasses may return a raw SQL query here, as a string.
This is strongly deprecated; getQueryInfo() should be overridden instead.

return: string

getOrderFields()   X-Ref
Subclasses return an array of fields to order by here. Don't append
DESC to the field names, that'll be done automatically if
sortDescending() returns true.

return: array

usesTimestamps()   X-Ref
Does this query return timestamps rather than integers in its
'value' field? If true, this class will convert 'value' to a
UNIX timestamp for caching.
NOTE: formatRow() may get timestamps in TS_MW (mysql), TS_DB (pgsql)
or TS_UNIX (querycache) format, so be sure to always run them
through wfTimestamp()

return: bool

sortDescending()   X-Ref
Override to sort by increasing values

return: bool

isExpensive()   X-Ref
Is this query expensive (for some definition of expensive)? Then we
don't let it run in miser mode. $wgDisableQueryPages causes all query
pages to be declared expensive. Some query pages are always expensive.

return: bool

isCacheable()   X-Ref
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: bool

isCached()   X-Ref
Whether or not the output of the page in question is retrieved from
the database cache.

return: bool

isSyndicated()   X-Ref
Sometime we don't want to build rss / atom feeds.

return: bool

getPageHeader()   X-Ref
The content returned by this function will be output before any result

return: string

linkParameters()   X-Ref
If using extra form wheely-dealies, return a set of parameters here
as an associative array. They will be encoded and added to the paging
links (prev/next/lengths).

return: array

tryLastResult()   X-Ref
Some special pages (for example SpecialListusers) might not return the
current object formatted, but return the previous one instead.
Setting this to return true will ensure formatResult() is called
one more time to make sure that the very last result is formatted
as well.

return: bool

recache( $limit, $ignoreErrors = true )   X-Ref
Clear the cache and save new results

param: int|bool $limit Limit for SQL statement
param: bool $ignoreErrors Whether to ignore database errors
return: bool|int

getRecacheDB()   X-Ref
Get a DB connection to be used for slow recache queries

return: DatabaseBase

reallyDoQuery( $limit, $offset = false )   X-Ref
Run the query and return the result

param: int|bool $limit Numerical limit or false for no limit
param: int|bool $offset Numerical offset or false for no offset
return: ResultWrapper

doQuery( $offset = false, $limit = false )   X-Ref
Somewhat deprecated, you probably want to be using execute()

param: int|bool $offset
param: int|bool $limit
return: ResultWrapper

fetchFromCache( $limit, $offset = false )   X-Ref
Fetch the query results from the query cache

param: int|bool $limit Numerical limit or false for no limit
param: int|bool $offset Numerical offset or false for no offset
return: ResultWrapper

getCachedTimestamp()   X-Ref
No description

execute( $par )   X-Ref
This is the actual workhorse. It does everything needed to make a
real, honest-to-gosh query page.

param: string $par

outputResults( $out, $skin, $dbr, $res, $num, $offset )   X-Ref
Format and output report results using the given information plus
OutputPage

param: OutputPage $out OutputPage to print to
param: Skin $skin User skin to use
param: DatabaseBase $dbr Database (read) connection to use
param: ResultWrapper $res Result pointer
param: int $num Number of available result rows
param: int $offset Paging offset

openList( $offset )   X-Ref

param: int $offset
return: string

closeList()   X-Ref

return: string

preprocessResults( $db, $res )   X-Ref
Do any necessary preprocessing of the result object.

param: DatabaseBase $db
param: ResultWrapper $res

doFeed( $class = '', $limit = 50 )   X-Ref
Similar to above, but packaging in a syndicated feed instead of a web page

param: string $class
param: int $limit
return: bool

feedResult( $row )   X-Ref
Override for custom handling. If the titles/links are ok, just do
feedItemDesc()

param: object $row
return: FeedItem|null

feedItemDesc( $row )   X-Ref
No description

feedItemAuthor( $row )   X-Ref
No description

feedTitle()   X-Ref
No description

feedDesc()   X-Ref
No description

feedUrl()   X-Ref
No description



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1