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, WantedCategoriesPage, WantedFilesPage, WantedPagesPage, and WantedTemplatesPage.

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 442 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 454 of file QueryPage.php.

References $dbr, $limit, $obj, $res, $sql, $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 285 of file QueryPage.php.

References $dbr, $fname, $limit, $offset, $res, $sql, $type, $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 536 of file QueryPage.php.

References wfMsgExt().

Referenced by doFeed().

QueryPage::feedItemAuthor ( row  ) 

Definition at line 525 of file QueryPage.php.

References $row.

Referenced by feedResult().

QueryPage::feedItemDesc ( row  ) 

Definition at line 521 of file QueryPage.php.

References $row.

Referenced by feedResult().

QueryPage::feedResult ( row  ) 

Override for custom handling.

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

Definition at line 496 of file QueryPage.php.

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

Referenced by doFeed().

QueryPage::feedTitle (  ) 

Definition at line 529 of file QueryPage.php.

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

Referenced by doFeed().

QueryPage::feedUrl (  ) 

Definition at line 540 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.

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

Definition at line 172 of file QueryPage.php.

Referenced by outputResults().

QueryPage::getName (  ) 

QueryPage::getOrder (  ) 

Reimplemented in BrokenRedirectsPage, DisambiguationsPage, DoubleRedirectsPage, and LinkSearchPage.

Definition at line 132 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.

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

Definition at line 179 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 121 of file QueryPage.php.

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

QueryPage::getTitle (  ) 

Return title object representing this page.

Returns:
Title

Definition at line 102 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:
bool

Definition at line 153 of file QueryPage.php.

References $wgMiserMode, and isExpensive().

Referenced by doQuery(), WantedTemplatesPage::formatResult(), WantedPagesPage::formatResult(), WantedFilesPage::formatResult(), WantedCategoriesPage::formatResult(), ShortPagesPage::formatResult(), and ShortPagesPage::preprocessResults().

QueryPage::isExpensive (  ) 

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 189 of file QueryPage.php.

Referenced by doQuery().

QueryPage::openList ( offset  ) 

Definition at line 438 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:
OutputPage $out OutputPage to print to
Skin $skin User skin to use
Database $dbr Database (read) connection to use
int $res Result pointer
int $num Number of available result rows
int $offset Paging offset

Reimplemented in ImageQueryPage.

Definition at line 391 of file QueryPage.php.

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

Referenced by doQuery().

QueryPage::preprocessResults ( db,
res 
)

Do any necessary preprocessing of the result object.

Reimplemented in MostlinkedPage, MostlinkedCategoriesPage, SpecialMostlinkedtemplates, ShortPagesPage, WantedCategoriesPage, WantedFilesPage, WantedPagesPage, and WantedTemplatesPage.

Definition at line 449 of file QueryPage.php.

Referenced by doQuery().

QueryPage::recache ( limit,
ignoreErrors = true 
)

Clear the cache and save new results.

Definition at line 206 of file QueryPage.php.

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

QueryPage::setListoutput ( bool  ) 

A mutator for $this->listoutput;.

Parameters:
bool $bool

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 199 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 Sep 5 02:08:45 2009 for MediaWiki by  doxygen 1.5.9