MediaWiki  master
QueryPage.php
Go to the documentation of this file.
1 <?php
29 
36 abstract class QueryPage extends SpecialPage {
38  protected $listoutput = false;
39 
41  protected $offset = 0;
42 
44  protected $limit = 0;
45 
53  protected $numRows;
54 
58  protected $cachedTimestamp = null;
59 
63  protected $shownavigation = true;
64 
74  public static function getPages() {
75  static $qp = null;
76 
77  if ( $qp === null ) {
78  // QueryPage subclass, Special page name
79  $qp = [
80  [ SpecialAncientPages::class, 'Ancientpages' ],
81  [ SpecialBrokenRedirects::class, 'BrokenRedirects' ],
82  [ SpecialDeadendPages::class, 'Deadendpages' ],
83  [ SpecialDoubleRedirects::class, 'DoubleRedirects' ],
84  [ SpecialFileDuplicateSearch::class, 'FileDuplicateSearch' ],
85  [ SpecialListDuplicatedFiles::class, 'ListDuplicatedFiles' ],
86  [ SpecialLinkSearch::class, 'LinkSearch' ],
87  [ SpecialListRedirects::class, 'Listredirects' ],
88  [ SpecialLonelyPages::class, 'Lonelypages' ],
89  [ SpecialLongPages::class, 'Longpages' ],
90  [ SpecialMediaStatistics::class, 'MediaStatistics' ],
91  [ SpecialMIMESearch::class, 'MIMEsearch' ],
92  [ SpecialMostCategories::class, 'Mostcategories' ],
93  [ MostimagesPage::class, 'Mostimages' ],
94  [ SpecialMostInterwikis::class, 'Mostinterwikis' ],
95  [ SpecialMostLinkedCategories::class, 'Mostlinkedcategories' ],
96  [ SpecialMostLinkedTemplates::class, 'Mostlinkedtemplates' ],
97  [ SpecialMostLinked::class, 'Mostlinked' ],
98  [ SpecialMostRevisions::class, 'Mostrevisions' ],
99  [ SpecialFewestRevisions::class, 'Fewestrevisions' ],
100  [ SpecialShortPages::class, 'Shortpages' ],
101  [ SpecialUncategorizedCategories::class, 'Uncategorizedcategories' ],
102  [ SpecialUncategorizedPages::class, 'Uncategorizedpages' ],
103  [ SpecialUncategorizedImages::class, 'Uncategorizedimages' ],
104  [ SpecialUncategorizedTemplates::class, 'Uncategorizedtemplates' ],
105  [ SpecialUnusedCategories::class, 'Unusedcategories' ],
106  [ SpecialUnusedImages::class, 'Unusedimages' ],
107  [ SpecialWantedCategories::class, 'Wantedcategories' ],
108  [ WantedFilesPage::class, 'Wantedfiles' ],
109  [ WantedPagesPage::class, 'Wantedpages' ],
110  [ SpecialWantedTemplates::class, 'Wantedtemplates' ],
111  [ SpecialUnwatchedPages::class, 'Unwatchedpages' ],
112  [ SpecialUnusedTemplates::class, 'Unusedtemplates' ],
113  [ SpecialWithoutInterwiki::class, 'Withoutinterwiki' ],
114  ];
115  Hooks::runner()->onWgQueryPages( $qp );
116  }
117 
118  return $qp;
119  }
120 
126  public static function getDisabledQueryPages( Config $config ) {
127  $disableQueryPageUpdate = $config->get( 'DisableQueryPageUpdate' );
128 
129  if ( !is_array( $disableQueryPageUpdate ) ) {
130  return [];
131  }
132 
133  $pages = [];
134  foreach ( $disableQueryPageUpdate as $name => $runMode ) {
135  if ( is_int( $name ) ) {
136  // The run mode may be omitted
137  $pages[$runMode] = 'disabled';
138  } else {
139  $pages[$name] = $runMode;
140  }
141  }
142  return $pages;
143  }
144 
150  protected function setListoutput( $bool ) {
151  $this->listoutput = $bool;
152  }
153 
180  public function getQueryInfo() {
181  return null;
182  }
183 
190  protected function getSQL() {
191  /* Implement getQueryInfo() instead */
192  throw new MWException( "Bug in a QueryPage: doesn't implement getQueryInfo() nor "
193  . "getQuery() properly" );
194  }
195 
203  protected function getOrderFields() {
204  return [ 'value' ];
205  }
206 
217  public function usesTimestamps() {
218  return false;
219  }
220 
226  protected function sortDescending() {
227  return true;
228  }
229 
237  public function isExpensive() {
238  return $this->getConfig()->get( 'DisableQueryPages' );
239  }
240 
248  public function isCacheable() {
249  return true;
250  }
251 
258  public function isCached() {
259  return $this->isExpensive() && $this->getConfig()->get( 'MiserMode' );
260  }
261 
267  public function isSyndicated() {
268  return true;
269  }
270 
280  abstract protected function formatResult( $skin, $result );
281 
287  protected function getPageHeader() {
288  return '';
289  }
290 
298  protected function showEmptyText() {
299  $this->getOutput()->addWikiMsg( 'specialpage-empty' );
300  }
301 
309  protected function linkParameters() {
310  return [];
311  }
312 
321  public function recache( $limit, $ignoreErrors = true ) {
322  if ( !$this->isCacheable() ) {
323  return 0;
324  }
325 
326  $fname = static::class . '::recache';
327  $dbw = wfGetDB( DB_MASTER );
328  if ( !$dbw ) {
329  return false;
330  }
331 
332  try {
333  # Do query
334  $res = $this->reallyDoQuery( $limit, false );
335  $num = false;
336  if ( $res ) {
337  $num = $res->numRows();
338  # Fetch results
339  $vals = [];
340  foreach ( $res as $i => $row ) {
341  if ( isset( $row->value ) ) {
342  if ( $this->usesTimestamps() ) {
343  $value = wfTimestamp( TS_UNIX,
344  $row->value );
345  } else {
346  $value = intval( $row->value ); // T16414
347  }
348  } else {
349  $value = $i;
350  }
351 
352  $vals[] = [
353  'qc_type' => $this->getName(),
354  'qc_namespace' => $row->namespace,
355  'qc_title' => $row->title,
356  'qc_value' => $value
357  ];
358  }
359 
360  $dbw->doAtomicSection(
361  __METHOD__,
362  function ( IDatabase $dbw, $fname ) use ( $vals ) {
363  # Clear out any old cached data
364  $dbw->delete( 'querycache',
365  [ 'qc_type' => $this->getName() ],
366  $fname
367  );
368  # Save results into the querycache table on the master
369  if ( count( $vals ) ) {
370  $dbw->insert( 'querycache', $vals, $fname );
371  }
372  # Update the querycache_info record for the page
373  $dbw->delete( 'querycache_info',
374  [ 'qci_type' => $this->getName() ],
375  $fname
376  );
377  $dbw->insert( 'querycache_info',
378  [ 'qci_type' => $this->getName(),
379  'qci_timestamp' => $dbw->timestamp() ],
380  $fname
381  );
382  }
383  );
384  }
385  } catch ( DBError $e ) {
386  if ( !$ignoreErrors ) {
387  throw $e; // report query error
388  }
389  $num = false; // set result to false to indicate error
390  }
391 
392  return $num;
393  }
394 
399  protected function getRecacheDB() {
400  return wfGetDB( DB_REPLICA, [ $this->getName(), 'QueryPage::recache', 'vslow' ] );
401  }
402 
409  public function delete( LinkTarget $title ) {
410  if ( $this->isCached() ) {
411  $dbw = wfGetDB( DB_MASTER );
412  $dbw->delete( 'querycache', [
413  'qc_type' => $this->getName(),
414  'qc_namespace' => $title->getNamespace(),
415  'qc_title' => $title->getDBkey(),
416  ], __METHOD__ );
417  }
418  }
419 
427  public function reallyDoQuery( $limit, $offset = false ) {
428  $fname = static::class . '::reallyDoQuery';
429  $dbr = $this->getRecacheDB();
430  $query = $this->getQueryInfo();
431  $order = $this->getOrderFields();
432 
433  if ( $this->sortDescending() ) {
434  foreach ( $order as &$field ) {
435  $field .= ' DESC';
436  }
437  }
438 
439  if ( is_array( $query ) ) {
440  $tables = isset( $query['tables'] ) ? (array)$query['tables'] : [];
441  $fields = isset( $query['fields'] ) ? (array)$query['fields'] : [];
442  $conds = isset( $query['conds'] ) ? (array)$query['conds'] : [];
443  $options = isset( $query['options'] ) ? (array)$query['options'] : [];
444  $join_conds = isset( $query['join_conds'] ) ? (array)$query['join_conds'] : [];
445 
446  if ( $order ) {
447  $options['ORDER BY'] = $order;
448  }
449 
450  if ( $limit !== false ) {
451  $options['LIMIT'] = intval( $limit );
452  }
453 
454  if ( $offset !== false ) {
455  $options['OFFSET'] = intval( $offset );
456  }
457 
458  $res = $dbr->select( $tables, $fields, $conds, $fname,
459  $options, $join_conds
460  );
461  } else {
462  // Old-fashioned raw SQL style, deprecated
463  $sql = $this->getSQL();
464  $sql .= ' ORDER BY ' . implode( ', ', $order );
465  $sql = $dbr->limitResult( $sql, $limit, $offset );
466  $res = $dbr->query( $sql, $fname );
467  }
468 
469  return $res;
470  }
471 
478  public function doQuery( $offset = false, $limit = false ) {
479  if ( $this->isCached() && $this->isCacheable() ) {
480  return $this->fetchFromCache( $limit, $offset );
481  } else {
482  return $this->reallyDoQuery( $limit, $offset );
483  }
484  }
485 
493  public function fetchFromCache( $limit, $offset = false ) {
494  $dbr = wfGetDB( DB_REPLICA );
495  $options = [];
496 
497  if ( $limit !== false ) {
498  $options['LIMIT'] = intval( $limit );
499  }
500 
501  if ( $offset !== false ) {
502  $options['OFFSET'] = intval( $offset );
503  }
504 
505  $order = $this->getCacheOrderFields();
506  if ( $this->sortDescending() ) {
507  foreach ( $order as &$field ) {
508  $field .= " DESC";
509  }
510  }
511  if ( $order ) {
512  $options['ORDER BY'] = $order;
513  }
514 
515  return $dbr->select( 'querycache',
516  [ 'qc_type',
517  'namespace' => 'qc_namespace',
518  'title' => 'qc_title',
519  'value' => 'qc_value' ],
520  [ 'qc_type' => $this->getName() ],
521  __METHOD__,
522  $options
523  );
524  }
525 
532  protected function getCacheOrderFields() {
533  return [ 'value' ];
534  }
535 
539  public function getCachedTimestamp() {
540  if ( $this->cachedTimestamp === null ) {
541  $dbr = wfGetDB( DB_REPLICA );
542  $fname = static::class . '::getCachedTimestamp';
543  $this->cachedTimestamp = $dbr->selectField( 'querycache_info', 'qci_timestamp',
544  [ 'qci_type' => $this->getName() ], $fname );
545  }
546  return $this->cachedTimestamp;
547  }
548 
561  protected function getLimitOffset() {
562  list( $limit, $offset ) = $this->getRequest()
563  ->getLimitOffsetForUser( $this->getUser() );
564  if ( $this->getConfig()->get( 'MiserMode' ) ) {
565  $maxResults = $this->getMaxResults();
566  // Can't display more than max results on a page
567  $limit = min( $limit, $maxResults );
568  // Can't skip over more than the end of $maxResults
569  $offset = min( $offset, $maxResults + 1 );
570  }
571  return [ $limit, $offset ];
572  }
573 
582  protected function getDBLimit( $uiLimit, $uiOffset ) {
583  $maxResults = $this->getMaxResults();
584  if ( $this->getConfig()->get( 'MiserMode' ) ) {
585  $limit = min( $uiLimit + 1, $maxResults - $uiOffset );
586  return max( $limit, 0 );
587  } else {
588  return $uiLimit + 1;
589  }
590  }
591 
601  protected function getMaxResults() {
602  // Max of 10000, unless we store more than 10000 in query cache.
603  return max( $this->getConfig()->get( 'QueryCacheLimit' ), 10000 );
604  }
605 
611  public function execute( $par ) {
612  $user = $this->getUser();
613  if ( !$this->userCanExecute( $user ) ) {
614  $this->displayRestrictionError();
615  return;
616  }
617 
618  $this->setHeaders();
619  $this->outputHeader();
620 
621  $out = $this->getOutput();
622 
623  if ( $this->isCached() && !$this->isCacheable() ) {
624  $out->addWikiMsg( 'querypage-disabled' );
625  return;
626  }
627 
628  $out->setSyndicated( $this->isSyndicated() );
629 
630  if ( $this->limit == 0 && $this->offset == 0 ) {
631  list( $this->limit, $this->offset ) = $this->getLimitOffset();
632  }
633  $dbLimit = $this->getDBLimit( $this->limit, $this->offset );
634  // @todo Use doQuery()
635  if ( !$this->isCached() ) {
636  # select one extra row for navigation
637  $res = $this->reallyDoQuery( $dbLimit, $this->offset );
638  } else {
639  # Get the cached result, select one extra row for navigation
640  $res = $this->fetchFromCache( $dbLimit, $this->offset );
641  if ( !$this->listoutput ) {
642  # Fetch the timestamp of this update
643  $ts = $this->getCachedTimestamp();
644  $lang = $this->getLanguage();
645  $maxResults = $lang->formatNum( $this->getConfig()->get( 'QueryCacheLimit' ) );
646 
647  if ( $ts ) {
648  $updated = $lang->userTimeAndDate( $ts, $user );
649  $updateddate = $lang->userDate( $ts, $user );
650  $updatedtime = $lang->userTime( $ts, $user );
651  $out->addMeta( 'Data-Cache-Time', $ts );
652  $out->addJsConfigVars( 'dataCacheTime', $ts );
653  $out->addWikiMsg( 'perfcachedts', $updated, $updateddate, $updatedtime, $maxResults );
654  } else {
655  $out->addWikiMsg( 'perfcached', $maxResults );
656  }
657 
658  # If updates on this page have been disabled, let the user know
659  # that the data set won't be refreshed for now
660  $disabledQueryPages = self::getDisabledQueryPages( $this->getConfig() );
661  if ( isset( $disabledQueryPages[$this->getName()] ) ) {
662  $runMode = $disabledQueryPages[$this->getName()];
663  if ( $runMode === 'disabled' ) {
664  $out->wrapWikiMsg(
665  "<div class=\"mw-querypage-no-updates\">\n$1\n</div>",
666  'querypage-no-updates'
667  );
668  } else {
669  // Messages used here: querypage-updates-periodical
670  $out->wrapWikiMsg(
671  "<div class=\"mw-querypage-updates-" . $runMode . "\">\n$1\n</div>",
672  'querypage-updates-' . $runMode
673  );
674  }
675  }
676  }
677  }
678 
679  $this->numRows = $res->numRows();
680 
681  $dbr = $this->getRecacheDB();
682  $this->preprocessResults( $dbr, $res );
683 
684  $out->addHTML( Xml::openElement( 'div', [ 'class' => 'mw-spcontent' ] ) );
685 
686  # Top header and navigation
687  if ( $this->shownavigation ) {
688  $out->addHTML( $this->getPageHeader() );
689  if ( $this->numRows > 0 ) {
690  $out->addHTML( $this->msg( 'showingresultsinrange' )->numParams(
691  min( $this->numRows, $this->limit ), # do not show the one extra row, if exist
692  $this->offset + 1, ( min( $this->numRows, $this->limit ) + $this->offset ) )->parseAsBlock() );
693  # Disable the "next" link when we reach the end
694  $miserMaxResults = $this->getConfig()->get( 'MiserMode' )
695  && ( $this->offset + $this->limit >= $this->getMaxResults() );
696  $atEnd = ( $this->numRows <= $this->limit ) || $miserMaxResults;
697  $paging = $this->buildPrevNextNavigation( $this->offset,
698  $this->limit, $this->linkParameters(), $atEnd, $par );
699  $out->addHTML( '<p>' . $paging . '</p>' );
700  } else {
701  # No results to show, so don't bother with "showing X of Y" etc.
702  # -- just let the user know and give up now
703  $this->showEmptyText();
704  $out->addHTML( Xml::closeElement( 'div' ) );
705  return;
706  }
707  }
708 
709  # The actual results; specialist subclasses will want to handle this
710  # with more than a straight list, so we hand them the info, plus
711  # an OutputPage, and let them get on with it
712  $this->outputResults( $out,
713  $this->getSkin(),
714  $dbr, # Should use IResultWrapper for this
715  $res,
716  min( $this->numRows, $this->limit ), # do not format the one extra row, if exist
717  $this->offset );
718 
719  # Repeat the paging links at the bottom
720  if ( $this->shownavigation ) {
721  $out->addHTML( '<p>' . $paging . '</p>' );
722  }
723 
724  $out->addHTML( Xml::closeElement( 'div' ) );
725  }
726 
738  protected function outputResults( $out, $skin, $dbr, $res, $num, $offset ) {
739  if ( $num > 0 ) {
740  $html = [];
741  if ( !$this->listoutput ) {
742  $html[] = $this->openList( $offset );
743  }
744 
745  # $res might contain the whole 1,000 rows, so we read up to
746  # $num [should update this to use a Pager]
747  for ( $i = 0; $i < $num && $row = $res->fetchObject(); $i++ ) {
748  $line = $this->formatResult( $skin, $row );
749  if ( $line ) {
750  $html[] = $this->listoutput
751  ? $line
752  : "<li>{$line}</li>\n";
753  }
754  }
755 
756  if ( !$this->listoutput ) {
757  $html[] = $this->closeList();
758  }
759 
760  $html = $this->listoutput
761  ? MediaWikiServices::getInstance()->getContentLanguage()->listToText( $html )
762  : implode( '', $html );
763 
764  $out->addHTML( $html );
765  }
766  }
767 
772  protected function openList( $offset ) {
773  return "\n<ol start='" . ( $offset + 1 ) . "' class='special'>\n";
774  }
775 
779  protected function closeList() {
780  return "</ol>\n";
781  }
782 
788  protected function preprocessResults( $db, $res ) {
789  }
790 
801  protected function executeLBFromResultWrapper( IResultWrapper $res, $ns = null ) {
802  if ( !$res->numRows() ) {
803  return;
804  }
805 
806  $batch = new LinkBatch;
807  foreach ( $res as $row ) {
808  $batch->add( $ns ?? $row->namespace, $row->title );
809  }
810  $batch->execute();
811 
812  $res->seek( 0 );
813  }
814 }
QueryPage\setListoutput
setListoutput( $bool)
A mutator for $this->listoutput;.
Definition: QueryPage.php:150
QueryPage\$listoutput
bool $listoutput
Whether or not we want plain listoutput rather than an ordered list.
Definition: QueryPage.php:38
SpecialPage\msg
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
Definition: SpecialPage.php:800
QueryPage\getCacheOrderFields
getCacheOrderFields()
Return the order fields for fetchFromCache.
Definition: QueryPage.php:532
LinkBatch
Class representing a list of titles The execute() method checks them all for existence and adds them ...
Definition: LinkBatch.php:35
LinkBatch\add
add( $ns, $dbkey)
Definition: LinkBatch.php:130
SpecialPage\getOutput
getOutput()
Get the OutputPage being used for this instance.
Definition: SpecialPage.php:716
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:146
$lang
if(!isset( $args[0])) $lang
Definition: testCompression.php:37
QueryPage\isCacheable
isCacheable()
Is the output of this query cacheable? Non-cacheable expensive pages will be disabled in miser mode a...
Definition: QueryPage.php:248
QueryPage\getPageHeader
getPageHeader()
The content returned by this function will be output before any result.
Definition: QueryPage.php:287
wfTimestamp
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Definition: GlobalFunctions.php:1806
QueryPage\linkParameters
linkParameters()
If using extra form wheely-dealies, return a set of parameters here as an associative array.
Definition: QueryPage.php:309
QueryPage\formatResult
formatResult( $skin, $result)
Formats the results of the query for display.
QueryPage\outputResults
outputResults( $out, $skin, $dbr, $res, $num, $offset)
Format and output report results using the given information plus OutputPage.
Definition: QueryPage.php:738
QueryPage\getLimitOffset
getLimitOffset()
Returns limit and offset, as returned by $this->getRequest()->getLimitOffsetForUser().
Definition: QueryPage.php:561
SpecialPage\displayRestrictionError
displayRestrictionError()
Output an error message telling the user what access level they have to have.
Definition: SpecialPage.php:317
QueryPage\openList
openList( $offset)
Definition: QueryPage.php:772
QueryPage\preprocessResults
preprocessResults( $db, $res)
Do any necessary preprocessing of the result object.
Definition: QueryPage.php:788
QueryPage\execute
execute( $par)
This is the actual workhorse.
Definition: QueryPage.php:611
SpecialPage\getSkin
getSkin()
Shortcut to get the skin being used for this instance.
Definition: SpecialPage.php:736
SpecialPage\getLanguage
getLanguage()
Shortcut to get user's language.
Definition: SpecialPage.php:746
$res
$res
Definition: testCompression.php:57
SpecialPage\getName
getName()
Get the name of this Special Page.
Definition: SpecialPage.php:160
Wikimedia\Rdbms\DBError
Database error base class.
Definition: DBError.php:30
QueryPage\reallyDoQuery
reallyDoQuery( $limit, $offset=false)
Run the query and return the result.
Definition: QueryPage.php:427
QueryPage
This is a class for doing query pages; since they're almost all the same, we factor out some of the f...
Definition: QueryPage.php:36
Xml\openElement
static openElement( $element, $attribs=null)
This opens an XML element.
Definition: Xml.php:108
QueryPage\executeLBFromResultWrapper
executeLBFromResultWrapper(IResultWrapper $res, $ns=null)
Creates a new LinkBatch object, adds all pages from the passed result wrapper (MUST include title and...
Definition: QueryPage.php:801
QueryPage\$offset
int $offset
The offset and limit in use, as passed to the query() function.
Definition: QueryPage.php:41
Wikimedia\Rdbms\IDatabase
Basic database interface for live and lazy-loaded relation database handles.
Definition: IDatabase.php:38
$dbr
$dbr
Definition: testCompression.php:54
QueryPage\$limit
int $limit
Definition: QueryPage.php:44
QueryPage\getCachedTimestamp
getCachedTimestamp()
Definition: QueryPage.php:539
QueryPage\closeList
closeList()
Definition: QueryPage.php:779
Config
Interface for configuration instances.
Definition: Config.php:28
Wikimedia\Rdbms\IDatabase\timestamp
timestamp( $ts=0)
Convert a timestamp in one of the formats accepted by ConvertibleTimestamp to the format used for ins...
MWException
MediaWiki exception.
Definition: MWException.php:26
SpecialPage\getConfig
getConfig()
Shortcut to get main config object.
Definition: SpecialPage.php:766
QueryPage\getMaxResults
getMaxResults()
Get max number of results we can return in miser mode.
Definition: QueryPage.php:601
QueryPage\$cachedTimestamp
string null $cachedTimestamp
Definition: QueryPage.php:58
Wikimedia\Rdbms\IResultWrapper
Result wrapper for grabbing data queried from an IDatabase object.
Definition: IResultWrapper.php:24
Config\get
get( $name)
Get a configuration variable such as "Sitename" or "UploadMaintenance.".
QueryPage\isCached
isCached()
Whether or not the output of the page in question is retrieved from the database cache.
Definition: QueryPage.php:258
wfGetDB
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:2463
QueryPage\$shownavigation
bool $shownavigation
Whether to show prev/next links.
Definition: QueryPage.php:63
QueryPage\isExpensive
isExpensive()
Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.
Definition: QueryPage.php:237
QueryPage\recache
recache( $limit, $ignoreErrors=true)
Clear the cache and save new results.
Definition: QueryPage.php:321
$title
$title
Definition: testCompression.php:38
SpecialPage\setHeaders
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
Definition: SpecialPage.php:551
SpecialPage\getUser
getUser()
Shortcut to get the User executing this instance.
Definition: SpecialPage.php:726
DB_REPLICA
const DB_REPLICA
Definition: defines.php:25
DB_MASTER
const DB_MASTER
Definition: defines.php:26
QueryPage\getRecacheDB
getRecacheDB()
Get a DB connection to be used for slow recache queries.
Definition: QueryPage.php:399
QueryPage\$numRows
int $numRows
The number of rows returned by the query.
Definition: QueryPage.php:53
QueryPage\getQueryInfo
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
Definition: QueryPage.php:180
QueryPage\getOrderFields
getOrderFields()
Subclasses return an array of fields to order by here.
Definition: QueryPage.php:203
SpecialPage\userCanExecute
userCanExecute(User $user)
Checks if the given user (identified by an object) can execute this special page (as defined by $mRes...
Definition: SpecialPage.php:307
SpecialPage
Parent class for all special pages.
Definition: SpecialPage.php:39
Hooks\runner
static runner()
Get a HookRunner instance for calling hooks using the new interfaces.
Definition: Hooks.php:171
QueryPage\doQuery
doQuery( $offset=false, $limit=false)
Somewhat deprecated, you probably want to be using execute()
Definition: QueryPage.php:478
$line
$line
Definition: mcc.php:119
SpecialPage\buildPrevNextNavigation
buildPrevNextNavigation( $offset, $limit, array $query=[], $atend=false, $subpage=false)
Generate (prev x| next x) (20|50|100...) type links for paging.
Definition: SpecialPage.php:938
QueryPage\fetchFromCache
fetchFromCache( $limit, $offset=false)
Fetch the query results from the query cache.
Definition: QueryPage.php:493
SpecialPage\getRequest
getRequest()
Get the WebRequest being used for this instance.
Definition: SpecialPage.php:706
QueryPage\showEmptyText
showEmptyText()
Outputs some kind of an informative message (via OutputPage) to let the user know that the query retu...
Definition: QueryPage.php:298
Wikimedia\Rdbms\IDatabase\insert
insert( $table, $rows, $fname=__METHOD__, $options=[])
Insert the given row(s) into a table.
QueryPage\getDisabledQueryPages
static getDisabledQueryPages(Config $config)
Get a list of query pages disabled and with it's run mode.
Definition: QueryPage.php:126
QueryPage\isSyndicated
isSyndicated()
Sometime we don't want to build rss / atom feeds.
Definition: QueryPage.php:267
QueryPage\getSQL
getSQL()
For back-compat, subclasses may return a raw SQL query here, as a string.
Definition: QueryPage.php:190
Xml\closeElement
static closeElement( $element)
Shortcut to close an XML element.
Definition: Xml.php:117
QueryPage\usesTimestamps
usesTimestamps()
Does this query return timestamps rather than integers in its 'value' field? If true,...
Definition: QueryPage.php:217
QueryPage\getDBLimit
getDBLimit( $uiLimit, $uiOffset)
What is limit to fetch from DB.
Definition: QueryPage.php:582
QueryPage\sortDescending
sortDescending()
Override to sort by increasing values.
Definition: QueryPage.php:226
QueryPage\getPages
static getPages()
Get a list of query page classes and their associated special pages, for periodic updates.
Definition: QueryPage.php:74
MediaWiki\Linker\LinkTarget
Definition: LinkTarget.php:26
SpecialPage\outputHeader
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
Definition: SpecialPage.php:636
Wikimedia\Rdbms\IDatabase\delete
delete( $table, $conds, $fname=__METHOD__)
Delete all rows in a table that match a condition.