MediaWiki  1.29.1
ApiQueryInfo.php
Go to the documentation of this file.
1 <?php
28 
34 class ApiQueryInfo extends ApiQueryBase {
35 
36  private $fld_protection = false, $fld_talkid = false,
37  $fld_subjectid = false, $fld_url = false,
38  $fld_readable = false, $fld_watched = false,
41  $fld_preload = false, $fld_displaytitle = false;
42 
43  private $params;
44 
46  private $titles;
48  private $missing;
50  private $everything;
51 
54 
57  private $showZeroWatchers = false;
58 
59  private $tokenFunctions;
60 
61  private $countTestedActions = 0;
62 
63  public function __construct( ApiQuery $query, $moduleName ) {
64  parent::__construct( $query, $moduleName, 'in' );
65  }
66 
71  public function requestExtraData( $pageSet ) {
72  $pageSet->requestField( 'page_restrictions' );
73  // If the pageset is resolving redirects we won't get page_is_redirect.
74  // But we can't know for sure until the pageset is executed (revids may
75  // turn it off), so request it unconditionally.
76  $pageSet->requestField( 'page_is_redirect' );
77  $pageSet->requestField( 'page_is_new' );
78  $config = $this->getConfig();
79  $pageSet->requestField( 'page_touched' );
80  $pageSet->requestField( 'page_latest' );
81  $pageSet->requestField( 'page_len' );
82  if ( $config->get( 'ContentHandlerUseDB' ) ) {
83  $pageSet->requestField( 'page_content_model' );
84  }
85  if ( $config->get( 'PageLanguageUseDB' ) ) {
86  $pageSet->requestField( 'page_lang' );
87  }
88  }
89 
97  protected function getTokenFunctions() {
98  // Don't call the hooks twice
99  if ( isset( $this->tokenFunctions ) ) {
100  return $this->tokenFunctions;
101  }
102 
103  // If we're in a mode that breaks the same-origin policy, no tokens can
104  // be obtained
105  if ( $this->lacksSameOriginSecurity() ) {
106  return [];
107  }
108 
109  $this->tokenFunctions = [
110  'edit' => [ 'ApiQueryInfo', 'getEditToken' ],
111  'delete' => [ 'ApiQueryInfo', 'getDeleteToken' ],
112  'protect' => [ 'ApiQueryInfo', 'getProtectToken' ],
113  'move' => [ 'ApiQueryInfo', 'getMoveToken' ],
114  'block' => [ 'ApiQueryInfo', 'getBlockToken' ],
115  'unblock' => [ 'ApiQueryInfo', 'getUnblockToken' ],
116  'email' => [ 'ApiQueryInfo', 'getEmailToken' ],
117  'import' => [ 'ApiQueryInfo', 'getImportToken' ],
118  'watch' => [ 'ApiQueryInfo', 'getWatchToken' ],
119  ];
120  Hooks::run( 'APIQueryInfoTokens', [ &$this->tokenFunctions ] );
121 
122  return $this->tokenFunctions;
123  }
124 
125  static protected $cachedTokens = [];
126 
130  public static function resetTokenCache() {
132  }
133 
137  public static function getEditToken( $pageid, $title ) {
138  // We could check for $title->userCan('edit') here,
139  // but that's too expensive for this purpose
140  // and would break caching
141  global $wgUser;
142  if ( !$wgUser->isAllowed( 'edit' ) ) {
143  return false;
144  }
145 
146  // The token is always the same, let's exploit that
147  if ( !isset( ApiQueryInfo::$cachedTokens['edit'] ) ) {
148  ApiQueryInfo::$cachedTokens['edit'] = $wgUser->getEditToken();
149  }
150 
151  return ApiQueryInfo::$cachedTokens['edit'];
152  }
153 
157  public static function getDeleteToken( $pageid, $title ) {
158  global $wgUser;
159  if ( !$wgUser->isAllowed( 'delete' ) ) {
160  return false;
161  }
162 
163  // The token is always the same, let's exploit that
164  if ( !isset( ApiQueryInfo::$cachedTokens['delete'] ) ) {
165  ApiQueryInfo::$cachedTokens['delete'] = $wgUser->getEditToken();
166  }
167 
168  return ApiQueryInfo::$cachedTokens['delete'];
169  }
170 
174  public static function getProtectToken( $pageid, $title ) {
175  global $wgUser;
176  if ( !$wgUser->isAllowed( 'protect' ) ) {
177  return false;
178  }
179 
180  // The token is always the same, let's exploit that
181  if ( !isset( ApiQueryInfo::$cachedTokens['protect'] ) ) {
182  ApiQueryInfo::$cachedTokens['protect'] = $wgUser->getEditToken();
183  }
184 
185  return ApiQueryInfo::$cachedTokens['protect'];
186  }
187 
191  public static function getMoveToken( $pageid, $title ) {
192  global $wgUser;
193  if ( !$wgUser->isAllowed( 'move' ) ) {
194  return false;
195  }
196 
197  // The token is always the same, let's exploit that
198  if ( !isset( ApiQueryInfo::$cachedTokens['move'] ) ) {
199  ApiQueryInfo::$cachedTokens['move'] = $wgUser->getEditToken();
200  }
201 
202  return ApiQueryInfo::$cachedTokens['move'];
203  }
204 
208  public static function getBlockToken( $pageid, $title ) {
209  global $wgUser;
210  if ( !$wgUser->isAllowed( 'block' ) ) {
211  return false;
212  }
213 
214  // The token is always the same, let's exploit that
215  if ( !isset( ApiQueryInfo::$cachedTokens['block'] ) ) {
216  ApiQueryInfo::$cachedTokens['block'] = $wgUser->getEditToken();
217  }
218 
219  return ApiQueryInfo::$cachedTokens['block'];
220  }
221 
225  public static function getUnblockToken( $pageid, $title ) {
226  // Currently, this is exactly the same as the block token
227  return self::getBlockToken( $pageid, $title );
228  }
229 
233  public static function getEmailToken( $pageid, $title ) {
234  global $wgUser;
235  if ( !$wgUser->canSendEmail() || $wgUser->isBlockedFromEmailuser() ) {
236  return false;
237  }
238 
239  // The token is always the same, let's exploit that
240  if ( !isset( ApiQueryInfo::$cachedTokens['email'] ) ) {
241  ApiQueryInfo::$cachedTokens['email'] = $wgUser->getEditToken();
242  }
243 
244  return ApiQueryInfo::$cachedTokens['email'];
245  }
246 
250  public static function getImportToken( $pageid, $title ) {
251  global $wgUser;
252  if ( !$wgUser->isAllowedAny( 'import', 'importupload' ) ) {
253  return false;
254  }
255 
256  // The token is always the same, let's exploit that
257  if ( !isset( ApiQueryInfo::$cachedTokens['import'] ) ) {
258  ApiQueryInfo::$cachedTokens['import'] = $wgUser->getEditToken();
259  }
260 
261  return ApiQueryInfo::$cachedTokens['import'];
262  }
263 
267  public static function getWatchToken( $pageid, $title ) {
268  global $wgUser;
269  if ( !$wgUser->isLoggedIn() ) {
270  return false;
271  }
272 
273  // The token is always the same, let's exploit that
274  if ( !isset( ApiQueryInfo::$cachedTokens['watch'] ) ) {
275  ApiQueryInfo::$cachedTokens['watch'] = $wgUser->getEditToken( 'watch' );
276  }
277 
278  return ApiQueryInfo::$cachedTokens['watch'];
279  }
280 
284  public static function getOptionsToken( $pageid, $title ) {
285  global $wgUser;
286  if ( !$wgUser->isLoggedIn() ) {
287  return false;
288  }
289 
290  // The token is always the same, let's exploit that
291  if ( !isset( ApiQueryInfo::$cachedTokens['options'] ) ) {
292  ApiQueryInfo::$cachedTokens['options'] = $wgUser->getEditToken();
293  }
294 
295  return ApiQueryInfo::$cachedTokens['options'];
296  }
297 
298  public function execute() {
299  $this->params = $this->extractRequestParams();
300  if ( !is_null( $this->params['prop'] ) ) {
301  $prop = array_flip( $this->params['prop'] );
302  $this->fld_protection = isset( $prop['protection'] );
303  $this->fld_watched = isset( $prop['watched'] );
304  $this->fld_watchers = isset( $prop['watchers'] );
305  $this->fld_visitingwatchers = isset( $prop['visitingwatchers'] );
306  $this->fld_notificationtimestamp = isset( $prop['notificationtimestamp'] );
307  $this->fld_talkid = isset( $prop['talkid'] );
308  $this->fld_subjectid = isset( $prop['subjectid'] );
309  $this->fld_url = isset( $prop['url'] );
310  $this->fld_readable = isset( $prop['readable'] );
311  $this->fld_preload = isset( $prop['preload'] );
312  $this->fld_displaytitle = isset( $prop['displaytitle'] );
313  }
314 
315  $pageSet = $this->getPageSet();
316  $this->titles = $pageSet->getGoodTitles();
317  $this->missing = $pageSet->getMissingTitles();
318  $this->everything = $this->titles + $this->missing;
319  $result = $this->getResult();
320 
321  uasort( $this->everything, [ 'Title', 'compare' ] );
322  if ( !is_null( $this->params['continue'] ) ) {
323  // Throw away any titles we're gonna skip so they don't
324  // clutter queries
325  $cont = explode( '|', $this->params['continue'] );
326  $this->dieContinueUsageIf( count( $cont ) != 2 );
327  $conttitle = Title::makeTitleSafe( $cont[0], $cont[1] );
328  foreach ( $this->everything as $pageid => $title ) {
329  if ( Title::compare( $title, $conttitle ) >= 0 ) {
330  break;
331  }
332  unset( $this->titles[$pageid] );
333  unset( $this->missing[$pageid] );
334  unset( $this->everything[$pageid] );
335  }
336  }
337 
338  $this->pageRestrictions = $pageSet->getCustomField( 'page_restrictions' );
339  // when resolving redirects, no page will have this field
340  $this->pageIsRedir = !$pageSet->isResolvingRedirects()
341  ? $pageSet->getCustomField( 'page_is_redirect' )
342  : [];
343  $this->pageIsNew = $pageSet->getCustomField( 'page_is_new' );
344 
345  $this->pageTouched = $pageSet->getCustomField( 'page_touched' );
346  $this->pageLatest = $pageSet->getCustomField( 'page_latest' );
347  $this->pageLength = $pageSet->getCustomField( 'page_len' );
348 
349  // Get protection info if requested
350  if ( $this->fld_protection ) {
351  $this->getProtectionInfo();
352  }
353 
354  if ( $this->fld_watched || $this->fld_notificationtimestamp ) {
355  $this->getWatchedInfo();
356  }
357 
358  if ( $this->fld_watchers ) {
359  $this->getWatcherInfo();
360  }
361 
362  if ( $this->fld_visitingwatchers ) {
363  $this->getVisitingWatcherInfo();
364  }
365 
366  // Run the talkid/subjectid query if requested
367  if ( $this->fld_talkid || $this->fld_subjectid ) {
368  $this->getTSIDs();
369  }
370 
371  if ( $this->fld_displaytitle ) {
372  $this->getDisplayTitle();
373  }
374 
376  foreach ( $this->everything as $pageid => $title ) {
377  $pageInfo = $this->extractPageInfo( $pageid, $title );
378  $fit = $pageInfo !== null && $result->addValue( [
379  'query',
380  'pages'
381  ], $pageid, $pageInfo );
382  if ( !$fit ) {
383  $this->setContinueEnumParameter( 'continue',
384  $title->getNamespace() . '|' .
385  $title->getText() );
386  break;
387  }
388  }
389  }
390 
397  private function extractPageInfo( $pageid, $title ) {
398  $pageInfo = [];
399  // $title->exists() needs pageid, which is not set for all title objects
400  $titleExists = $pageid > 0;
401  $ns = $title->getNamespace();
402  $dbkey = $title->getDBkey();
403 
404  $pageInfo['contentmodel'] = $title->getContentModel();
405 
406  $pageLanguage = $title->getPageLanguage();
407  $pageInfo['pagelanguage'] = $pageLanguage->getCode();
408  $pageInfo['pagelanguagehtmlcode'] = $pageLanguage->getHtmlCode();
409  $pageInfo['pagelanguagedir'] = $pageLanguage->getDir();
410 
411  if ( $titleExists ) {
412  $pageInfo['touched'] = wfTimestamp( TS_ISO_8601, $this->pageTouched[$pageid] );
413  $pageInfo['lastrevid'] = intval( $this->pageLatest[$pageid] );
414  $pageInfo['length'] = intval( $this->pageLength[$pageid] );
415 
416  if ( isset( $this->pageIsRedir[$pageid] ) && $this->pageIsRedir[$pageid] ) {
417  $pageInfo['redirect'] = true;
418  }
419  if ( $this->pageIsNew[$pageid] ) {
420  $pageInfo['new'] = true;
421  }
422  }
423 
424  if ( !is_null( $this->params['token'] ) ) {
426  $pageInfo['starttimestamp'] = wfTimestamp( TS_ISO_8601, time() );
427  foreach ( $this->params['token'] as $t ) {
428  $val = call_user_func( $tokenFunctions[$t], $pageid, $title );
429  if ( $val === false ) {
430  $this->addWarning( [ 'apiwarn-tokennotallowed', $t ] );
431  } else {
432  $pageInfo[$t . 'token'] = $val;
433  }
434  }
435  }
436 
437  if ( $this->fld_protection ) {
438  $pageInfo['protection'] = [];
439  if ( isset( $this->protections[$ns][$dbkey] ) ) {
440  $pageInfo['protection'] =
441  $this->protections[$ns][$dbkey];
442  }
443  ApiResult::setIndexedTagName( $pageInfo['protection'], 'pr' );
444 
445  $pageInfo['restrictiontypes'] = [];
446  if ( isset( $this->restrictionTypes[$ns][$dbkey] ) ) {
447  $pageInfo['restrictiontypes'] =
448  $this->restrictionTypes[$ns][$dbkey];
449  }
450  ApiResult::setIndexedTagName( $pageInfo['restrictiontypes'], 'rt' );
451  }
452 
453  if ( $this->fld_watched && $this->watched !== null ) {
454  $pageInfo['watched'] = $this->watched[$ns][$dbkey];
455  }
456 
457  if ( $this->fld_watchers ) {
458  if ( $this->watchers !== null && $this->watchers[$ns][$dbkey] !== 0 ) {
459  $pageInfo['watchers'] = $this->watchers[$ns][$dbkey];
460  } elseif ( $this->showZeroWatchers ) {
461  $pageInfo['watchers'] = 0;
462  }
463  }
464 
465  if ( $this->fld_visitingwatchers ) {
466  if ( $this->visitingwatchers !== null && $this->visitingwatchers[$ns][$dbkey] !== 0 ) {
467  $pageInfo['visitingwatchers'] = $this->visitingwatchers[$ns][$dbkey];
468  } elseif ( $this->showZeroWatchers ) {
469  $pageInfo['visitingwatchers'] = 0;
470  }
471  }
472 
473  if ( $this->fld_notificationtimestamp ) {
474  $pageInfo['notificationtimestamp'] = '';
475  if ( $this->notificationtimestamps[$ns][$dbkey] ) {
476  $pageInfo['notificationtimestamp'] =
477  wfTimestamp( TS_ISO_8601, $this->notificationtimestamps[$ns][$dbkey] );
478  }
479  }
480 
481  if ( $this->fld_talkid && isset( $this->talkids[$ns][$dbkey] ) ) {
482  $pageInfo['talkid'] = $this->talkids[$ns][$dbkey];
483  }
484 
485  if ( $this->fld_subjectid && isset( $this->subjectids[$ns][$dbkey] ) ) {
486  $pageInfo['subjectid'] = $this->subjectids[$ns][$dbkey];
487  }
488 
489  if ( $this->fld_url ) {
490  $pageInfo['fullurl'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT );
491  $pageInfo['editurl'] = wfExpandUrl( $title->getFullURL( 'action=edit' ), PROTO_CURRENT );
492  $pageInfo['canonicalurl'] = wfExpandUrl( $title->getFullURL(), PROTO_CANONICAL );
493  }
494  if ( $this->fld_readable ) {
495  $pageInfo['readable'] = $title->userCan( 'read', $this->getUser() );
496  }
497 
498  if ( $this->fld_preload ) {
499  if ( $titleExists ) {
500  $pageInfo['preload'] = '';
501  } else {
502  $text = null;
503  Hooks::run( 'EditFormPreloadText', [ &$text, &$title ] );
504 
505  $pageInfo['preload'] = $text;
506  }
507  }
508 
509  if ( $this->fld_displaytitle ) {
510  if ( isset( $this->displaytitles[$pageid] ) ) {
511  $pageInfo['displaytitle'] = $this->displaytitles[$pageid];
512  } else {
513  $pageInfo['displaytitle'] = $title->getPrefixedText();
514  }
515  }
516 
517  if ( $this->params['testactions'] ) {
518  $limit = $this->getMain()->canApiHighLimits() ? self::LIMIT_SML1 : self::LIMIT_SML2;
519  if ( $this->countTestedActions >= $limit ) {
520  return null; // force a continuation
521  }
522 
523  $user = $this->getUser();
524  $pageInfo['actions'] = [];
525  foreach ( $this->params['testactions'] as $action ) {
526  $this->countTestedActions++;
527  $pageInfo['actions'][$action] = $title->userCan( $action, $user );
528  }
529  }
530 
531  return $pageInfo;
532  }
533 
537  private function getProtectionInfo() {
538  $this->protections = [];
539  $db = $this->getDB();
540 
541  // Get normal protections for existing titles
542  if ( count( $this->titles ) ) {
543  $this->resetQueryParams();
544  $this->addTables( 'page_restrictions' );
545  $this->addFields( [ 'pr_page', 'pr_type', 'pr_level',
546  'pr_expiry', 'pr_cascade' ] );
547  $this->addWhereFld( 'pr_page', array_keys( $this->titles ) );
548 
549  $res = $this->select( __METHOD__ );
550  foreach ( $res as $row ) {
552  $title = $this->titles[$row->pr_page];
553  $a = [
554  'type' => $row->pr_type,
555  'level' => $row->pr_level,
556  'expiry' => ApiResult::formatExpiry( $row->pr_expiry )
557  ];
558  if ( $row->pr_cascade ) {
559  $a['cascade'] = true;
560  }
561  $this->protections[$title->getNamespace()][$title->getDBkey()][] = $a;
562  }
563  // Also check old restrictions
564  foreach ( $this->titles as $pageId => $title ) {
565  if ( $this->pageRestrictions[$pageId] ) {
566  $namespace = $title->getNamespace();
567  $dbKey = $title->getDBkey();
568  $restrictions = explode( ':', trim( $this->pageRestrictions[$pageId] ) );
569  foreach ( $restrictions as $restrict ) {
570  $temp = explode( '=', trim( $restrict ) );
571  if ( count( $temp ) == 1 ) {
572  // old old format should be treated as edit/move restriction
573  $restriction = trim( $temp[0] );
574 
575  if ( $restriction == '' ) {
576  continue;
577  }
578  $this->protections[$namespace][$dbKey][] = [
579  'type' => 'edit',
580  'level' => $restriction,
581  'expiry' => 'infinity',
582  ];
583  $this->protections[$namespace][$dbKey][] = [
584  'type' => 'move',
585  'level' => $restriction,
586  'expiry' => 'infinity',
587  ];
588  } else {
589  $restriction = trim( $temp[1] );
590  if ( $restriction == '' ) {
591  continue;
592  }
593  $this->protections[$namespace][$dbKey][] = [
594  'type' => $temp[0],
595  'level' => $restriction,
596  'expiry' => 'infinity',
597  ];
598  }
599  }
600  }
601  }
602  }
603 
604  // Get protections for missing titles
605  if ( count( $this->missing ) ) {
606  $this->resetQueryParams();
607  $lb = new LinkBatch( $this->missing );
608  $this->addTables( 'protected_titles' );
609  $this->addFields( [ 'pt_title', 'pt_namespace', 'pt_create_perm', 'pt_expiry' ] );
610  $this->addWhere( $lb->constructSet( 'pt', $db ) );
611  $res = $this->select( __METHOD__ );
612  foreach ( $res as $row ) {
613  $this->protections[$row->pt_namespace][$row->pt_title][] = [
614  'type' => 'create',
615  'level' => $row->pt_create_perm,
616  'expiry' => ApiResult::formatExpiry( $row->pt_expiry )
617  ];
618  }
619  }
620 
621  // Separate good and missing titles into files and other pages
622  // and populate $this->restrictionTypes
623  $images = $others = [];
624  foreach ( $this->everything as $title ) {
625  if ( $title->getNamespace() == NS_FILE ) {
626  $images[] = $title->getDBkey();
627  } else {
628  $others[] = $title;
629  }
630  // Applicable protection types
631  $this->restrictionTypes[$title->getNamespace()][$title->getDBkey()] =
632  array_values( $title->getRestrictionTypes() );
633  }
634 
635  if ( count( $others ) ) {
636  // Non-images: check templatelinks
637  $lb = new LinkBatch( $others );
638  $this->resetQueryParams();
639  $this->addTables( [ 'page_restrictions', 'page', 'templatelinks' ] );
640  $this->addFields( [ 'pr_type', 'pr_level', 'pr_expiry',
641  'page_title', 'page_namespace',
642  'tl_title', 'tl_namespace' ] );
643  $this->addWhere( $lb->constructSet( 'tl', $db ) );
644  $this->addWhere( 'pr_page = page_id' );
645  $this->addWhere( 'pr_page = tl_from' );
646  $this->addWhereFld( 'pr_cascade', 1 );
647 
648  $res = $this->select( __METHOD__ );
649  foreach ( $res as $row ) {
650  $source = Title::makeTitle( $row->page_namespace, $row->page_title );
651  $this->protections[$row->tl_namespace][$row->tl_title][] = [
652  'type' => $row->pr_type,
653  'level' => $row->pr_level,
654  'expiry' => ApiResult::formatExpiry( $row->pr_expiry ),
655  'source' => $source->getPrefixedText()
656  ];
657  }
658  }
659 
660  if ( count( $images ) ) {
661  // Images: check imagelinks
662  $this->resetQueryParams();
663  $this->addTables( [ 'page_restrictions', 'page', 'imagelinks' ] );
664  $this->addFields( [ 'pr_type', 'pr_level', 'pr_expiry',
665  'page_title', 'page_namespace', 'il_to' ] );
666  $this->addWhere( 'pr_page = page_id' );
667  $this->addWhere( 'pr_page = il_from' );
668  $this->addWhereFld( 'pr_cascade', 1 );
669  $this->addWhereFld( 'il_to', $images );
670 
671  $res = $this->select( __METHOD__ );
672  foreach ( $res as $row ) {
673  $source = Title::makeTitle( $row->page_namespace, $row->page_title );
674  $this->protections[NS_FILE][$row->il_to][] = [
675  'type' => $row->pr_type,
676  'level' => $row->pr_level,
677  'expiry' => ApiResult::formatExpiry( $row->pr_expiry ),
678  'source' => $source->getPrefixedText()
679  ];
680  }
681  }
682  }
683 
688  private function getTSIDs() {
689  $getTitles = $this->talkids = $this->subjectids = [];
690 
692  foreach ( $this->everything as $t ) {
693  if ( MWNamespace::isTalk( $t->getNamespace() ) ) {
694  if ( $this->fld_subjectid ) {
695  $getTitles[] = $t->getSubjectPage();
696  }
697  } elseif ( $this->fld_talkid ) {
698  $getTitles[] = $t->getTalkPage();
699  }
700  }
701  if ( !count( $getTitles ) ) {
702  return;
703  }
704 
705  $db = $this->getDB();
706 
707  // Construct a custom WHERE clause that matches
708  // all titles in $getTitles
709  $lb = new LinkBatch( $getTitles );
710  $this->resetQueryParams();
711  $this->addTables( 'page' );
712  $this->addFields( [ 'page_title', 'page_namespace', 'page_id' ] );
713  $this->addWhere( $lb->constructSet( 'page', $db ) );
714  $res = $this->select( __METHOD__ );
715  foreach ( $res as $row ) {
716  if ( MWNamespace::isTalk( $row->page_namespace ) ) {
717  $this->talkids[MWNamespace::getSubject( $row->page_namespace )][$row->page_title] =
718  intval( $row->page_id );
719  } else {
720  $this->subjectids[MWNamespace::getTalk( $row->page_namespace )][$row->page_title] =
721  intval( $row->page_id );
722  }
723  }
724  }
725 
726  private function getDisplayTitle() {
727  $this->displaytitles = [];
728 
729  $pageIds = array_keys( $this->titles );
730 
731  if ( !count( $pageIds ) ) {
732  return;
733  }
734 
735  $this->resetQueryParams();
736  $this->addTables( 'page_props' );
737  $this->addFields( [ 'pp_page', 'pp_value' ] );
738  $this->addWhereFld( 'pp_page', $pageIds );
739  $this->addWhereFld( 'pp_propname', 'displaytitle' );
740  $res = $this->select( __METHOD__ );
741 
742  foreach ( $res as $row ) {
743  $this->displaytitles[$row->pp_page] = $row->pp_value;
744  }
745  }
746 
751  private function getWatchedInfo() {
752  $user = $this->getUser();
753 
754  if ( $user->isAnon() || count( $this->everything ) == 0
755  || !$user->isAllowed( 'viewmywatchlist' )
756  ) {
757  return;
758  }
759 
760  $this->watched = [];
761  $this->notificationtimestamps = [];
762 
763  $store = MediaWikiServices::getInstance()->getWatchedItemStore();
764  $timestamps = $store->getNotificationTimestampsBatch( $user, $this->everything );
765 
766  if ( $this->fld_watched ) {
767  foreach ( $timestamps as $namespaceId => $dbKeys ) {
768  $this->watched[$namespaceId] = array_map(
769  function( $x ) {
770  return $x !== false;
771  },
772  $dbKeys
773  );
774  }
775  }
776  if ( $this->fld_notificationtimestamp ) {
777  $this->notificationtimestamps = $timestamps;
778  }
779  }
780 
784  private function getWatcherInfo() {
785  if ( count( $this->everything ) == 0 ) {
786  return;
787  }
788 
789  $user = $this->getUser();
790  $canUnwatchedpages = $user->isAllowed( 'unwatchedpages' );
791  $unwatchedPageThreshold = $this->getConfig()->get( 'UnwatchedPageThreshold' );
792  if ( !$canUnwatchedpages && !is_int( $unwatchedPageThreshold ) ) {
793  return;
794  }
795 
796  $this->showZeroWatchers = $canUnwatchedpages;
797 
798  $countOptions = [];
799  if ( !$canUnwatchedpages ) {
800  $countOptions['minimumWatchers'] = $unwatchedPageThreshold;
801  }
802 
803  $this->watchers = MediaWikiServices::getInstance()->getWatchedItemStore()->countWatchersMultiple(
804  $this->everything,
805  $countOptions
806  );
807  }
808 
815  private function getVisitingWatcherInfo() {
816  $config = $this->getConfig();
817  $user = $this->getUser();
818  $db = $this->getDB();
819 
820  $canUnwatchedpages = $user->isAllowed( 'unwatchedpages' );
821  $unwatchedPageThreshold = $this->getConfig()->get( 'UnwatchedPageThreshold' );
822  if ( !$canUnwatchedpages && !is_int( $unwatchedPageThreshold ) ) {
823  return;
824  }
825 
826  $this->showZeroWatchers = $canUnwatchedpages;
827 
828  $titlesWithThresholds = [];
829  if ( $this->titles ) {
830  $lb = new LinkBatch( $this->titles );
831 
832  // Fetch last edit timestamps for pages
833  $this->resetQueryParams();
834  $this->addTables( [ 'page', 'revision' ] );
835  $this->addFields( [ 'page_namespace', 'page_title', 'rev_timestamp' ] );
836  $this->addWhere( [
837  'page_latest = rev_id',
838  $lb->constructSet( 'page', $db ),
839  ] );
840  $this->addOption( 'GROUP BY', [ 'page_namespace', 'page_title' ] );
841  $timestampRes = $this->select( __METHOD__ );
842 
843  $age = $config->get( 'WatchersMaxAge' );
844  $timestamps = [];
845  foreach ( $timestampRes as $row ) {
846  $revTimestamp = wfTimestamp( TS_UNIX, (int)$row->rev_timestamp );
847  $timestamps[$row->page_namespace][$row->page_title] = $revTimestamp - $age;
848  }
849  $titlesWithThresholds = array_map(
850  function( LinkTarget $target ) use ( $timestamps ) {
851  return [
852  $target, $timestamps[$target->getNamespace()][$target->getDBkey()]
853  ];
854  },
856  );
857  }
858 
859  if ( $this->missing ) {
860  $titlesWithThresholds = array_merge(
861  $titlesWithThresholds,
862  array_map(
863  function( LinkTarget $target ) {
864  return [ $target, null ];
865  },
867  )
868  );
869  }
870  $store = MediaWikiServices::getInstance()->getWatchedItemStore();
871  $this->visitingwatchers = $store->countVisitingWatchersMultiple(
872  $titlesWithThresholds,
873  !$canUnwatchedpages ? $unwatchedPageThreshold : null
874  );
875  }
876 
877  public function getCacheMode( $params ) {
878  // Other props depend on something about the current user
879  $publicProps = [
880  'protection',
881  'talkid',
882  'subjectid',
883  'url',
884  'preload',
885  'displaytitle',
886  ];
887  if ( array_diff( (array)$params['prop'], $publicProps ) ) {
888  return 'private';
889  }
890 
891  // testactions also depends on the current user
892  if ( $params['testactions'] ) {
893  return 'private';
894  }
895 
896  if ( !is_null( $params['token'] ) ) {
897  return 'private';
898  }
899 
900  return 'public';
901  }
902 
903  public function getAllowedParams() {
904  return [
905  'prop' => [
906  ApiBase::PARAM_ISMULTI => true,
908  'protection',
909  'talkid',
910  'watched', # private
911  'watchers', # private
912  'visitingwatchers', # private
913  'notificationtimestamp', # private
914  'subjectid',
915  'url',
916  'readable', # private
917  'preload',
918  'displaytitle',
919  // If you add more properties here, please consider whether they
920  // need to be added to getCacheMode()
921  ],
923  ],
924  'testactions' => [
925  ApiBase::PARAM_TYPE => 'string',
926  ApiBase::PARAM_ISMULTI => true,
927  ],
928  'token' => [
930  ApiBase::PARAM_ISMULTI => true,
931  ApiBase::PARAM_TYPE => array_keys( $this->getTokenFunctions() )
932  ],
933  'continue' => [
934  ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
935  ],
936  ];
937  }
938 
939  protected function getExamplesMessages() {
940  return [
941  'action=query&prop=info&titles=Main%20Page'
942  => 'apihelp-query+info-example-simple',
943  'action=query&prop=info&inprop=protection&titles=Main%20Page'
944  => 'apihelp-query+info-example-protection',
945  ];
946  }
947 
948  public function getHelpUrls() {
949  return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Info';
950  }
951 }
ApiQueryInfo\$talkids
$talkids
Definition: ApiQueryInfo.php:55
ApiQueryInfo\extractPageInfo
extractPageInfo( $pageid, $title)
Get a result array with information about a title.
Definition: ApiQueryInfo.php:397
ContextSource\getConfig
getConfig()
Get the Config object.
Definition: ContextSource.php:68
ApiQueryInfo\$everything
Title[] $everything
Definition: ApiQueryInfo.php:50
$wgUser
$wgUser
Definition: Setup.php:781
ApiQueryBase\addFields
addFields( $value)
Add a set of fields to select to the internal array.
Definition: ApiQueryBase.php:198
ApiQuery
This is the main query class.
Definition: ApiQuery.php:40
PROTO_CANONICAL
const PROTO_CANONICAL
Definition: Defines.php:221
ApiBase\addWarning
addWarning( $msg, $code=null, $data=null)
Add a warning for this module.
Definition: ApiBase.php:1720
ApiQueryInfo\$fld_url
$fld_url
Definition: ApiQueryInfo.php:37
ApiQueryInfo\$subjectids
$subjectids
Definition: ApiQueryInfo.php:55
ApiQueryInfo\$displaytitles
$displaytitles
Definition: ApiQueryInfo.php:55
MWNamespace\isTalk
static isTalk( $index)
Is the given namespace a talk namespace?
Definition: MWNamespace.php:96
ApiQueryBase\resetQueryParams
resetQueryParams()
Blank the internal arrays with query parameters.
Definition: ApiQueryBase.php:150
LinkBatch
Class representing a list of titles The execute() method checks them all for existence and adds them ...
Definition: LinkBatch.php:34
ApiQueryInfo\getProtectionInfo
getProtectionInfo()
Get information about protections and put it in $protections.
Definition: ApiQueryInfo.php:537
ApiQueryInfo\getUnblockToken
static getUnblockToken( $pageid, $title)
Definition: ApiQueryInfo.php:225
ApiQueryInfo\$pageTouched
$pageTouched
Definition: ApiQueryInfo.php:52
captcha-old.count
count
Definition: captcha-old.py:225
ApiQueryInfo\$showZeroWatchers
$showZeroWatchers
Definition: ApiQueryInfo.php:57
ApiBase\PARAM_HELP_MSG
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
Definition: ApiBase.php:128
ApiQueryInfo\resetTokenCache
static resetTokenCache()
Definition: ApiQueryInfo.php:130
$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. Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page. Return false to stop further processing of the tag $reader:XMLReader object & $pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports. & $fullInterwikiPrefix:Interwiki prefix, may contain colons. & $pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable. Can be used to lazy-load the import sources list. & $importSources:The value of $wgImportSources. Modify as necessary. See the comment in DefaultSettings.php for the detail of how to structure this array. '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 '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 '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 '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. '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 IP::isTrustedProxy() & $ip:IP being check & $result:Change this value to override the result of IP::isTrustedProxy() '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 Sanitizer::validateEmail(), 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. '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) '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 '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:Array with elements of the form "language:title" in the order that they will be output. & $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. 'LanguageSelector':Hook to change the language selector available on a page. $out:The output page. $cssClassName:CSS class name of the language selector. 'LinkBegin':DEPRECATED! Use HtmlPageLinkRendererBegin instead. 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:1954
wfTimestamp
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Definition: GlobalFunctions.php:1994
ApiQueryInfo\$tokenFunctions
$tokenFunctions
Definition: ApiQueryInfo.php:59
ApiBase\PARAM_TYPE
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
Definition: ApiBase.php:91
ApiBase\getResult
getResult()
Get the result object.
Definition: ApiBase.php:610
use
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:10
$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:246
ApiQueryInfo\getVisitingWatcherInfo
getVisitingWatcherInfo()
Get the count of watchers who have visited recent edits and put it in $this->visitingwatchers.
Definition: ApiQueryInfo.php:815
NS_FILE
const NS_FILE
Definition: Defines.php:68
$res
$res
Definition: database.txt:21
ApiQueryBase\addOption
addOption( $name, $value=null)
Add an option such as LIMIT or USE INDEX.
Definition: ApiQueryBase.php:333
ContextSource\getUser
getUser()
Get the User object.
Definition: ContextSource.php:133
ApiQueryInfo
A query module to show basic page information.
Definition: ApiQueryInfo.php:34
ApiBase\lacksSameOriginSecurity
lacksSameOriginSecurity()
Returns true if the current request breaks the same-origin policy.
Definition: ApiBase.php:538
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
ApiQueryInfo\$countTestedActions
$countTestedActions
Definition: ApiQueryInfo.php:61
ApiBase\PARAM_DEPRECATED
const PARAM_DEPRECATED
(boolean) Is the parameter deprecated (will show a warning)?
Definition: ApiBase.php:109
$query
null for the wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition: hooks.txt:1572
MediaWiki\Linker\LinkTarget\getNamespace
getNamespace()
Get the namespace index.
ApiQueryInfo\$visitingwatchers
$visitingwatchers
Definition: ApiQueryInfo.php:55
$title
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:934
ApiQueryInfo\getEmailToken
static getEmailToken( $pageid, $title)
Definition: ApiQueryInfo.php:233
ApiQueryInfo\getProtectToken
static getProtectToken( $pageid, $title)
Definition: ApiQueryInfo.php:174
ApiQueryBase
This is a base class for all Query modules.
Definition: ApiQueryBase.php:37
ApiQueryInfo\getWatchToken
static getWatchToken( $pageid, $title)
Definition: ApiQueryInfo.php:267
ApiQueryInfo\$pageRestrictions
$pageRestrictions
Definition: ApiQueryInfo.php:52
ApiQueryBase\getDB
getDB()
Get the Query database connection (read-only)
Definition: ApiQueryBase.php:111
PROTO_CURRENT
const PROTO_CURRENT
Definition: Defines.php:220
$limit
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object to manipulate or replace but no entry for that model exists in $wgContentHandlers please use GetContentModels hook to make them known to core if desired whether it is OK to use $contentModel on $title Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok inclusive $limit
Definition: hooks.txt:1049
ApiQueryBase\addTables
addTables( $tables, $alias=null)
Add a set of tables to the internal array.
Definition: ApiQueryBase.php:164
ApiQueryBase\select
select( $method, $extraQuery=[], array &$hookData=null)
Execute a SELECT query based on the values in the internal arrays.
Definition: ApiQueryBase.php:358
ApiQueryInfo\$titles
Title[] $titles
Definition: ApiQueryInfo.php:46
ApiQueryInfo\$fld_talkid
$fld_talkid
Definition: ApiQueryInfo.php:36
Title\makeTitle
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:514
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
ApiQueryInfo\$fld_displaytitle
$fld_displaytitle
Definition: ApiQueryInfo.php:41
ApiQueryInfo\$notificationtimestamps
$notificationtimestamps
Definition: ApiQueryInfo.php:55
ApiQueryInfo\getDeleteToken
static getDeleteToken( $pageid, $title)
Definition: ApiQueryInfo.php:157
ApiQueryInfo\getTSIDs
getTSIDs()
Get talk page IDs (if requested) and subject page IDs (if requested) and put them in $talkids and $su...
Definition: ApiQueryInfo.php:688
ApiQueryInfo\getWatchedInfo
getWatchedInfo()
Get information about watched status and put it in $this->watched and $this->notificationtimestamps.
Definition: ApiQueryInfo.php:751
ApiQueryInfo\$watched
$watched
Definition: ApiQueryInfo.php:55
ApiQueryInfo\$params
$params
Definition: ApiQueryInfo.php:43
ApiQueryInfo\getHelpUrls
getHelpUrls()
Return links to more detailed help pages about the module.
Definition: ApiQueryInfo.php:948
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:538
ApiBase\extractRequestParams
extractRequestParams( $parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user,...
Definition: ApiBase.php:718
ApiResult\setIndexedTagName
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
Definition: ApiResult.php:616
ApiQueryInfo\getImportToken
static getImportToken( $pageid, $title)
Definition: ApiQueryInfo.php:250
ApiQueryInfo\$pageIsNew
$pageIsNew
Definition: ApiQueryInfo.php:52
ApiQueryInfo\getExamplesMessages
getExamplesMessages()
Returns usage examples for this module.
Definition: ApiQueryInfo.php:939
ApiBase\dieContinueUsageIf
dieContinueUsageIf( $condition)
Die with the 'badcontinue' error.
Definition: ApiBase.php:1950
ApiQueryInfo\getTokenFunctions
getTokenFunctions()
Get an array mapping token names to their handler functions.
Definition: ApiQueryInfo.php:97
ApiBase\LIMIT_SML2
const LIMIT_SML2
Slow query, apihighlimits limit.
Definition: ApiBase.php:209
ApiQueryInfo\$fld_preload
$fld_preload
Definition: ApiQueryInfo.php:41
MediaWiki\Linker\LinkTarget\getDBkey
getDBkey()
Get the main part with underscores.
ApiQueryBase\addWhereFld
addWhereFld( $field, $value)
Equivalent to addWhere(array($field => $value))
Definition: ApiQueryBase.php:266
ApiQueryBase\getPageSet
getPageSet()
Get the PageSet object to work on.
Definition: ApiQueryBase.php:136
ApiQueryInfo\$fld_watchers
$fld_watchers
Definition: ApiQueryInfo.php:39
ApiQueryInfo\getCacheMode
getCacheMode( $params)
Get the cache mode for the data generated by this module.
Definition: ApiQueryInfo.php:877
ApiQueryInfo\$fld_subjectid
$fld_subjectid
Definition: ApiQueryInfo.php:37
Title
Represents a title within MediaWiki.
Definition: Title.php:39
ApiQueryInfo\$fld_watched
$fld_watched
Definition: ApiQueryInfo.php:38
ApiQueryInfo\getDisplayTitle
getDisplayTitle()
Definition: ApiQueryInfo.php:726
ApiQueryInfo\$fld_protection
$fld_protection
Definition: ApiQueryInfo.php:36
ApiQueryInfo\$watchers
$watchers
Definition: ApiQueryInfo.php:55
ApiQueryInfo\getEditToken
static getEditToken( $pageid, $title)
Definition: ApiQueryInfo.php:137
ApiQueryInfo\$pageLatest
$pageLatest
Definition: ApiQueryInfo.php:52
ApiQueryInfo\$restrictionTypes
$restrictionTypes
Definition: ApiQueryInfo.php:55
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
ApiQueryInfo\getAllowedParams
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
Definition: ApiQueryInfo.php:903
ApiBase\PARAM_ISMULTI
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
Definition: ApiBase.php:55
ApiQueryInfo\$protections
$protections
Definition: ApiQueryInfo.php:55
$source
$source
Definition: mwdoc-filter.php:45
ApiQueryInfo\getMoveToken
static getMoveToken( $pageid, $title)
Definition: ApiQueryInfo.php:191
ApiResult\formatExpiry
static formatExpiry( $expiry, $infinity='infinity')
Format an expiry timestamp for API output.
Definition: ApiResult.php:1207
ApiQueryInfo\getOptionsToken
static getOptionsToken( $pageid, $title)
Definition: ApiQueryInfo.php:284
ApiBase\getMain
getMain()
Get the main module.
Definition: ApiBase.php:506
ApiQueryInfo\$fld_notificationtimestamp
$fld_notificationtimestamp
Definition: ApiQueryInfo.php:40
ApiQueryBase\addWhere
addWhere( $value)
Add a set of WHERE clauses to the internal array.
Definition: ApiQueryBase.php:233
Title\compare
static compare(LinkTarget $a, LinkTarget $b)
Callback for usort() to do title sorts by (namespace, title)
Definition: Title.php:770
$t
$t
Definition: testCompression.php:67
ApiQueryBase\setContinueEnumParameter
setContinueEnumParameter( $paramName, $paramValue)
Set a query-continue value.
Definition: ApiQueryBase.php:535
ApiQueryInfo\$pageIsRedir
$pageIsRedir
Definition: ApiQueryInfo.php:52
MediaWikiServices
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency MediaWikiServices
Definition: injection.txt:23
MediaWiki\Linker\LinkTarget
Definition: LinkTarget.php:27
ApiQueryInfo\$cachedTokens
static $cachedTokens
Definition: ApiQueryInfo.php:125
MWNamespace\getTalk
static getTalk( $index)
Get the talk namespace index for a given namespace.
Definition: MWNamespace.php:107
ApiQueryInfo\getBlockToken
static getBlockToken( $pageid, $title)
Definition: ApiQueryInfo.php:208
ApiBase\PARAM_HELP_MSG_PER_VALUE
const PARAM_HELP_MSG_PER_VALUE
((string|array|Message)[]) When PARAM_TYPE is an array, this is an array mapping those values to $msg...
Definition: ApiBase.php:160
MWNamespace\getSubject
static getSubject( $index)
Get the subject namespace index for a given namespace Special namespaces (NS_MEDIA,...
Definition: MWNamespace.php:121
ApiQueryInfo\$fld_readable
$fld_readable
Definition: ApiQueryInfo.php:38
ApiQueryInfo\requestExtraData
requestExtraData( $pageSet)
Definition: ApiQueryInfo.php:71
ApiQueryInfo\$fld_visitingwatchers
$fld_visitingwatchers
Definition: ApiQueryInfo.php:39
ApiQueryInfo\execute
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
Definition: ApiQueryInfo.php:298
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:131
ApiQueryInfo\getWatcherInfo
getWatcherInfo()
Get the count of watchers and put it in $this->watchers.
Definition: ApiQueryInfo.php:784
ApiQueryInfo\$pageLength
$pageLength
Definition: ApiQueryInfo.php:52
ApiQueryInfo\$missing
Title[] $missing
Definition: ApiQueryInfo.php:48
ApiBase\LIMIT_SML1
const LIMIT_SML1
Slow query, standard limit.
Definition: ApiBase.php:207
wfExpandUrl
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
Definition: GlobalFunctions.php:552
array
the array() calling protocol came about after MediaWiki 1.4rc1.
ApiQueryInfo\__construct
__construct(ApiQuery $query, $moduleName)
Definition: ApiQueryInfo.php:63