MediaWiki  REL1_31
ApiQuerySiteinfo.php
Go to the documentation of this file.
1 <?php
23 
30 
31  public function __construct( ApiQuery $query, $moduleName ) {
32  parent::__construct( $query, $moduleName, 'si' );
33  }
34 
35  public function execute() {
36  $params = $this->extractRequestParams();
37  $done = [];
38  $fit = false;
39  foreach ( $params['prop'] as $p ) {
40  switch ( $p ) {
41  case 'general':
42  $fit = $this->appendGeneralInfo( $p );
43  break;
44  case 'namespaces':
45  $fit = $this->appendNamespaces( $p );
46  break;
47  case 'namespacealiases':
48  $fit = $this->appendNamespaceAliases( $p );
49  break;
50  case 'specialpagealiases':
51  $fit = $this->appendSpecialPageAliases( $p );
52  break;
53  case 'magicwords':
54  $fit = $this->appendMagicWords( $p );
55  break;
56  case 'interwikimap':
57  $filteriw = isset( $params['filteriw'] ) ? $params['filteriw'] : false;
58  $fit = $this->appendInterwikiMap( $p, $filteriw );
59  break;
60  case 'dbrepllag':
61  $fit = $this->appendDbReplLagInfo( $p, $params['showalldb'] );
62  break;
63  case 'statistics':
64  $fit = $this->appendStatistics( $p );
65  break;
66  case 'usergroups':
67  $fit = $this->appendUserGroups( $p, $params['numberingroup'] );
68  break;
69  case 'libraries':
70  $fit = $this->appendInstalledLibraries( $p );
71  break;
72  case 'extensions':
73  $fit = $this->appendExtensions( $p );
74  break;
75  case 'fileextensions':
76  $fit = $this->appendFileExtensions( $p );
77  break;
78  case 'rightsinfo':
79  $fit = $this->appendRightsInfo( $p );
80  break;
81  case 'restrictions':
82  $fit = $this->appendRestrictions( $p );
83  break;
84  case 'languages':
85  $fit = $this->appendLanguages( $p );
86  break;
87  case 'languagevariants':
88  $fit = $this->appendLanguageVariants( $p );
89  break;
90  case 'skins':
91  $fit = $this->appendSkins( $p );
92  break;
93  case 'extensiontags':
94  $fit = $this->appendExtensionTags( $p );
95  break;
96  case 'functionhooks':
97  $fit = $this->appendFunctionHooks( $p );
98  break;
99  case 'showhooks':
100  $fit = $this->appendSubscribedHooks( $p );
101  break;
102  case 'variables':
103  $fit = $this->appendVariables( $p );
104  break;
105  case 'protocols':
106  $fit = $this->appendProtocols( $p );
107  break;
108  case 'defaultoptions':
109  $fit = $this->appendDefaultOptions( $p );
110  break;
111  case 'uploaddialog':
112  $fit = $this->appendUploadDialog( $p );
113  break;
114  default:
115  ApiBase::dieDebug( __METHOD__, "Unknown prop=$p" );
116  }
117  if ( !$fit ) {
118  // Abuse siprop as a query-continue parameter
119  // and set it to all unprocessed props
120  $this->setContinueEnumParameter( 'prop', implode( '|',
121  array_diff( $params['prop'], $done ) ) );
122  break;
123  }
124  $done[] = $p;
125  }
126  }
127 
128  protected function appendGeneralInfo( $property ) {
130 
131  $config = $this->getConfig();
132 
133  $data = [];
134  $mainPage = Title::newMainPage();
135  $data['mainpage'] = $mainPage->getPrefixedText();
136  $data['base'] = wfExpandUrl( $mainPage->getFullURL(), PROTO_CURRENT );
137  $data['sitename'] = $config->get( 'Sitename' );
138 
139  // wgLogo can either be a relative or an absolute path
140  // make sure we always return an absolute path
141  $data['logo'] = wfExpandUrl( $config->get( 'Logo' ), PROTO_RELATIVE );
142 
143  $data['generator'] = "MediaWiki {$config->get( 'Version' )}";
144 
145  $data['phpversion'] = PHP_VERSION;
146  $data['phpsapi'] = PHP_SAPI;
147  if ( defined( 'HHVM_VERSION' ) ) {
148  $data['hhvmversion'] = HHVM_VERSION;
149  }
150  $data['dbtype'] = $config->get( 'DBtype' );
151  $data['dbversion'] = $this->getDB()->getServerVersion();
152 
153  $allowFrom = [ '' ];
154  $allowException = true;
155  if ( !$config->get( 'AllowExternalImages' ) ) {
156  $data['imagewhitelistenabled'] = (bool)$config->get( 'EnableImageWhitelist' );
157  $allowFrom = $config->get( 'AllowExternalImagesFrom' );
158  $allowException = !empty( $allowFrom );
159  }
160  if ( $allowException ) {
161  $data['externalimages'] = (array)$allowFrom;
162  ApiResult::setIndexedTagName( $data['externalimages'], 'prefix' );
163  }
164 
165  $data['langconversion'] = !$config->get( 'DisableLangConversion' );
166  $data['titleconversion'] = !$config->get( 'DisableTitleConversion' );
167 
168  if ( $wgContLang->linkPrefixExtension() ) {
169  $linkPrefixCharset = $wgContLang->linkPrefixCharset();
170  $data['linkprefixcharset'] = $linkPrefixCharset;
171  // For backwards compatibility
172  $data['linkprefix'] = "/^((?>.*[^$linkPrefixCharset]|))(.+)$/sDu";
173  } else {
174  $data['linkprefixcharset'] = '';
175  $data['linkprefix'] = '';
176  }
177 
178  $linktrail = $wgContLang->linkTrail();
179  $data['linktrail'] = $linktrail ?: '';
180 
181  $data['legaltitlechars'] = Title::legalChars();
182  $data['invalidusernamechars'] = $config->get( 'InvalidUsernameCharacters' );
183 
184  $data['allunicodefixes'] = (bool)$config->get( 'AllUnicodeFixes' );
185  $data['fixarabicunicode'] = (bool)$config->get( 'FixArabicUnicode' );
186  $data['fixmalayalamunicode'] = (bool)$config->get( 'FixMalayalamUnicode' );
187 
188  global $IP;
190  if ( $git ) {
191  $data['git-hash'] = $git;
192  $data['git-branch'] =
194  }
195 
196  // 'case-insensitive' option is reserved for future
197  $data['case'] = $config->get( 'CapitalLinks' ) ? 'first-letter' : 'case-sensitive';
198  $data['lang'] = $config->get( 'LanguageCode' );
199 
200  $fallbacks = [];
201  foreach ( $wgContLang->getFallbackLanguages() as $code ) {
202  $fallbacks[] = [ 'code' => $code ];
203  }
204  $data['fallback'] = $fallbacks;
205  ApiResult::setIndexedTagName( $data['fallback'], 'lang' );
206 
207  if ( $wgContLang->hasVariants() ) {
208  $variants = [];
209  foreach ( $wgContLang->getVariants() as $code ) {
210  $variants[] = [
211  'code' => $code,
212  'name' => $wgContLang->getVariantname( $code ),
213  ];
214  }
215  $data['variants'] = $variants;
216  ApiResult::setIndexedTagName( $data['variants'], 'lang' );
217  }
218 
219  $data['rtl'] = $wgContLang->isRTL();
220  $data['fallback8bitEncoding'] = $wgContLang->fallback8bitEncoding();
221 
222  $data['readonly'] = wfReadOnly();
223  if ( $data['readonly'] ) {
224  $data['readonlyreason'] = wfReadOnlyReason();
225  }
226  $data['writeapi'] = (bool)$config->get( 'EnableWriteAPI' );
227 
228  $data['maxarticlesize'] = $config->get( 'MaxArticleSize' ) * 1024;
229 
230  $tz = $config->get( 'Localtimezone' );
231  $offset = $config->get( 'LocalTZoffset' );
232  if ( is_null( $tz ) ) {
233  $tz = 'UTC';
234  $offset = 0;
235  } elseif ( is_null( $offset ) ) {
236  $offset = 0;
237  }
238  $data['timezone'] = $tz;
239  $data['timeoffset'] = intval( $offset );
240  $data['articlepath'] = $config->get( 'ArticlePath' );
241  $data['scriptpath'] = $config->get( 'ScriptPath' );
242  $data['script'] = $config->get( 'Script' );
243  $data['variantarticlepath'] = $config->get( 'VariantArticlePath' );
244  $data[ApiResult::META_BC_BOOLS][] = 'variantarticlepath';
245  $data['server'] = $config->get( 'Server' );
246  $data['servername'] = $config->get( 'ServerName' );
247  $data['wikiid'] = wfWikiID();
248  $data['time'] = wfTimestamp( TS_ISO_8601, time() );
249 
250  $data['misermode'] = (bool)$config->get( 'MiserMode' );
251 
252  $data['uploadsenabled'] = UploadBase::isEnabled();
253  $data['maxuploadsize'] = UploadBase::getMaxUploadSize();
254  $data['minuploadchunksize'] = (int)$config->get( 'MinUploadChunkSize' );
255 
256  $data['galleryoptions'] = $config->get( 'GalleryOptions' );
257 
258  $data['thumblimits'] = $config->get( 'ThumbLimits' );
259  ApiResult::setArrayType( $data['thumblimits'], 'BCassoc' );
260  ApiResult::setIndexedTagName( $data['thumblimits'], 'limit' );
261  $data['imagelimits'] = [];
262  ApiResult::setArrayType( $data['imagelimits'], 'BCassoc' );
263  ApiResult::setIndexedTagName( $data['imagelimits'], 'limit' );
264  foreach ( $config->get( 'ImageLimits' ) as $k => $limit ) {
265  $data['imagelimits'][$k] = [ 'width' => $limit[0], 'height' => $limit[1] ];
266  }
267 
268  $favicon = $config->get( 'Favicon' );
269  if ( !empty( $favicon ) ) {
270  // wgFavicon can either be a relative or an absolute path
271  // make sure we always return an absolute path
272  $data['favicon'] = wfExpandUrl( $favicon, PROTO_RELATIVE );
273  }
274 
275  $data['centralidlookupprovider'] = $config->get( 'CentralIdLookupProvider' );
276  $providerIds = array_keys( $config->get( 'CentralIdLookupProviders' ) );
277  $data['allcentralidlookupproviders'] = $providerIds;
278 
279  $data['interwikimagic'] = (bool)$config->get( 'InterwikiMagic' );
280  $data['magiclinks'] = $config->get( 'EnableMagicLinks' );
281 
282  $data['categorycollation'] = $config->get( 'CategoryCollation' );
283 
284  Hooks::run( 'APIQuerySiteInfoGeneralInfo', [ $this, &$data ] );
285 
286  return $this->getResult()->addValue( 'query', $property, $data );
287  }
288 
289  protected function appendNamespaces( $property ) {
291  $data = [
292  ApiResult::META_TYPE => 'assoc',
293  ];
294  foreach ( $wgContLang->getFormattedNamespaces() as $ns => $title ) {
295  $data[$ns] = [
296  'id' => intval( $ns ),
297  'case' => MWNamespace::isCapitalized( $ns ) ? 'first-letter' : 'case-sensitive',
298  ];
299  ApiResult::setContentValue( $data[$ns], 'name', $title );
300  $canonical = MWNamespace::getCanonicalName( $ns );
301 
302  $data[$ns]['subpages'] = MWNamespace::hasSubpages( $ns );
303 
304  if ( $canonical ) {
305  $data[$ns]['canonical'] = strtr( $canonical, '_', ' ' );
306  }
307 
308  $data[$ns]['content'] = MWNamespace::isContent( $ns );
309  $data[$ns]['nonincludable'] = MWNamespace::isNonincludable( $ns );
310 
311  $contentmodel = MWNamespace::getNamespaceContentModel( $ns );
312  if ( $contentmodel ) {
313  $data[$ns]['defaultcontentmodel'] = $contentmodel;
314  }
315  }
316 
317  ApiResult::setArrayType( $data, 'assoc' );
318  ApiResult::setIndexedTagName( $data, 'ns' );
319 
320  return $this->getResult()->addValue( 'query', $property, $data );
321  }
322 
323  protected function appendNamespaceAliases( $property ) {
325  $aliases = array_merge( $this->getConfig()->get( 'NamespaceAliases' ),
326  $wgContLang->getNamespaceAliases() );
327  $namespaces = $wgContLang->getNamespaces();
328  $data = [];
329  foreach ( $aliases as $title => $ns ) {
330  if ( $namespaces[$ns] == $title ) {
331  // Don't list duplicates
332  continue;
333  }
334  $item = [
335  'id' => intval( $ns )
336  ];
337  ApiResult::setContentValue( $item, 'alias', strtr( $title, '_', ' ' ) );
338  $data[] = $item;
339  }
340 
341  sort( $data );
342 
343  ApiResult::setIndexedTagName( $data, 'ns' );
344 
345  return $this->getResult()->addValue( 'query', $property, $data );
346  }
347 
348  protected function appendSpecialPageAliases( $property ) {
350  $data = [];
351  $aliases = $wgContLang->getSpecialPageAliases();
352  foreach ( SpecialPageFactory::getNames() as $specialpage ) {
353  if ( isset( $aliases[$specialpage] ) ) {
354  $arr = [ 'realname' => $specialpage, 'aliases' => $aliases[$specialpage] ];
355  ApiResult::setIndexedTagName( $arr['aliases'], 'alias' );
356  $data[] = $arr;
357  }
358  }
359  ApiResult::setIndexedTagName( $data, 'specialpage' );
360 
361  return $this->getResult()->addValue( 'query', $property, $data );
362  }
363 
364  protected function appendMagicWords( $property ) {
366  $data = [];
367  foreach ( $wgContLang->getMagicWords() as $magicword => $aliases ) {
368  $caseSensitive = array_shift( $aliases );
369  $arr = [ 'name' => $magicword, 'aliases' => $aliases ];
370  $arr['case-sensitive'] = (bool)$caseSensitive;
371  ApiResult::setIndexedTagName( $arr['aliases'], 'alias' );
372  $data[] = $arr;
373  }
374  ApiResult::setIndexedTagName( $data, 'magicword' );
375 
376  return $this->getResult()->addValue( 'query', $property, $data );
377  }
378 
379  protected function appendInterwikiMap( $property, $filter ) {
380  $local = null;
381  if ( $filter === 'local' ) {
382  $local = 1;
383  } elseif ( $filter === '!local' ) {
384  $local = 0;
385  } elseif ( $filter ) {
386  ApiBase::dieDebug( __METHOD__, "Unknown filter=$filter" );
387  }
388 
389  $params = $this->extractRequestParams();
390  $langCode = isset( $params['inlanguagecode'] ) ? $params['inlanguagecode'] : '';
391  $langNames = Language::fetchLanguageNames( $langCode );
392 
393  $getPrefixes = MediaWikiServices::getInstance()->getInterwikiLookup()->getAllPrefixes( $local );
394  $extraLangPrefixes = $this->getConfig()->get( 'ExtraInterlanguageLinkPrefixes' );
395  $localInterwikis = $this->getConfig()->get( 'LocalInterwikis' );
396  $data = [];
397 
398  foreach ( $getPrefixes as $row ) {
399  $prefix = $row['iw_prefix'];
400  $val = [];
401  $val['prefix'] = $prefix;
402  if ( isset( $row['iw_local'] ) && $row['iw_local'] == '1' ) {
403  $val['local'] = true;
404  }
405  if ( isset( $row['iw_trans'] ) && $row['iw_trans'] == '1' ) {
406  $val['trans'] = true;
407  }
408 
409  if ( isset( $langNames[$prefix] ) ) {
410  $val['language'] = $langNames[$prefix];
411  }
412  if ( in_array( $prefix, $localInterwikis ) ) {
413  $val['localinterwiki'] = true;
414  }
415  if ( in_array( $prefix, $extraLangPrefixes ) ) {
416  $val['extralanglink'] = true;
417 
418  $linktext = wfMessage( "interlanguage-link-$prefix" );
419  if ( !$linktext->isDisabled() ) {
420  $val['linktext'] = $linktext->text();
421  }
422 
423  $sitename = wfMessage( "interlanguage-link-sitename-$prefix" );
424  if ( !$sitename->isDisabled() ) {
425  $val['sitename'] = $sitename->text();
426  }
427  }
428 
429  $val['url'] = wfExpandUrl( $row['iw_url'], PROTO_CURRENT );
430  $val['protorel'] = substr( $row['iw_url'], 0, 2 ) == '//';
431  if ( isset( $row['iw_wikiid'] ) && $row['iw_wikiid'] !== '' ) {
432  $val['wikiid'] = $row['iw_wikiid'];
433  }
434  if ( isset( $row['iw_api'] ) && $row['iw_api'] !== '' ) {
435  $val['api'] = $row['iw_api'];
436  }
437 
438  $data[] = $val;
439  }
440 
441  ApiResult::setIndexedTagName( $data, 'iw' );
442 
443  return $this->getResult()->addValue( 'query', $property, $data );
444  }
445 
446  protected function appendDbReplLagInfo( $property, $includeAll ) {
447  $data = [];
448  $lb = MediaWikiServices::getInstance()->getDBLoadBalancer();
449  $showHostnames = $this->getConfig()->get( 'ShowHostnames' );
450  if ( $includeAll ) {
451  if ( !$showHostnames ) {
452  $this->dieWithError( 'apierror-siteinfo-includealldenied', 'includeAllDenied' );
453  }
454 
455  $lags = $lb->getLagTimes();
456  foreach ( $lags as $i => $lag ) {
457  $data[] = [
458  'host' => $lb->getServerName( $i ),
459  'lag' => $lag
460  ];
461  }
462  } else {
463  list( , $lag, $index ) = $lb->getMaxLag();
464  $data[] = [
465  'host' => $showHostnames
466  ? $lb->getServerName( $index )
467  : '',
468  'lag' => $lag
469  ];
470  }
471 
472  ApiResult::setIndexedTagName( $data, 'db' );
473 
474  return $this->getResult()->addValue( 'query', $property, $data );
475  }
476 
477  protected function appendStatistics( $property ) {
478  $data = [];
479  $data['pages'] = intval( SiteStats::pages() );
480  $data['articles'] = intval( SiteStats::articles() );
481  $data['edits'] = intval( SiteStats::edits() );
482  $data['images'] = intval( SiteStats::images() );
483  $data['users'] = intval( SiteStats::users() );
484  $data['activeusers'] = intval( SiteStats::activeUsers() );
485  $data['admins'] = intval( SiteStats::numberingroup( 'sysop' ) );
486  $data['jobs'] = intval( SiteStats::jobs() );
487 
488  Hooks::run( 'APIQuerySiteInfoStatisticsInfo', [ &$data ] );
489 
490  return $this->getResult()->addValue( 'query', $property, $data );
491  }
492 
493  protected function appendUserGroups( $property, $numberInGroup ) {
494  $config = $this->getConfig();
495 
496  $data = [];
497  $result = $this->getResult();
498  $allGroups = array_values( User::getAllGroups() );
499  foreach ( $config->get( 'GroupPermissions' ) as $group => $permissions ) {
500  $arr = [
501  'name' => $group,
502  'rights' => array_keys( $permissions, true ),
503  ];
504 
505  if ( $numberInGroup ) {
506  $autopromote = $config->get( 'Autopromote' );
507 
508  if ( $group == 'user' ) {
509  $arr['number'] = SiteStats::users();
510  // '*' and autopromote groups have no size
511  } elseif ( $group !== '*' && !isset( $autopromote[$group] ) ) {
512  $arr['number'] = SiteStats::numberingroup( $group );
513  }
514  }
515 
516  $groupArr = [
517  'add' => $config->get( 'AddGroups' ),
518  'remove' => $config->get( 'RemoveGroups' ),
519  'add-self' => $config->get( 'GroupsAddToSelf' ),
520  'remove-self' => $config->get( 'GroupsRemoveFromSelf' )
521  ];
522 
523  foreach ( $groupArr as $type => $rights ) {
524  if ( isset( $rights[$group] ) ) {
525  if ( $rights[$group] === true ) {
526  $groups = $allGroups;
527  } else {
528  $groups = array_intersect( $rights[$group], $allGroups );
529  }
530  if ( $groups ) {
531  $arr[$type] = $groups;
532  ApiResult::setArrayType( $arr[$type], 'BCarray' );
533  ApiResult::setIndexedTagName( $arr[$type], 'group' );
534  }
535  }
536  }
537 
538  ApiResult::setIndexedTagName( $arr['rights'], 'permission' );
539  $data[] = $arr;
540  }
541 
542  ApiResult::setIndexedTagName( $data, 'group' );
543 
544  return $result->addValue( 'query', $property, $data );
545  }
546 
547  protected function appendFileExtensions( $property ) {
548  $data = [];
549  foreach ( array_unique( $this->getConfig()->get( 'FileExtensions' ) ) as $ext ) {
550  $data[] = [ 'ext' => $ext ];
551  }
552  ApiResult::setIndexedTagName( $data, 'fe' );
553 
554  return $this->getResult()->addValue( 'query', $property, $data );
555  }
556 
557  protected function appendInstalledLibraries( $property ) {
558  global $IP;
559  $path = "$IP/vendor/composer/installed.json";
560  if ( !file_exists( $path ) ) {
561  return true;
562  }
563 
564  $data = [];
565  $installed = new ComposerInstalled( $path );
566  foreach ( $installed->getInstalledDependencies() as $name => $info ) {
567  if ( strpos( $info['type'], 'mediawiki-' ) === 0 ) {
568  // Skip any extensions or skins since they'll be listed
569  // in their proper section
570  continue;
571  }
572  $data[] = [
573  'name' => $name,
574  'version' => $info['version'],
575  ];
576  }
577  ApiResult::setIndexedTagName( $data, 'library' );
578 
579  return $this->getResult()->addValue( 'query', $property, $data );
580  }
581 
582  protected function appendExtensions( $property ) {
583  $data = [];
584  foreach ( $this->getConfig()->get( 'ExtensionCredits' ) as $type => $extensions ) {
585  foreach ( $extensions as $ext ) {
586  $ret = [];
587  $ret['type'] = $type;
588  if ( isset( $ext['name'] ) ) {
589  $ret['name'] = $ext['name'];
590  }
591  if ( isset( $ext['namemsg'] ) ) {
592  $ret['namemsg'] = $ext['namemsg'];
593  }
594  if ( isset( $ext['description'] ) ) {
595  $ret['description'] = $ext['description'];
596  }
597  if ( isset( $ext['descriptionmsg'] ) ) {
598  // Can be a string or [ key, param1, param2, ... ]
599  if ( is_array( $ext['descriptionmsg'] ) ) {
600  $ret['descriptionmsg'] = $ext['descriptionmsg'][0];
601  $ret['descriptionmsgparams'] = array_slice( $ext['descriptionmsg'], 1 );
602  ApiResult::setIndexedTagName( $ret['descriptionmsgparams'], 'param' );
603  } else {
604  $ret['descriptionmsg'] = $ext['descriptionmsg'];
605  }
606  }
607  if ( isset( $ext['author'] ) ) {
608  $ret['author'] = is_array( $ext['author'] ) ?
609  implode( ', ', $ext['author'] ) : $ext['author'];
610  }
611  if ( isset( $ext['url'] ) ) {
612  $ret['url'] = $ext['url'];
613  }
614  if ( isset( $ext['version'] ) ) {
615  $ret['version'] = $ext['version'];
616  }
617  if ( isset( $ext['path'] ) ) {
618  $extensionPath = dirname( $ext['path'] );
619  $gitInfo = new GitInfo( $extensionPath );
620  $vcsVersion = $gitInfo->getHeadSHA1();
621  if ( $vcsVersion !== false ) {
622  $ret['vcs-system'] = 'git';
623  $ret['vcs-version'] = $vcsVersion;
624  $ret['vcs-url'] = $gitInfo->getHeadViewUrl();
625  $vcsDate = $gitInfo->getHeadCommitDate();
626  if ( $vcsDate !== false ) {
627  $ret['vcs-date'] = wfTimestamp( TS_ISO_8601, $vcsDate );
628  }
629  }
630 
631  if ( SpecialVersion::getExtLicenseFileName( $extensionPath ) ) {
632  $ret['license-name'] = isset( $ext['license-name'] ) ? $ext['license-name'] : '';
633  $ret['license'] = SpecialPage::getTitleFor(
634  'Version',
635  "License/{$ext['name']}"
636  )->getLinkURL();
637  }
638 
639  if ( SpecialVersion::getExtAuthorsFileName( $extensionPath ) ) {
640  $ret['credits'] = SpecialPage::getTitleFor(
641  'Version',
642  "Credits/{$ext['name']}"
643  )->getLinkURL();
644  }
645  }
646  $data[] = $ret;
647  }
648  }
649 
650  ApiResult::setIndexedTagName( $data, 'ext' );
651 
652  return $this->getResult()->addValue( 'query', $property, $data );
653  }
654 
655  protected function appendRightsInfo( $property ) {
656  $config = $this->getConfig();
657  $rightsPage = $config->get( 'RightsPage' );
658  if ( is_string( $rightsPage ) ) {
659  $title = Title::newFromText( $rightsPage );
660  $url = wfExpandUrl( $title, PROTO_CURRENT );
661  } else {
662  $title = false;
663  $url = $config->get( 'RightsUrl' );
664  }
665  $text = $config->get( 'RightsText' );
666  if ( !$text && $title ) {
667  $text = $title->getPrefixedText();
668  }
669 
670  $data = [
671  'url' => $url ?: '',
672  'text' => $text ?: ''
673  ];
674 
675  return $this->getResult()->addValue( 'query', $property, $data );
676  }
677 
678  protected function appendRestrictions( $property ) {
679  $config = $this->getConfig();
680  $data = [
681  'types' => $config->get( 'RestrictionTypes' ),
682  'levels' => $config->get( 'RestrictionLevels' ),
683  'cascadinglevels' => $config->get( 'CascadingRestrictionLevels' ),
684  'semiprotectedlevels' => $config->get( 'SemiprotectedRestrictionLevels' ),
685  ];
686 
687  ApiResult::setArrayType( $data['types'], 'BCarray' );
688  ApiResult::setArrayType( $data['levels'], 'BCarray' );
689  ApiResult::setArrayType( $data['cascadinglevels'], 'BCarray' );
690  ApiResult::setArrayType( $data['semiprotectedlevels'], 'BCarray' );
691 
692  ApiResult::setIndexedTagName( $data['types'], 'type' );
693  ApiResult::setIndexedTagName( $data['levels'], 'level' );
694  ApiResult::setIndexedTagName( $data['cascadinglevels'], 'level' );
695  ApiResult::setIndexedTagName( $data['semiprotectedlevels'], 'level' );
696 
697  return $this->getResult()->addValue( 'query', $property, $data );
698  }
699 
700  public function appendLanguages( $property ) {
701  $params = $this->extractRequestParams();
702  $langCode = isset( $params['inlanguagecode'] ) ? $params['inlanguagecode'] : '';
703  $langNames = Language::fetchLanguageNames( $langCode );
704 
705  $data = [];
706 
707  foreach ( $langNames as $code => $name ) {
708  $lang = [ 'code' => $code ];
710  $data[] = $lang;
711  }
712  ApiResult::setIndexedTagName( $data, 'lang' );
713 
714  return $this->getResult()->addValue( 'query', $property, $data );
715  }
716 
717  // Export information about which page languages will trigger
718  // language conversion. (T153341)
719  public function appendLanguageVariants( $property ) {
721  if ( $this->getConfig()->get( 'DisableLangConversion' ) ) {
722  // Ensure result is empty if language conversion is disabled.
723  $langNames = [];
724  }
725  sort( $langNames );
726 
727  $data = [];
728  foreach ( $langNames as $langCode ) {
729  $lang = Language::factory( $langCode );
730  if ( $lang->getConverter() instanceof FakeConverter ) {
731  // Only languages which do not return instances of
732  // FakeConverter implement language conversion.
733  continue;
734  }
735  $data[$langCode] = [];
736  ApiResult::setIndexedTagName( $data[$langCode], 'variant' );
737  ApiResult::setArrayType( $data[$langCode], 'kvp', 'code' );
738 
739  $variants = $lang->getVariants();
740  sort( $variants );
741  foreach ( $variants as $v ) {
742  $fallbacks = $lang->getConverter()->getVariantFallbacks( $v );
743  if ( !is_array( $fallbacks ) ) {
744  $fallbacks = [ $fallbacks ];
745  }
746  $data[$langCode][$v] = [
747  'fallbacks' => $fallbacks,
748  ];
750  $data[$langCode][$v]['fallbacks'], 'variant'
751  );
752  }
753  }
754  ApiResult::setIndexedTagName( $data, 'lang' );
755  ApiResult::setArrayType( $data, 'kvp', 'code' );
756 
757  return $this->getResult()->addValue( 'query', $property, $data );
758  }
759 
760  public function appendSkins( $property ) {
761  $data = [];
762  $allowed = Skin::getAllowedSkins();
763  $default = Skin::normalizeKey( 'default' );
764  foreach ( Skin::getSkinNames() as $name => $displayName ) {
765  $msg = $this->msg( "skinname-{$name}" );
766  $code = $this->getParameter( 'inlanguagecode' );
767  if ( $code && Language::isValidCode( $code ) ) {
768  $msg->inLanguage( $code );
769  } else {
770  $msg->inContentLanguage();
771  }
772  if ( $msg->exists() ) {
773  $displayName = $msg->text();
774  }
775  $skin = [ 'code' => $name ];
776  ApiResult::setContentValue( $skin, 'name', $displayName );
777  if ( !isset( $allowed[$name] ) ) {
778  $skin['unusable'] = true;
779  }
780  if ( $name === $default ) {
781  $skin['default'] = true;
782  }
783  $data[] = $skin;
784  }
785  ApiResult::setIndexedTagName( $data, 'skin' );
786 
787  return $this->getResult()->addValue( 'query', $property, $data );
788  }
789 
790  public function appendExtensionTags( $property ) {
792  $wgParser->firstCallInit();
793  $tags = array_map( [ $this, 'formatParserTags' ], $wgParser->getTags() );
794  ApiResult::setArrayType( $tags, 'BCarray' );
795  ApiResult::setIndexedTagName( $tags, 't' );
796 
797  return $this->getResult()->addValue( 'query', $property, $tags );
798  }
799 
800  public function appendFunctionHooks( $property ) {
802  $wgParser->firstCallInit();
803  $hooks = $wgParser->getFunctionHooks();
804  ApiResult::setArrayType( $hooks, 'BCarray' );
805  ApiResult::setIndexedTagName( $hooks, 'h' );
806 
807  return $this->getResult()->addValue( 'query', $property, $hooks );
808  }
809 
810  public function appendVariables( $property ) {
811  $variables = MagicWord::getVariableIDs();
812  ApiResult::setArrayType( $variables, 'BCarray' );
813  ApiResult::setIndexedTagName( $variables, 'v' );
814 
815  return $this->getResult()->addValue( 'query', $property, $variables );
816  }
817 
818  public function appendProtocols( $property ) {
819  // Make a copy of the global so we don't try to set the _element key of it - T47130
820  $protocols = array_values( $this->getConfig()->get( 'UrlProtocols' ) );
821  ApiResult::setArrayType( $protocols, 'BCarray' );
822  ApiResult::setIndexedTagName( $protocols, 'p' );
823 
824  return $this->getResult()->addValue( 'query', $property, $protocols );
825  }
826 
827  public function appendDefaultOptions( $property ) {
829  $options[ApiResult::META_BC_BOOLS] = array_keys( $options );
830  return $this->getResult()->addValue( 'query', $property, $options );
831  }
832 
833  public function appendUploadDialog( $property ) {
834  $config = $this->getConfig()->get( 'UploadDialog' );
835  return $this->getResult()->addValue( 'query', $property, $config );
836  }
837 
838  private function formatParserTags( $item ) {
839  return "<{$item}>";
840  }
841 
842  public function appendSubscribedHooks( $property ) {
843  $hooks = $this->getConfig()->get( 'Hooks' );
844  $myWgHooks = $hooks;
845  ksort( $myWgHooks );
846 
847  $data = [];
848  foreach ( $myWgHooks as $name => $subscribers ) {
849  $arr = [
850  'name' => $name,
851  'subscribers' => array_map( [ SpecialVersion::class, 'arrayToString' ], $subscribers ),
852  ];
853 
854  ApiResult::setArrayType( $arr['subscribers'], 'array' );
855  ApiResult::setIndexedTagName( $arr['subscribers'], 's' );
856  $data[] = $arr;
857  }
858 
859  ApiResult::setIndexedTagName( $data, 'hook' );
860 
861  return $this->getResult()->addValue( 'query', $property, $data );
862  }
863 
864  public function getCacheMode( $params ) {
865  // Messages for $wgExtraInterlanguageLinkPrefixes depend on user language
866  if (
867  count( $this->getConfig()->get( 'ExtraInterlanguageLinkPrefixes' ) ) &&
868  !is_null( $params['prop'] ) &&
869  in_array( 'interwikimap', $params['prop'] )
870  ) {
871  return 'anon-public-user-private';
872  }
873 
874  return 'public';
875  }
876 
877  public function getAllowedParams() {
878  return [
879  'prop' => [
880  ApiBase::PARAM_DFLT => 'general',
881  ApiBase::PARAM_ISMULTI => true,
883  'general',
884  'namespaces',
885  'namespacealiases',
886  'specialpagealiases',
887  'magicwords',
888  'interwikimap',
889  'dbrepllag',
890  'statistics',
891  'usergroups',
892  'libraries',
893  'extensions',
894  'fileextensions',
895  'rightsinfo',
896  'restrictions',
897  'languages',
898  'languagevariants',
899  'skins',
900  'extensiontags',
901  'functionhooks',
902  'showhooks',
903  'variables',
904  'protocols',
905  'defaultoptions',
906  'uploaddialog',
907  ],
909  ],
910  'filteriw' => [
912  'local',
913  '!local',
914  ]
915  ],
916  'showalldb' => false,
917  'numberingroup' => false,
918  'inlanguagecode' => null,
919  ];
920  }
921 
922  protected function getExamplesMessages() {
923  return [
924  'action=query&meta=siteinfo&siprop=general|namespaces|namespacealiases|statistics'
925  => 'apihelp-query+siteinfo-example-simple',
926  'action=query&meta=siteinfo&siprop=interwikimap&sifilteriw=local'
927  => 'apihelp-query+siteinfo-example-interwiki',
928  'action=query&meta=siteinfo&siprop=dbrepllag&sishowalldb='
929  => 'apihelp-query+siteinfo-example-replag',
930  ];
931  }
932 
933  public function getHelpUrls() {
934  return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Siteinfo';
935  }
936 }
SiteStats\articles
static articles()
Definition: SiteStats.php:103
ContextSource\getConfig
getConfig()
Definition: ContextSource.php:63
Title\newFromText
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:273
MWNamespace\isNonincludable
static isNonincludable( $index)
It is not possible to use pages from this namespace as template?
Definition: MWNamespace.php:460
ApiQuery
This is the main query class.
Definition: ApiQuery.php:36
ApiQuerySiteinfo\appendProtocols
appendProtocols( $property)
Definition: ApiQuerySiteinfo.php:818
SpecialVersion\getExtAuthorsFileName
static getExtAuthorsFileName( $extDir)
Obtains the full path of an extensions authors or credits file if one exists.
Definition: SpecialVersion.php:1019
use
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
Definition: APACHE-LICENSE-2.0.txt:10
SiteStats\users
static users()
Definition: SiteStats.php:121
$wgParser
$wgParser
Definition: Setup.php:917
SiteStats\activeUsers
static activeUsers()
Definition: SiteStats.php:130
wfMessage
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "&lt
ApiQuerySiteinfo\appendInterwikiMap
appendInterwikiMap( $property, $filter)
Definition: ApiQuerySiteinfo.php:379
array
the array() calling protocol came about after MediaWiki 1.4rc1.
$lang
if(!isset( $args[0])) $lang
Definition: testCompression.php:33
ApiResult\META_TYPE
const META_TYPE
Key for the 'type' metadata item.
Definition: ApiResult.php:108
ApiBase\dieWithError
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
Definition: ApiBase.php:1895
ContextSource\msg
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
Definition: ContextSource.php:168
Title\newMainPage
static newMainPage()
Create a new Title for the Main Page.
Definition: Title.php:586
ApiQuerySiteinfo\appendFileExtensions
appendFileExtensions( $property)
Definition: ApiQuerySiteinfo.php:547
wfTimestamp
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Definition: GlobalFunctions.php:1980
UploadBase\isEnabled
static isEnabled()
Returns true if uploads are enabled.
Definition: UploadBase.php:113
$ret
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 & $ret
Definition: hooks.txt:2005
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:87
MWNamespace\getNamespaceContentModel
static getNamespaceContentModel( $index)
Get the default content model for a namespace This does not mean that all pages in that namespace hav...
Definition: MWNamespace.php:473
SiteStats\pages
static pages()
Definition: SiteStats.php:112
ApiBase\getResult
getResult()
Get the result object.
Definition: ApiBase.php:641
SiteStats\numberingroup
static numberingroup( $group)
Find the number of users in a given user group.
Definition: SiteStats.php:150
ApiQuerySiteinfo\__construct
__construct(ApiQuery $query, $moduleName)
Definition: ApiQuerySiteinfo.php:31
ApiQuerySiteinfo\appendNamespaceAliases
appendNamespaceAliases( $property)
Definition: ApiQuerySiteinfo.php:323
$params
$params
Definition: styleTest.css.php:40
wfReadOnly
wfReadOnly()
Check whether the wiki is in read-only mode.
Definition: GlobalFunctions.php:1262
ApiQuerySiteinfo\execute
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
Definition: ApiQuerySiteinfo.php:35
SpecialPage\getTitleFor
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Definition: SpecialPage.php:82
ApiQuerySiteinfo\appendVariables
appendVariables( $property)
Definition: ApiQuerySiteinfo.php:810
$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. 'ImgAuthModifyHeaders':Executed just before a file is streamed to a user via img_auth.php, allowing headers to be modified beforehand. $title:LinkTarget object & $headers:HTTP headers(name=> value, names are case insensitive). Two headers get special handling:If-Modified-Since(value must be a valid HTTP date) and Range(must be of the form "bytes=(\d*-\d*)") will be honored when streaming the file. '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 'ImportHandleUnknownUser':When a user doesn 't exist locally, this hook is called to give extensions an opportunity to auto-create it. If the auto-creation is successful, return false. $name:User name '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:1993
ApiQuerySiteinfo\appendExtensionTags
appendExtensionTags( $property)
Definition: ApiQuerySiteinfo.php:790
ApiQueryBase\$options
$options
Definition: ApiQueryBase.php:35
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:37
ApiQuerySiteinfo\appendRightsInfo
appendRightsInfo( $property)
Definition: ApiQuerySiteinfo.php:655
Skin\getSkinNames
static getSkinNames()
Fetch the set of available skins.
Definition: Skin.php:55
User\getDefaultOptions
static getDefaultOptions()
Combine the language default options with any site-specific options and add the default language vari...
Definition: User.php:1722
SiteStats\images
static images()
Definition: SiteStats.php:139
ApiResult\setContentValue
static setContentValue(array &$arr, $name, $value, $flags=0)
Add an output value to the array by name and mark as META_CONTENT.
Definition: ApiResult.php:478
ApiQuerySiteinfo\appendDbReplLagInfo
appendDbReplLagInfo( $property, $includeAll)
Definition: ApiQuerySiteinfo.php:446
ApiQuerySiteinfo
A query action to return meta information about the wiki site.
Definition: ApiQuerySiteinfo.php:29
ApiQuerySiteinfo\appendLanguageVariants
appendLanguageVariants( $property)
Definition: ApiQuerySiteinfo.php:719
MagicWord\getVariableIDs
static getVariableIDs()
Get an array of parser variable IDs.
Definition: MagicWord.php:291
ApiResult\setArrayType
static setArrayType(array &$arr, $type, $kvpKeyName=null)
Set the array data type.
Definition: ApiResult.php:728
$property
$property
Definition: styleTest.css.php:44
Skin\normalizeKey
static normalizeKey( $key)
Normalize a skin preference value to a form that can be loaded.
Definition: Skin.php:99
Language\fetchLanguageNames
static fetchLanguageNames( $inLanguage=null, $include='mw')
Get an array of language names, indexed by code.
Definition: Language.php:803
ApiQuerySiteinfo\appendFunctionHooks
appendFunctionHooks( $property)
Definition: ApiQuerySiteinfo.php:800
ApiQuerySiteinfo\appendDefaultOptions
appendDefaultOptions( $property)
Definition: ApiQuerySiteinfo.php:827
ApiQueryBase
This is a base class for all Query modules.
Definition: ApiQueryBase.php:33
ApiQueryBase\getDB
getDB()
Get the Query database connection (read-only)
Definition: ApiQueryBase.php:105
MWNamespace\isContent
static isContent( $index)
Does this namespace contain content, for the purposes of calculating statistics, etc?
Definition: MWNamespace.php:335
ApiQuerySiteinfo\getExamplesMessages
getExamplesMessages()
Returns usage examples for this module.
Definition: ApiQuerySiteinfo.php:922
PROTO_CURRENT
const PROTO_CURRENT
Definition: Defines.php:232
ApiQuerySiteinfo\formatParserTags
formatParserTags( $item)
Definition: ApiQuerySiteinfo.php:838
MWNamespace\hasSubpages
static hasSubpages( $index)
Does the namespace allow subpages?
Definition: MWNamespace.php:368
ApiResult\META_BC_BOOLS
const META_BC_BOOLS
Key for the 'BC bools' metadata item.
Definition: ApiResult.php:134
$title
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:964
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:95
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
SpecialVersion\getExtLicenseFileName
static getExtLicenseFileName( $extDir)
Obtains the full path of an extensions copying or license file if one exists.
Definition: SpecialVersion.php:1048
ApiQuerySiteinfo\appendUploadDialog
appendUploadDialog( $property)
Definition: ApiQuerySiteinfo.php:833
wfWikiID
wfWikiID()
Get an ASCII string identifying this wiki This is used as a prefix in memcached keys.
Definition: GlobalFunctions.php:2763
ApiBase\extractRequestParams
extractRequestParams( $parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user,...
Definition: ApiBase.php:749
ApiResult\setIndexedTagName
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
Definition: ApiResult.php:616
GitInfo
Definition: GitInfo.php:28
SpecialVersion\getGitCurrentBranch
static getGitCurrentBranch( $dir)
Definition: SpecialVersion.php:1132
ApiQuerySiteinfo\appendExtensions
appendExtensions( $property)
Definition: ApiQuerySiteinfo.php:582
SiteStats\jobs
static jobs()
Total number of jobs in the job queue.
Definition: SiteStats.php:178
PROTO_RELATIVE
const PROTO_RELATIVE
Definition: Defines.php:231
SpecialVersion\getGitHeadSha1
static getGitHeadSha1( $dir)
Definition: SpecialVersion.php:1122
User\getAllGroups
static getAllGroups()
Return the set of defined explicit groups.
Definition: User.php:5099
Language\isValidCode
static isValidCode( $code)
Returns true if a language code string is of a valid form, whether or not it exists.
Definition: Language.php:338
$linkPrefixCharset
$linkPrefixCharset
Definition: MessagesCrh_cyrl.php:101
FakeConverter
A fake language variant converter.
Definition: FakeConverter.php:34
UploadBase\getMaxUploadSize
static getMaxUploadSize( $forType=null)
Get the MediaWiki maximum uploaded file size for given type of upload, based on $wgMaxUploadSize.
Definition: UploadBase.php:2174
ApiQuerySiteinfo\appendLanguages
appendLanguages( $property)
Definition: ApiQuerySiteinfo.php:700
$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:2011
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:302
LanguageConverter\$languagesWithVariants
static array $languagesWithVariants
languages supporting variants
Definition: LanguageConverter.php:40
ApiQuerySiteinfo\appendSkins
appendSkins( $property)
Definition: ApiQuerySiteinfo.php:760
$namespaces
namespace and then decline to actually register it & $namespaces
Definition: hooks.txt:934
ApiQuerySiteinfo\appendUserGroups
appendUserGroups( $property, $numberInGroup)
Definition: ApiQuerySiteinfo.php:493
wfReadOnlyReason
wfReadOnlyReason()
Check if the site is in read-only mode and return the message if so.
Definition: GlobalFunctions.php:1275
$code
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code
Definition: hooks.txt:865
$path
$path
Definition: NoLocalSettings.php:25
ApiBase\PARAM_DFLT
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
Definition: ApiBase.php:48
ApiBase\getParameter
getParameter( $paramName, $parseLimit=true)
Get a value for the given parameter.
Definition: ApiBase.php:773
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:22
ApiQuerySiteinfo\appendMagicWords
appendMagicWords( $property)
Definition: ApiQuerySiteinfo.php:364
MWNamespace\isCapitalized
static isCapitalized( $index)
Is the namespace first-letter capitalized?
Definition: MWNamespace.php:421
ApiBase\PARAM_ISMULTI
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
Definition: ApiBase.php:51
SpecialPageFactory\getNames
static getNames()
Returns a list of canonical special page names.
Definition: SpecialPageFactory.php:211
ApiQuerySiteinfo\appendStatistics
appendStatistics( $property)
Definition: ApiQuerySiteinfo.php:477
ApiQuerySiteinfo\getCacheMode
getCacheMode( $params)
Get the cache mode for the data generated by this module.
Definition: ApiQuerySiteinfo.php:864
Language\factory
static factory( $code)
Get a cached or new language object for a given language code.
Definition: Language.php:183
ApiQuerySiteinfo\getHelpUrls
getHelpUrls()
Return links to more detailed help pages about the module.
Definition: ApiQuerySiteinfo.php:933
ApiQuerySiteinfo\appendRestrictions
appendRestrictions( $property)
Definition: ApiQuerySiteinfo.php:678
ApiQuerySiteinfo\appendGeneralInfo
appendGeneralInfo( $property)
Definition: ApiQuerySiteinfo.php:128
class
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
Definition: maintenance.txt:56
Title\legalChars
static legalChars()
Get a regex character class describing the legal characters in a link.
Definition: Title.php:623
ApiQueryBase\setContinueEnumParameter
setContinueEnumParameter( $paramName, $paramValue)
Set a query-continue value.
Definition: ApiQueryBase.php:531
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:25
Skin\getAllowedSkins
static getAllowedSkins()
Fetch the list of user-selectable skins in regards to $wgSkipSkins.
Definition: Skin.php:78
$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:1620
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:157
$IP
$IP
Definition: WebStart.php:52
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:203
$ext
$ext
Definition: router.php:55
ApiBase\dieDebug
static dieDebug( $method, $message)
Internal code errors should be reported with this method.
Definition: ApiBase.php:2078
ComposerInstalled
Reads an installed.json file and provides accessors to get what is installed.
Definition: ComposerInstalled.php:9
MWNamespace\getCanonicalName
static getCanonicalName( $index)
Returns the canonical (English) name for a given index.
Definition: MWNamespace.php:255
SiteStats\edits
static edits()
Definition: SiteStats.php:94
$GLOBALS
$GLOBALS['IP']
Definition: ComposerHookHandler.php:6
ApiQuerySiteinfo\getAllowedParams
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
Definition: ApiQuerySiteinfo.php:877
wfExpandUrl
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
Definition: GlobalFunctions.php:521
ApiQuerySiteinfo\appendInstalledLibraries
appendInstalledLibraries( $property)
Definition: ApiQuerySiteinfo.php:557
ApiQuerySiteinfo\appendSubscribedHooks
appendSubscribedHooks( $property)
Definition: ApiQuerySiteinfo.php:842
$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:57
ApiQuerySiteinfo\appendSpecialPageAliases
appendSpecialPageAliases( $property)
Definition: ApiQuerySiteinfo.php:348
$type
$type
Definition: testCompression.php:48
ApiQuerySiteinfo\appendNamespaces
appendNamespaces( $property)
Definition: ApiQuerySiteinfo.php:289