MediaWiki  1.23.15
QueryPage.php
Go to the documentation of this file.
1 <?php
30 abstract class QueryPage extends SpecialPage {
36  var $listoutput = false;
37 
43  var $offset = 0;
44  var $limit = 0;
45 
51  protected $numRows;
52 
53  protected $cachedTimestamp = null;
54 
58  protected $shownavigation = true;
59 
68  public static function getPages() {
69  global $wgDisableCounters;
70  static $qp = null;
71 
72  if ( $qp === null ) {
73  // QueryPage subclass, Special page name
74  $qp = array(
75  array( 'AncientPagesPage', 'Ancientpages' ),
76  array( 'BrokenRedirectsPage', 'BrokenRedirects' ),
77  array( 'DeadendPagesPage', 'Deadendpages' ),
78  array( 'DoubleRedirectsPage', 'DoubleRedirects' ),
79  array( 'FileDuplicateSearchPage', 'FileDuplicateSearch' ),
80  array( 'ListDuplicatedFilesPage', 'ListDuplicatedFiles'),
81  array( 'LinkSearchPage', 'LinkSearch' ),
82  array( 'ListredirectsPage', 'Listredirects' ),
83  array( 'LonelyPagesPage', 'Lonelypages' ),
84  array( 'LongPagesPage', 'Longpages' ),
85  array( 'MIMEsearchPage', 'MIMEsearch' ),
86  array( 'MostcategoriesPage', 'Mostcategories' ),
87  array( 'MostimagesPage', 'Mostimages' ),
88  array( 'MostinterwikisPage', 'Mostinterwikis' ),
89  array( 'MostlinkedCategoriesPage', 'Mostlinkedcategories' ),
90  array( 'MostlinkedtemplatesPage', 'Mostlinkedtemplates' ),
91  array( 'MostlinkedPage', 'Mostlinked' ),
92  array( 'MostrevisionsPage', 'Mostrevisions' ),
93  array( 'FewestrevisionsPage', 'Fewestrevisions' ),
94  array( 'ShortPagesPage', 'Shortpages' ),
95  array( 'UncategorizedCategoriesPage', 'Uncategorizedcategories' ),
96  array( 'UncategorizedPagesPage', 'Uncategorizedpages' ),
97  array( 'UncategorizedImagesPage', 'Uncategorizedimages' ),
98  array( 'UncategorizedTemplatesPage', 'Uncategorizedtemplates' ),
99  array( 'UnusedCategoriesPage', 'Unusedcategories' ),
100  array( 'UnusedimagesPage', 'Unusedimages' ),
101  array( 'WantedCategoriesPage', 'Wantedcategories' ),
102  array( 'WantedFilesPage', 'Wantedfiles' ),
103  array( 'WantedPagesPage', 'Wantedpages' ),
104  array( 'WantedTemplatesPage', 'Wantedtemplates' ),
105  array( 'UnwatchedPagesPage', 'Unwatchedpages' ),
106  array( 'UnusedtemplatesPage', 'Unusedtemplates' ),
107  array( 'WithoutInterwikiPage', 'Withoutinterwiki' ),
108  );
109  wfRunHooks( 'wgQueryPages', array( &$qp ) );
110 
111  if ( !$wgDisableCounters ) {
112  $qp[] = array( 'PopularPagesPage', 'Popularpages' );
113  }
114  }
115 
116  return $qp;
117  }
118 
124  function setListoutput( $bool ) {
125  $this->listoutput = $bool;
126  }
127 
154  function getQueryInfo() {
155  return null;
156  }
157 
164  function getSQL() {
165  /* Implement getQueryInfo() instead */
166  throw new MWException( "Bug in a QueryPage: doesn't implement getQueryInfo() nor "
167  . "getQuery() properly" );
168  }
169 
177  function getOrderFields() {
178  return array( 'value' );
179  }
180 
191  function usesTimestamps() {
192  return false;
193  }
194 
200  function sortDescending() {
201  return true;
202  }
203 
211  function isExpensive() {
212  global $wgDisableQueryPages;
213  return $wgDisableQueryPages;
214  }
215 
223  public function isCacheable() {
224  return true;
225  }
226 
233  function isCached() {
234  global $wgMiserMode;
235 
236  return $this->isExpensive() && $wgMiserMode;
237  }
238 
244  function isSyndicated() {
245  return true;
246  }
247 
257  abstract function formatResult( $skin, $result );
258 
264  function getPageHeader() {
265  return '';
266  }
267 
275  function linkParameters() {
276  return array();
277  }
278 
287  function tryLastResult() {
288  return false;
289  }
290 
299  function recache( $limit, $ignoreErrors = true ) {
300  if ( !$this->isCacheable() ) {
301  return 0;
302  }
303 
304  $fname = get_class( $this ) . '::recache';
305  $dbw = wfGetDB( DB_MASTER );
306  if ( !$dbw ) {
307  return false;
308  }
309 
310  try {
311  # Do query
312  $res = $this->reallyDoQuery( $limit, false );
313  $num = false;
314  if ( $res ) {
315  $num = $res->numRows();
316  # Fetch results
317  $vals = array();
318  foreach ( $res as $row ) {
319  if ( isset( $row->value ) ) {
320  if ( $this->usesTimestamps() ) {
322  $row->value );
323  } else {
324  $value = intval( $row->value ); // @bug 14414
325  }
326  } else {
327  $value = 0;
328  }
329 
330  $vals[] = array( 'qc_type' => $this->getName(),
331  'qc_namespace' => $row->namespace,
332  'qc_title' => $row->title,
333  'qc_value' => $value );
334  }
335 
336  $dbw->begin( __METHOD__ );
337  # Clear out any old cached data
338  $dbw->delete( 'querycache', array( 'qc_type' => $this->getName() ), $fname );
339  # Save results into the querycache table on the master
340  if ( count( $vals ) ) {
341  $dbw->insert( 'querycache', $vals, __METHOD__ );
342  }
343  # Update the querycache_info record for the page
344  $dbw->delete( 'querycache_info', array( 'qci_type' => $this->getName() ), $fname );
345  $dbw->insert( 'querycache_info',
346  array( 'qci_type' => $this->getName(), 'qci_timestamp' => $dbw->timestamp() ),
347  $fname );
348  $dbw->commit( __METHOD__ );
349  }
350  } catch ( DBError $e ) {
351  if ( !$ignoreErrors ) {
352  throw $e; // report query error
353  }
354  $num = false; // set result to false to indicate error
355  }
356 
357  return $num;
358  }
359 
363  function getRecacheDB() {
364  return wfGetDB( DB_SLAVE, array( $this->getName(), 'QueryPage::recache', 'vslow' ) );
365  }
366 
374  function reallyDoQuery( $limit, $offset = false ) {
375  $fname = get_class( $this ) . "::reallyDoQuery";
376  $dbr = $this->getRecacheDB();
377  $query = $this->getQueryInfo();
378  $order = $this->getOrderFields();
379 
380  if ( $this->sortDescending() ) {
381  foreach ( $order as &$field ) {
382  $field .= ' DESC';
383  }
384  }
385 
386  if ( is_array( $query ) ) {
387  $tables = isset( $query['tables'] ) ? (array)$query['tables'] : array();
388  $fields = isset( $query['fields'] ) ? (array)$query['fields'] : array();
389  $conds = isset( $query['conds'] ) ? (array)$query['conds'] : array();
390  $options = isset( $query['options'] ) ? (array)$query['options'] : array();
391  $join_conds = isset( $query['join_conds'] ) ? (array)$query['join_conds'] : array();
392 
393  if ( count( $order ) ) {
394  $options['ORDER BY'] = $order;
395  }
396 
397  if ( $limit !== false ) {
398  $options['LIMIT'] = intval( $limit );
399  }
400 
401  if ( $offset !== false ) {
402  $options['OFFSET'] = intval( $offset );
403  }
404 
405  $res = $dbr->select( $tables, $fields, $conds, $fname,
406  $options, $join_conds
407  );
408  } else {
409  // Old-fashioned raw SQL style, deprecated
410  $sql = $this->getSQL();
411  $sql .= ' ORDER BY ' . implode( ', ', $order );
412  $sql = $dbr->limitResult( $sql, $limit, $offset );
413  $res = $dbr->query( $sql, $fname );
414  }
415 
416  return $dbr->resultObject( $res );
417  }
418 
425  function doQuery( $offset = false, $limit = false ) {
426  if ( $this->isCached() && $this->isCacheable() ) {
427  return $this->fetchFromCache( $limit, $offset );
428  } else {
429  return $this->reallyDoQuery( $limit, $offset );
430  }
431  }
432 
440  function fetchFromCache( $limit, $offset = false ) {
441  $dbr = wfGetDB( DB_SLAVE );
442  $options = array();
443  if ( $limit !== false ) {
444  $options['LIMIT'] = intval( $limit );
445  }
446  if ( $offset !== false ) {
447  $options['OFFSET'] = intval( $offset );
448  }
449  if ( $this->sortDescending() ) {
450  $options['ORDER BY'] = 'qc_value DESC';
451  } else {
452  $options['ORDER BY'] = 'qc_value ASC';
453  }
454  $res = $dbr->select( 'querycache', array( 'qc_type',
455  'namespace' => 'qc_namespace',
456  'title' => 'qc_title',
457  'value' => 'qc_value' ),
458  array( 'qc_type' => $this->getName() ),
459  __METHOD__, $options
460  );
461  return $dbr->resultObject( $res );
462  }
463 
464  public function getCachedTimestamp() {
465  if ( is_null( $this->cachedTimestamp ) ) {
466  $dbr = wfGetDB( DB_SLAVE );
467  $fname = get_class( $this ) . '::getCachedTimestamp';
468  $this->cachedTimestamp = $dbr->selectField( 'querycache_info', 'qci_timestamp',
469  array( 'qci_type' => $this->getName() ), $fname );
470  }
471  return $this->cachedTimestamp;
472  }
473 
480  function execute( $par ) {
481  global $wgQueryCacheLimit, $wgDisableQueryPageUpdate;
482 
483  $user = $this->getUser();
484  if ( !$this->userCanExecute( $user ) ) {
485  $this->displayRestrictionError();
486  return;
487  }
488 
489  $this->setHeaders();
490  $this->outputHeader();
491 
492  $out = $this->getOutput();
493 
494  if ( $this->isCached() && !$this->isCacheable() ) {
495  $out->addWikiMsg( 'querypage-disabled' );
496  return 0;
497  }
498 
499  $out->setSyndicated( $this->isSyndicated() );
500 
501  if ( $this->limit == 0 && $this->offset == 0 ) {
502  list( $this->limit, $this->offset ) = $this->getRequest()->getLimitOffset();
503  }
504 
505  // TODO: Use doQuery()
506  if ( !$this->isCached() ) {
507  # select one extra row for navigation
508  $res = $this->reallyDoQuery( $this->limit + 1, $this->offset );
509  } else {
510  # Get the cached result, select one extra row for navigation
511  $res = $this->fetchFromCache( $this->limit + 1, $this->offset );
512  if ( !$this->listoutput ) {
513 
514  # Fetch the timestamp of this update
515  $ts = $this->getCachedTimestamp();
516  $lang = $this->getLanguage();
517  $maxResults = $lang->formatNum( $wgQueryCacheLimit );
518 
519  if ( $ts ) {
520  $updated = $lang->userTimeAndDate( $ts, $user );
521  $updateddate = $lang->userDate( $ts, $user );
522  $updatedtime = $lang->userTime( $ts, $user );
523  $out->addMeta( 'Data-Cache-Time', $ts );
524  $out->addJsConfigVars( 'dataCacheTime', $ts );
525  $out->addWikiMsg( 'perfcachedts', $updated, $updateddate, $updatedtime, $maxResults );
526  } else {
527  $out->addWikiMsg( 'perfcached', $maxResults );
528  }
529 
530  # If updates on this page have been disabled, let the user know
531  # that the data set won't be refreshed for now
532  if ( is_array( $wgDisableQueryPageUpdate )
533  && in_array( $this->getName(), $wgDisableQueryPageUpdate )
534  ) {
535  $out->wrapWikiMsg(
536  "<div class=\"mw-querypage-no-updates\">\n$1\n</div>",
537  'querypage-no-updates'
538  );
539  }
540  }
541  }
542 
543  $this->numRows = $res->numRows();
544 
545  $dbr = wfGetDB( DB_SLAVE );
546  $this->preprocessResults( $dbr, $res );
547 
548  $out->addHTML( Xml::openElement( 'div', array( 'class' => 'mw-spcontent' ) ) );
549 
550  # Top header and navigation
551  if ( $this->shownavigation ) {
552  $out->addHTML( $this->getPageHeader() );
553  if ( $this->numRows > 0 ) {
554  $out->addHTML( $this->msg( 'showingresultsinrange' )->numParams(
555  min( $this->numRows, $this->limit ), # do not show the one extra row, if exist
556  $this->offset + 1, ( min( $this->numRows, $this->limit ) + $this->offset ) )->parseAsBlock() );
557  # Disable the "next" link when we reach the end
558  $paging = $this->getLanguage()->viewPrevNext( $this->getPageTitle( $par ), $this->offset,
559  $this->limit, $this->linkParameters(), ( $this->numRows <= $this->limit ) );
560  $out->addHTML( '<p>' . $paging . '</p>' );
561  } else {
562  # No results to show, so don't bother with "showing X of Y" etc.
563  # -- just let the user know and give up now
564  $out->addWikiMsg( 'specialpage-empty' );
565  $out->addHTML( Xml::closeElement( 'div' ) );
566  return;
567  }
568  }
569 
570  # The actual results; specialist subclasses will want to handle this
571  # with more than a straight list, so we hand them the info, plus
572  # an OutputPage, and let them get on with it
573  $this->outputResults( $out,
574  $this->getSkin(),
575  $dbr, # Should use a ResultWrapper for this
576  $res,
577  min( $this->numRows, $this->limit ), # do not format the one extra row, if exist
578  $this->offset );
579 
580  # Repeat the paging links at the bottom
581  if ( $this->shownavigation ) {
582  $out->addHTML( '<p>' . $paging . '</p>' );
583  }
584 
585  $out->addHTML( Xml::closeElement( 'div' ) );
586 
587  return min( $this->numRows, $this->limit ); # do not return the one extra row, if exist
588  }
589 
601  protected function outputResults( $out, $skin, $dbr, $res, $num, $offset ) {
603 
604  if ( $num > 0 ) {
605  $html = array();
606  if ( !$this->listoutput ) {
607  $html[] = $this->openList( $offset );
608  }
609 
610  # $res might contain the whole 1,000 rows, so we read up to
611  # $num [should update this to use a Pager]
612  for ( $i = 0; $i < $num && $row = $res->fetchObject(); $i++ ) {
613  $line = $this->formatResult( $skin, $row );
614  if ( $line ) {
615  $attr = ( isset( $row->usepatrol ) && $row->usepatrol && $row->patrolled == 0 )
616  ? ' class="not-patrolled"'
617  : '';
618  $html[] = $this->listoutput
619  ? $line
620  : "<li{$attr}>{$line}</li>\n";
621  }
622  }
623 
624  # Flush the final result
625  if ( $this->tryLastResult() ) {
626  $row = null;
627  $line = $this->formatResult( $skin, $row );
628  if ( $line ) {
629  $attr = ( isset( $row->usepatrol ) && $row->usepatrol && $row->patrolled == 0 )
630  ? ' class="not-patrolled"'
631  : '';
632  $html[] = $this->listoutput
633  ? $line
634  : "<li{$attr}>{$line}</li>\n";
635  }
636  }
637 
638  if ( !$this->listoutput ) {
639  $html[] = $this->closeList();
640  }
641 
642  $html = $this->listoutput
643  ? $wgContLang->listToText( $html )
644  : implode( '', $html );
645 
646  $out->addHTML( $html );
647  }
648  }
649 
654  function openList( $offset ) {
655  return "\n<ol start='" . ( $offset + 1 ) . "' class='special'>\n";
656  }
657 
661  function closeList() {
662  return "</ol>\n";
663  }
664 
670  function preprocessResults( $db, $res ) {}
671 
678  function doFeed( $class = '', $limit = 50 ) {
679  global $wgFeed, $wgFeedClasses, $wgFeedLimit;
680 
681  if ( !$wgFeed ) {
682  $this->getOutput()->addWikiMsg( 'feed-unavailable' );
683  return false;
684  }
685 
686  $limit = min( $limit, $wgFeedLimit );
687 
688  if ( isset( $wgFeedClasses[$class] ) ) {
689  $feed = new $wgFeedClasses[$class](
690  $this->feedTitle(),
691  $this->feedDesc(),
692  $this->feedUrl() );
693  $feed->outHeader();
694 
695  $res = $this->reallyDoQuery( $limit, 0 );
696  foreach ( $res as $obj ) {
697  $item = $this->feedResult( $obj );
698  if ( $item ) {
699  $feed->outItem( $item );
700  }
701  }
702 
703  $feed->outFooter();
704  return true;
705  } else {
706  return false;
707  }
708  }
709 
716  function feedResult( $row ) {
717  if ( !isset( $row->title ) ) {
718  return null;
719  }
720  $title = Title::makeTitle( intval( $row->namespace ), $row->title );
721  if ( $title ) {
722  $date = isset( $row->timestamp ) ? $row->timestamp : '';
723  $comments = '';
724  if ( $title ) {
725  $talkpage = $title->getTalkPage();
726  $comments = $talkpage->getFullURL();
727  }
728 
729  return new FeedItem(
730  $title->getPrefixedText(),
731  $this->feedItemDesc( $row ),
732  $title->getFullURL(),
733  $date,
734  $this->feedItemAuthor( $row ),
735  $comments );
736  } else {
737  return null;
738  }
739  }
740 
741  function feedItemDesc( $row ) {
742  return isset( $row->comment ) ? htmlspecialchars( $row->comment ) : '';
743  }
744 
745  function feedItemAuthor( $row ) {
746  return isset( $row->user_text ) ? $row->user_text : '';
747  }
748 
749  function feedTitle() {
750  global $wgLanguageCode, $wgSitename;
751  $desc = $this->getDescription();
752  return "$wgSitename - $desc [$wgLanguageCode]";
753  }
754 
755  function feedDesc() {
756  return $this->msg( 'tagline' )->text();
757  }
758 
759  function feedUrl() {
760  return $this->getPageTitle()->getFullURL();
761  }
762 }
763 
768 abstract class WantedQueryPage extends QueryPage {
769  function isExpensive() {
770  return true;
771  }
772 
773  function isSyndicated() {
774  return false;
775  }
776 
782  function preprocessResults( $db, $res ) {
783  if ( !$res->numRows() ) {
784  return;
785  }
786 
787  $batch = new LinkBatch;
788  foreach ( $res as $row ) {
789  $batch->add( $row->namespace, $row->title );
790  }
791  $batch->execute();
792 
793  // Back to start for display
794  $res->seek( 0 );
795  }
796 
805  function forceExistenceCheck() {
806  return false;
807  }
808 
816  public function formatResult( $skin, $result ) {
817  $title = Title::makeTitleSafe( $result->namespace, $result->title );
818  if ( $title instanceof Title ) {
819  if ( $this->isCached() || $this->forceExistenceCheck() ) {
820  $pageLink = $title->isKnown()
821  ? '<del>' . Linker::link( $title ) . '</del>'
822  : Linker::link(
823  $title,
824  null,
825  array(),
826  array(),
827  array( 'broken' )
828  );
829  } else {
830  $pageLink = Linker::link(
831  $title,
832  null,
833  array(),
834  array(),
835  array( 'broken' )
836  );
837  }
838  return $this->getLanguage()->specialList( $pageLink, $this->makeWlhLink( $title, $result ) );
839  } else {
840  return $this->msg( 'wantedpages-badtitle', $result->title )->escaped();
841  }
842  }
843 
851  private function makeWlhLink( $title, $result ) {
852  $wlh = SpecialPage::getTitleFor( 'Whatlinkshere', $title->getPrefixedText() );
853  $label = $this->msg( 'nlinks' )->numParams( $result->value )->escaped();
854  return Linker::link( $wlh, $label );
855  }
856 }
QueryPage\setListoutput
setListoutput( $bool)
A mutator for $this->listoutput;.
Definition: QueryPage.php:122
SpecialPage\getPageTitle
getPageTitle( $subpage=false)
Get a self-referential title object.
Definition: SpecialPage.php:488
Title\makeTitle
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:398
QueryPage\$listoutput
bool $listoutput
Whether or not we want plain listoutput rather than an ordered list.
Definition: QueryPage.php:35
$result
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. $reader:XMLReader object $logInfo:Array of information Return false to stop further processing of the tag 'ImportHandlePageXMLTag':When parsing a XML tag in a page. $reader:XMLReader object $pageInfo:Array of information Return false to stop further processing of the tag 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information Return false to stop further processing of the tag 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. $reader:XMLReader object Return false to stop further processing of the tag 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. $reader:XMLReader object $revisionInfo:Array of information Return false to stop further processing of the tag 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. $title:Title object for the current page $request:WebRequest $ignoreRedirect:boolean to skip redirect check $target:Title/string of redirect target $article:Article object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) $article:article(object) being checked 'IsTrustedProxy':Override the result of wfIsTrustedProxy() $ip:IP being check $result:Change this value to override the result of wfIsTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of User::isValidEmailAddr(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetMagic':DEPRECATED, use $magicWords in a file listed in $wgExtensionMessagesFiles instead. Use this to define synonyms of magic words depending of the language $magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetSpecialPageAliases':DEPRECATED, use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead. Use to define aliases of special pages names depending of the language $specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Associative array mapping language codes to prefixed links of the form "language:title". & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LinkBegin':Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
Definition: hooks.txt:1528
FeedItem
A base class for basic support for outputting syndication feeds in RSS and other formats.
Definition: Feed.php:38
DB_MASTER
const DB_MASTER
Definition: Defines.php:56
WantedQueryPage\forceExistenceCheck
forceExistenceCheck()
Should formatResult() always check page existence, even if the results are fresh? This is a (hopefull...
Definition: QueryPage.php:803
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
QueryPage\feedTitle
feedTitle()
Definition: QueryPage.php:747
$html
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
Definition: hooks.txt:1530
LinkBatch
Class representing a list of titles The execute() method checks them all for existence and adds them ...
Definition: LinkBatch.php:30
$tables
namespace and then decline to actually register it RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist & $tables
Definition: hooks.txt:815
SpecialPage\getOutput
getOutput()
Get the OutputPage being used for this instance.
Definition: SpecialPage.php:535
QueryPage\$cachedTimestamp
$cachedTimestamp
Definition: QueryPage.php:51
wfGetDB
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:3714
QueryPage\isCacheable
isCacheable()
Is the output of this query cacheable? Non-cacheable expensive pages will be disabled in miser mode a...
Definition: QueryPage.php:221
QueryPage\getPageHeader
getPageHeader()
The content returned by this function will be output before any result.
Definition: QueryPage.php:262
wfTimestamp
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Definition: GlobalFunctions.php:2530
QueryPage\linkParameters
linkParameters()
If using extra form wheely-dealies, return a set of parameters here as an associative array.
Definition: QueryPage.php:273
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:599
$fname
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined.
Definition: Setup.php:35
WantedQueryPage\preprocessResults
preprocessResults( $db, $res)
Cache page existence for performance.
Definition: QueryPage.php:780
SpecialPage\displayRestrictionError
displayRestrictionError()
Output an error message telling the user what access level they have to have.
Definition: SpecialPage.php:276
QueryPage\openList
openList( $offset)
Definition: QueryPage.php:652
QueryPage\preprocessResults
preprocessResults( $db, $res)
Do any necessary preprocessing of the result object.
Definition: QueryPage.php:668
SpecialPage\getTitleFor
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name.
Definition: SpecialPage.php:74
QueryPage\execute
execute( $par)
This is the actual workhorse.
Definition: QueryPage.php:478
WantedQueryPage\formatResult
formatResult( $skin, $result)
Format an individual result.
Definition: QueryPage.php:814
SpecialPage\getSkin
getSkin()
Shortcut to get the skin being used for this instance.
Definition: SpecialPage.php:555
WantedQueryPage\isSyndicated
isSyndicated()
Sometime we don't want to build rss / atom feeds.
Definition: QueryPage.php:771
WantedQueryPage\isExpensive
isExpensive()
Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.
Definition: QueryPage.php:767
$wgContLang
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
Definition: design.txt:56
SpecialPage\getLanguage
getLanguage()
Shortcut to get user's language.
Definition: SpecialPage.php:578
SpecialPage\getName
getName()
Get the name of this Special Page.
Definition: SpecialPage.php:139
QueryPage\reallyDoQuery
reallyDoQuery( $limit, $offset=false)
Run the query and return the result.
Definition: QueryPage.php:372
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:30
Xml\openElement
static openElement( $element, $attribs=null)
This opens an XML element.
Definition: Xml.php:109
QueryPage\$offset
int $offset
The offset and limit in use, as passed to the query() function.
Definition: QueryPage.php:41
$dbr
$dbr
Definition: testCompression.php:48
Linker\link
static link( $target, $html=null, $customAttribs=array(), $query=array(), $options=array())
This function returns an HTML link to the given target.
Definition: Linker.php:192
QueryPage\feedItemDesc
feedItemDesc( $row)
Definition: QueryPage.php:739
QueryPage\getCachedTimestamp
getCachedTimestamp()
Definition: QueryPage.php:462
SpecialPage\getDescription
getDescription()
Returns the name that goes in the <h1> in the special page itself, and also the name that will be lis...
Definition: SpecialPage.php:466
QueryPage\closeList
closeList()
Definition: QueryPage.php:659
MWException
MediaWiki exception.
Definition: MWException.php:26
$out
$out
Definition: UtfNormalGenerate.php:167
QueryPage\isCached
isCached()
Whether or not the output of the page in question is retrieved from the database cache.
Definition: QueryPage.php:231
wfRunHooks
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
Definition: GlobalFunctions.php:4066
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:209
QueryPage\recache
recache( $limit, $ignoreErrors=true)
Clear the cache and save new results.
Definition: QueryPage.php:297
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
SpecialPage\setHeaders
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
Definition: SpecialPage.php:352
SpecialPage\getUser
getUser()
Shortcut to get the User executing this instance.
Definition: SpecialPage.php:545
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
QueryPage\doFeed
doFeed( $class='', $limit=50)
Similar to above, but packaging in a syndicated feed instead of a web page.
Definition: QueryPage.php:676
QueryPage\getRecacheDB
getRecacheDB()
Get a DB connection to be used for slow recache queries.
Definition: QueryPage.php:361
list
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition: deferred.txt:11
DBError
Database error base class.
Definition: DatabaseError.php:28
$options
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
Definition: hooks.txt:1530
QueryPage\feedDesc
feedDesc()
Definition: QueryPage.php:753
QueryPage\feedUrl
feedUrl()
Definition: QueryPage.php:757
$line
$line
Definition: cdb.php:57
QueryPage\getQueryInfo
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
Definition: QueryPage.php:152
QueryPage\getOrderFields
getOrderFields()
Subclasses return an array of fields to order by here.
Definition: QueryPage.php:175
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:422
$title
presenting them properly to the user as errors is done by the caller $title
Definition: hooks.txt:1324
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:268
$value
$value
Definition: styleTest.css.php:45
SpecialPage\msg
msg()
Wrapper around wfMessage that sets the current context.
Definition: SpecialPage.php:609
SpecialPage
Parent class for all special pages.
Definition: SpecialPage.php:33
QueryPage\doQuery
doQuery( $offset=false, $limit=false)
Somewhat deprecated, you probably want to be using execute()
Definition: QueryPage.php:423
WantedQueryPage\makeWlhLink
makeWlhLink( $title, $result)
Make a "what links here" link for a given title.
Definition: QueryPage.php:849
QueryPage\fetchFromCache
fetchFromCache( $limit, $offset=false)
Fetch the query results from the query cache.
Definition: QueryPage.php:438
SpecialPage\getRequest
getRequest()
Get the WebRequest being used for this instance.
Definition: SpecialPage.php:525
QueryPage\feedItemAuthor
feedItemAuthor( $row)
Definition: QueryPage.php:743
QueryPage\$limit
$limit
Definition: QueryPage.php:42
$user
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Definition: hooks.txt:237
QueryPage\feedResult
feedResult( $row)
Override for custom handling.
Definition: QueryPage.php:714
$skin
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned $skin
Definition: hooks.txt:1530
QueryPage\isSyndicated
isSyndicated()
Sometime we don't want to build rss / atom feeds.
Definition: QueryPage.php:242
QueryPage\getSQL
getSQL()
For back-compat, subclasses may return a raw SQL query here, as a string.
Definition: QueryPage.php:162
DB_SLAVE
const DB_SLAVE
Definition: Defines.php:55
Title
Represents a title within MediaWiki.
Definition: Title.php:35
Xml\closeElement
static closeElement( $element)
Shortcut to close an XML element.
Definition: Xml.php:118
TS_UNIX
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
Definition: GlobalFunctions.php:2473
QueryPage\tryLastResult
tryLastResult()
Some special pages (for example SpecialListusers) might not return the current object formatted,...
Definition: QueryPage.php:285
QueryPage\$shownavigation
$shownavigation
Wheter to show prev/next links.
Definition: QueryPage.php:56
format
if the prop value should be in the metadata multi language array format
Definition: hooks.txt:1230
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
QueryPage\usesTimestamps
usesTimestamps()
Does this query return timestamps rather than integers in its 'value' field? If true,...
Definition: QueryPage.php:189
$batch
$batch
Definition: linkcache.txt:23
QueryPage\sortDescending
sortDescending()
Override to sort by increasing values.
Definition: QueryPage.php:198
QueryPage\getPages
static getPages()
Get a list of query page classes and their associated special pages, for periodic updates.
Definition: QueryPage.php:66
$query
return true to allow those checks to and false if checking is done use this to change the tables headers temp or archived zone change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition: hooks.txt:1105
$res
$res
Definition: database.txt:21
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:443
WantedQueryPage
Class definition for a wanted query page like WantedPages, WantedTemplates, etc.
Definition: QueryPage.php:766
ResultWrapper
Result wrapper for grabbing data queried by someone else.
Definition: DatabaseUtility.php:99
$e
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
Definition: hooks.txt:1632
QueryPage\$numRows
$numRows
The number of rows returned by the query.
Definition: QueryPage.php:49