QueryPage Class Reference
[SpecialPage]

This is a class for doing query pages; since they're almost all the same, we factor out some of the functionality into a superclass, and let subclasses derive from it. More...

Inherited by AncientPagesPage, FewestrevisionsPage, FileDuplicateSearchPage, ImageQueryPage, LinkSearchPage, ListredirectsPage, MIMEsearchPage, MostcategoriesPage, MostlinkedCategoriesPage, MostlinkedPage, MostrevisionsPage, PageQueryPage, PopularPagesPage, ShortPagesPage, SpecialMostlinkedtemplates, UnusedCategoriesPage, UnusedtemplatesPage, UnwatchedpagesPage, and WantedQueryPage.

List of all members.

Public Member Functions

 setListoutput ($bool)
 A mutator for $this->listoutput;.
 getName ()
 Subclasses return their name here.
 getTitle ()
 Return title object representing this page.
 getSQL ()
 Subclasses return an SQL query here.
 sortDescending ()
 Override to sort by increasing values.
 getOrder ()
 isExpensive ()
 Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.
 isCached ()
 Whether or not the output of the page in question is retrived from the database cache.
 isSyndicated ()
 Sometime we dont want to build rss / atom feeds.
 formatResult ($skin, $result)
 Formats the results of the query for display.
 getPageHeader ()
 The content returned by this function will be output before any result.
 linkParameters ()
 If using extra form wheely-dealies, return a set of parameters here as an associative array.
 tryLastResult ()
 Some special pages (for example SpecialListusers) might not return the current object formatted, but return the previous one instead.
 recache ($limit, $ignoreErrors=true)
 Clear the cache and save new results.
 doQuery ($offset, $limit, $shownavigation=true)
 This is the actual workhorse.
 openList ($offset)
 closeList ()
 preprocessResults ($db, $res)
 Do any necessary preprocessing of the result object.
 doFeed ($class= '', $limit=50)
 Similar to above, but packaging in a syndicated feed instead of a web page.
 feedResult ($row)
 Override for custom handling.
 feedItemDesc ($row)
 feedItemAuthor ($row)
 feedTitle ()
 feedDesc ()
 feedUrl ()

Public Attributes

 $listoutput = false
 $offset = 0
 $limit = 0

Protected Member Functions

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


Detailed Description

This is a class for doing query pages; since they're almost all the same, we factor out some of the functionality into a superclass, and let subclasses derive from it.

Definition at line 63 of file QueryPage.php.


Member Function Documentation

QueryPage::closeList (  ) 

Definition at line 454 of file QueryPage.php.

Referenced by outputResults().

QueryPage::doFeed ( class = '',
limit = 50 
)

Similar to above, but packaging in a syndicated feed instead of a web page.

Definition at line 466 of file QueryPage.php.

References $dbr, $limit, $res, $wgFeed, $wgFeedClasses, $wgFeedLimit, $wgOut, feedDesc(), feedResult(), feedTitle(), feedUrl(), getOrder(), getSQL(), and wfGetDB().

QueryPage::doQuery ( offset,
limit,
shownavigation = true 
)

This is the actual workhorse.

It does everything needed to make a real, honest-to-gosh query page.

Parameters:
$offset database query offset
$limit database query limit
$shownavigation show navigation like "next 200"?

Reimplemented in LinkSearchPage.

Definition at line 295 of file QueryPage.php.

References $dbr, $fname, $limit, $offset, $res, $wgContLang, $wgDisableQueryPageUpdate, $wgLang, $wgOut, $wgUser, getName(), getOrder(), getPageHeader(), getSQL(), isCached(), isSyndicated(), linkParameters(), outputResults(), preprocessResults(), wfArrayToCGI(), wfGetDB(), wfMsgHtml(), wfShowingResults(), and wfViewPrevNext().

QueryPage::feedDesc (  ) 

Definition at line 548 of file QueryPage.php.

References wfMsgExt().

Referenced by doFeed().

QueryPage::feedItemAuthor ( row  ) 

Definition at line 537 of file QueryPage.php.

Referenced by feedResult().

QueryPage::feedItemDesc ( row  ) 

Definition at line 533 of file QueryPage.php.

Referenced by feedResult().

QueryPage::feedResult ( row  ) 

Override for custom handling.

If the titles/links are ok, just do feedItemDesc()

Definition at line 508 of file QueryPage.php.

References $title, feedItemAuthor(), and feedItemDesc().

Referenced by doFeed().

QueryPage::feedTitle (  ) 

Definition at line 541 of file QueryPage.php.

References $page, $wgContLanguageCode, $wgSitename, getName(), and SpecialPage::getPage().

Referenced by doFeed().

QueryPage::feedUrl (  ) 

Definition at line 552 of file QueryPage.php.

References $title, getName(), and SpecialPage::getTitleFor().

Referenced by doFeed().

QueryPage::formatResult ( skin,
result 
)

Formats the results of the query for display.

The skin is the current 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 return "false", the line output will be skipped.

Parameters:
$skin Skin object
$result Object: database row

Reimplemented in PageQueryPage, WantedQueryPage, AncientPagesPage, BrokenRedirectsPage, DisambiguationsPage, DoubleRedirectsPage, FewestrevisionsPage, FileDuplicateSearchPage, LinkSearchPage, ListredirectsPage, MIMEsearchPage, MostcategoriesPage, MostlinkedPage, MostlinkedCategoriesPage, SpecialMostlinkedtemplates, MostrevisionsPage, PopularPagesPage, ShortPagesPage, UnusedCategoriesPage, UnusedtemplatesPage, UnwatchedpagesPage, and WantedCategoriesPage.

Definition at line 183 of file QueryPage.php.

Referenced by outputResults().

QueryPage::getName (  ) 

QueryPage::getOrder (  ) 

Reimplemented in BrokenRedirectsPage, DisambiguationsPage, DoubleRedirectsPage, and LinkSearchPage.

Definition at line 136 of file QueryPage.php.

References sortDescending().

Referenced by doFeed(), doQuery(), and recache().

QueryPage::getPageHeader (  ) 

The content returned by this function will be output before any result.

Returns:
String

Reimplemented in BrokenRedirectsPage, DeadendPagesPage, DisambiguationsPage, DoubleRedirectsPage, LonelyPagesPage, UnusedCategoriesPage, UnusedimagesPage, UnusedtemplatesPage, and WithoutInterwikiPage.

Definition at line 192 of file QueryPage.php.

Referenced by doQuery().

QueryPage::getSQL (  ) 

Subclasses return an SQL query here.

Note that the query itself should return the following four columns: 'type' (your special page's name), 'namespace', 'title', and 'value' *in that order*. '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.

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

Reimplemented in AncientPagesPage, BrokenRedirectsPage, DeadendPagesPage, DisambiguationsPage, DoubleRedirectsPage, FileDuplicateSearchPage, LinkSearchPage, ListredirectsPage, LonelyPagesPage, MIMEsearchPage, MostcategoriesPage, MostimagesPage, MostlinkedPage, MostlinkedCategoriesPage, MostrevisionsPage, PopularPagesPage, ShortPagesPage, UncategorizedImagesPage, UncategorizedPagesPage, UnusedCategoriesPage, UnusedimagesPage, UnusedtemplatesPage, UnwatchedpagesPage, WantedCategoriesPage, WantedFilesPage, WantedPagesPage, WantedTemplatesPage, and WithoutInterwikiPage.

Definition at line 123 of file QueryPage.php.

Referenced by doFeed(), doQuery(), and recache().

QueryPage::getTitle (  ) 

Return title object representing this page.

Returns:
Title

Definition at line 104 of file QueryPage.php.

References getName(), and SpecialPage::getTitleFor().

QueryPage::isCached (  ) 

Whether or not the output of the page in question is retrived from the database cache.

Returns:
Boolean

Definition at line 159 of file QueryPage.php.

References $wgMiserMode, and isExpensive().

Referenced by doQuery(), WantedCategoriesPage::formatResult(), ShortPagesPage::formatResult(), WantedQueryPage::formatResult(), and ShortPagesPage::preprocessResults().

QueryPage::isExpensive (  ) 

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.

Returns:
Boolean

Reimplemented in WantedQueryPage, AncientPagesPage, BrokenRedirectsPage, DeadendPagesPage, DisambiguationsPage, DoubleRedirectsPage, FewestrevisionsPage, FileDuplicateSearchPage, ListredirectsPage, LonelyPagesPage, MIMEsearchPage, MostcategoriesPage, MostimagesPage, MostlinkedPage, MostlinkedCategoriesPage, SpecialMostlinkedtemplates, MostrevisionsPage, PopularPagesPage, ShortPagesPage, UncategorizedImagesPage, UncategorizedPagesPage, UnusedCategoriesPage, UnusedimagesPage, UnusedtemplatesPage, UnwatchedpagesPage, and WithoutInterwikiPage.

Definition at line 148 of file QueryPage.php.

References $wgDisableQueryPages.

Referenced by isCached().

QueryPage::isSyndicated (  ) 

QueryPage::linkParameters (  ) 

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).

Returns:
Array

Reimplemented in FileDuplicateSearchPage, LinkSearchPage, and MIMEsearchPage.

Definition at line 203 of file QueryPage.php.

Referenced by doQuery().

QueryPage::openList ( offset  ) 

Definition at line 450 of file QueryPage.php.

References $offset.

Referenced by outputResults().

QueryPage::outputResults ( out,
skin,
dbr,
res,
num,
offset 
) [protected]

Format and output report results using the given information plus OutputPage.

Parameters:
$out OutputPage to print to
$skin Skin: user skin to use
$dbr Database (read) connection to use
$res Integer: result pointer
$num Integer: number of available result rows
$offset Integer: paging offset

Reimplemented in ImageQueryPage.

Definition at line 403 of file QueryPage.php.

References $dbr, $i, $offset, $out, $res, $wgContLang, closeList(), formatResult(), openList(), and tryLastResult().

Referenced by doQuery().

QueryPage::preprocessResults ( db,
res 
)

Do any necessary preprocessing of the result object.

Reimplemented in WantedQueryPage, MostlinkedPage, MostlinkedCategoriesPage, SpecialMostlinkedtemplates, and ShortPagesPage.

Definition at line 461 of file QueryPage.php.

Referenced by doQuery().

QueryPage::recache ( limit,
ignoreErrors = true 
)

Clear the cache and save new results.

Parameters:
$limit Integer: limit for SQL statement
$ignoreErrors Boolean: whether to ignore database errors

Definition at line 223 of file QueryPage.php.

References $dbr, $dbw, $fname, $limit, $res, getName(), getOrder(), getSQL(), and wfGetDB().

QueryPage::setListoutput ( bool  ) 

A mutator for $this->listoutput;.

Parameters:
$bool Boolean

Definition at line 84 of file QueryPage.php.

Referenced by WantedPagesPage::WantedPagesPage().

QueryPage::sortDescending (  ) 

QueryPage::tryLastResult (  ) 

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 call one more time wfFormatResult to be sure that the very last result is formatted and shown.

Definition at line 213 of file QueryPage.php.

Referenced by outputResults().


Member Data Documentation

QueryPage::$limit = 0

Definition at line 77 of file QueryPage.php.

Referenced by doFeed(), LinkSearchPage::doQuery(), doQuery(), and recache().

QueryPage::$listoutput = false

Definition at line 69 of file QueryPage.php.

QueryPage::$offset = 0

Definition at line 76 of file QueryPage.php.

Referenced by LinkSearchPage::doQuery(), doQuery(), openList(), and outputResults().


The documentation for this class was generated from the following file:

Generated on Sat Apr 30 22:57:47 2011 for MediaWiki by  doxygen 1.5.9