MediaWiki REL1_32
Installer.php
Go to the documentation of this file.
1<?php
30
46abstract class Installer {
47
54 const MINIMUM_PCRE_VERSION = '7.2';
55
59 protected $settings;
60
66 protected $compiledDBs;
67
73 protected $dbInstallers = [];
74
80 protected $minMemorySize = 50;
81
87 protected $parserTitle;
88
94 protected $parserOptions;
95
105 protected static $dbTypes = [
106 'mysql',
107 'postgres',
108 'oracle',
109 'mssql',
110 'sqlite',
111 ];
112
124 protected $envChecks = [
125 'envCheckDB',
126 'envCheckBrokenXML',
127 'envCheckPCRE',
128 'envCheckMemory',
129 'envCheckCache',
130 'envCheckModSecurity',
131 'envCheckDiff3',
132 'envCheckGraphics',
133 'envCheckGit',
134 'envCheckServer',
135 'envCheckPath',
136 'envCheckShellLocale',
137 'envCheckUploadsDirectory',
138 'envCheckLibicu',
139 'envCheckSuhosinMaxValueLength',
140 'envCheck64Bit',
141 ];
142
148 protected $envPreps = [
149 'envPrepServer',
150 'envPrepPath',
151 ];
152
160 protected $defaultVarNames = [
161 'wgSitename',
162 'wgPasswordSender',
163 'wgLanguageCode',
164 'wgRightsIcon',
165 'wgRightsText',
166 'wgRightsUrl',
167 'wgEnableEmail',
168 'wgEnableUserEmail',
169 'wgEnotifUserTalk',
170 'wgEnotifWatchlist',
171 'wgEmailAuthentication',
172 'wgDBname',
173 'wgDBtype',
174 'wgDiff3',
175 'wgImageMagickConvertCommand',
176 'wgGitBin',
177 'IP',
178 'wgScriptPath',
179 'wgMetaNamespace',
180 'wgDeletedDirectory',
181 'wgEnableUploads',
182 'wgShellLocale',
183 'wgSecretKey',
184 'wgUseInstantCommons',
185 'wgUpgradeKey',
186 'wgDefaultSkin',
187 'wgPingback',
188 ];
189
197 protected $internalDefaults = [
198 '_UserLang' => 'en',
199 '_Environment' => false,
200 '_RaiseMemory' => false,
201 '_UpgradeDone' => false,
202 '_InstallDone' => false,
203 '_Caches' => [],
204 '_InstallPassword' => '',
205 '_SameAccount' => true,
206 '_CreateDBAccount' => false,
207 '_NamespaceType' => 'site-name',
208 '_AdminName' => '', // will be set later, when the user selects language
209 '_AdminPassword' => '',
210 '_AdminPasswordConfirm' => '',
211 '_AdminEmail' => '',
212 '_Subscribe' => false,
213 '_SkipOptional' => 'continue',
214 '_RightsProfile' => 'wiki',
215 '_LicenseCode' => 'none',
216 '_CCDone' => false,
217 '_Extensions' => [],
218 '_Skins' => [],
219 '_MemCachedServers' => '',
220 '_UpgradeKeySupplied' => false,
221 '_ExistingDBSettings' => false,
222
223 // $wgLogo is probably wrong (T50084); set something that will work.
224 // Single quotes work fine here, as LocalSettingsGenerator outputs this unescaped.
225 'wgLogo' => '$wgResourceBasePath/resources/assets/wiki.png',
226 'wgAuthenticationTokenVersion' => 1,
227 ];
228
234 private $installSteps = [];
235
241 protected $extraInstallSteps = [];
242
248 protected $objectCaches = [
249 'apc' => 'apc_fetch',
250 'apcu' => 'apcu_fetch',
251 'wincache' => 'wincache_ucache_get'
252 ];
253
260 'wiki' => [],
261 'no-anon' => [
262 '*' => [ 'edit' => false ]
263 ],
264 'fishbowl' => [
265 '*' => [
266 'createaccount' => false,
267 'edit' => false,
268 ],
269 ],
270 'private' => [
271 '*' => [
272 'createaccount' => false,
273 'edit' => false,
274 'read' => false,
275 ],
276 ],
277 ];
278
284 public $licenses = [
285 'cc-by' => [
286 'url' => 'https://creativecommons.org/licenses/by/4.0/',
287 'icon' => '$wgResourceBasePath/resources/assets/licenses/cc-by.png',
288 ],
289 'cc-by-sa' => [
290 'url' => 'https://creativecommons.org/licenses/by-sa/4.0/',
291 'icon' => '$wgResourceBasePath/resources/assets/licenses/cc-by-sa.png',
292 ],
293 'cc-by-nc-sa' => [
294 'url' => 'https://creativecommons.org/licenses/by-nc-sa/4.0/',
295 'icon' => '$wgResourceBasePath/resources/assets/licenses/cc-by-nc-sa.png',
296 ],
297 'cc-0' => [
298 'url' => 'https://creativecommons.org/publicdomain/zero/1.0/',
299 'icon' => '$wgResourceBasePath/resources/assets/licenses/cc-0.png',
300 ],
301 'gfdl' => [
302 'url' => 'https://www.gnu.org/copyleft/fdl.html',
303 'icon' => '$wgResourceBasePath/resources/assets/licenses/gnu-fdl.png',
304 ],
305 'none' => [
306 'url' => '',
307 'icon' => '',
308 'text' => ''
309 ],
310 'cc-choose' => [
311 // Details will be filled in by the selector.
312 'url' => '',
313 'icon' => '',
314 'text' => '',
315 ],
316 ];
317
322 'https://lists.wikimedia.org/mailman/subscribe/mediawiki-announce';
323
328 'ca', 'cs', 'da', 'de', 'en', 'es', 'et', 'eu', 'fi', 'fr', 'hr', 'hu',
329 'it', 'ja', 'ko', 'lt', 'nl', 'no', 'pl', 'pt', 'pt-br', 'ro', 'ru',
330 'sl', 'sr', 'sv', 'tr', 'uk'
331 ];
332
340 abstract public function showMessage( $msg /*, ... */ );
341
346 abstract public function showError( $msg /*, ... */ );
347
352 abstract public function showStatusMessage( Status $status );
353
364 public static function getInstallerConfig( Config $baseConfig ) {
365 $configOverrides = new HashConfig();
366
367 // disable (problematic) object cache types explicitly, preserving all other (working) ones
368 // bug T113843
369 $emptyCache = [ 'class' => EmptyBagOStuff::class ];
370
371 $objectCaches = [
372 CACHE_NONE => $emptyCache,
373 CACHE_DB => $emptyCache,
374 CACHE_ANYTHING => $emptyCache,
375 CACHE_MEMCACHED => $emptyCache,
376 ] + $baseConfig->get( 'ObjectCaches' );
377
378 $configOverrides->set( 'ObjectCaches', $objectCaches );
379
380 // Load the installer's i18n.
381 $messageDirs = $baseConfig->get( 'MessagesDirs' );
382 $messageDirs['MediawikiInstaller'] = __DIR__ . '/i18n';
383
384 $configOverrides->set( 'MessagesDirs', $messageDirs );
385
386 $installerConfig = new MultiConfig( [ $configOverrides, $baseConfig ] );
387
388 // make sure we use the installer config as the main config
389 $configRegistry = $baseConfig->get( 'ConfigRegistry' );
390 $configRegistry['main'] = function () use ( $installerConfig ) {
391 return $installerConfig;
392 };
393
394 $configOverrides->set( 'ConfigRegistry', $configRegistry );
395
396 return $installerConfig;
397 }
398
402 public function __construct() {
403 global $wgMemc, $wgUser, $wgObjectCaches;
404
405 $defaultConfig = new GlobalVarConfig(); // all the stuff from DefaultSettings.php
406 $installerConfig = self::getInstallerConfig( $defaultConfig );
407
408 // Reset all services and inject config overrides
409 MediaWikiServices::resetGlobalInstance( $installerConfig );
410
411 // Don't attempt to load user language options (T126177)
412 // This will be overridden in the web installer with the user-specified language
413 RequestContext::getMain()->setLanguage( 'en' );
414
415 // Disable the i18n cache
416 // TODO: manage LocalisationCache singleton in MediaWikiServices
417 Language::getLocalisationCache()->disableBackend();
418
419 // Disable all global services, since we don't have any configuration yet!
420 MediaWikiServices::disableStorageBackend();
421
422 $mwServices = MediaWikiServices::getInstance();
423 // Disable object cache (otherwise CACHE_ANYTHING will try CACHE_DB and
424 // SqlBagOStuff will then throw since we just disabled wfGetDB)
425 $wgObjectCaches = $mwServices->getMainConfig()->get( 'ObjectCaches' );
426 $wgMemc = ObjectCache::getInstance( CACHE_NONE );
427
428 // Disable interwiki lookup, to avoid database access during parses
429 $mwServices->redefineService( 'InterwikiLookup', function () {
430 return new NullInterwikiLookup();
431 } );
432
433 // Having a user with id = 0 safeguards us from DB access via User::loadOptions().
434 $wgUser = User::newFromId( 0 );
435 RequestContext::getMain()->setUser( $wgUser );
436
438
439 foreach ( $this->defaultVarNames as $var ) {
440 $this->settings[$var] = $GLOBALS[$var];
441 }
442
443 $this->doEnvironmentPreps();
444
445 $this->compiledDBs = [];
446 foreach ( self::getDBTypes() as $type ) {
447 $installer = $this->getDBInstaller( $type );
448
449 if ( !$installer->isCompiled() ) {
450 continue;
451 }
452 $this->compiledDBs[] = $type;
453 }
454
455 $this->parserTitle = Title::newFromText( 'Installer' );
456 $this->parserOptions = new ParserOptions( $wgUser ); // language will be wrong :(
457 $this->parserOptions->setTidy( true );
458 // Don't try to access DB before user language is initialised
459 $this->setParserLanguage( Language::factory( 'en' ) );
460 }
461
467 public static function getDBTypes() {
468 return self::$dbTypes;
469 }
470
484 public function doEnvironmentChecks() {
485 // Php version has already been checked by entry scripts
486 // Show message here for information purposes
487 if ( wfIsHHVM() ) {
488 $this->showMessage( 'config-env-hhvm', HHVM_VERSION );
489 } else {
490 $this->showMessage( 'config-env-php', PHP_VERSION );
491 }
492
493 $good = true;
494 // Must go here because an old version of PCRE can prevent other checks from completing
495 list( $pcreVersion ) = explode( ' ', PCRE_VERSION, 2 );
496 if ( version_compare( $pcreVersion, self::MINIMUM_PCRE_VERSION, '<' ) ) {
497 $this->showError( 'config-pcre-old', self::MINIMUM_PCRE_VERSION, $pcreVersion );
498 $good = false;
499 } else {
500 foreach ( $this->envChecks as $check ) {
501 $status = $this->$check();
502 if ( $status === false ) {
503 $good = false;
504 }
505 }
506 }
507
508 $this->setVar( '_Environment', $good );
509
510 return $good ? Status::newGood() : Status::newFatal( 'config-env-bad' );
511 }
512
513 public function doEnvironmentPreps() {
514 foreach ( $this->envPreps as $prep ) {
515 $this->$prep();
516 }
517 }
518
525 public function setVar( $name, $value ) {
526 $this->settings[$name] = $value;
527 }
528
539 public function getVar( $name, $default = null ) {
540 if ( !isset( $this->settings[$name] ) ) {
541 return $default;
542 } else {
543 return $this->settings[$name];
544 }
545 }
546
552 public function getCompiledDBs() {
553 return $this->compiledDBs;
554 }
555
563 public static function getDBInstallerClass( $type ) {
564 return ucfirst( $type ) . 'Installer';
565 }
566
574 public function getDBInstaller( $type = false ) {
575 if ( !$type ) {
576 $type = $this->getVar( 'wgDBtype' );
577 }
578
579 $type = strtolower( $type );
580
581 if ( !isset( $this->dbInstallers[$type] ) ) {
583 $this->dbInstallers[$type] = new $class( $this );
584 }
585
586 return $this->dbInstallers[$type];
587 }
588
594 public static function getExistingLocalSettings() {
595 global $IP;
596
597 // You might be wondering why this is here. Well if you don't do this
598 // then some poorly-formed extensions try to call their own classes
599 // after immediately registering them. We really need to get extension
600 // registration out of the global scope and into a real format.
601 // @see https://phabricator.wikimedia.org/T69440
602 global $wgAutoloadClasses;
604
605 // LocalSettings.php should not call functions, except wfLoadSkin/wfLoadExtensions
606 // Define the required globals here, to ensure, the functions can do it work correctly.
607 // phpcs:ignore MediaWiki.VariableAnalysis.UnusedGlobalVariables
609
610 Wikimedia\suppressWarnings();
611 $_lsExists = file_exists( "$IP/LocalSettings.php" );
612 Wikimedia\restoreWarnings();
613
614 if ( !$_lsExists ) {
615 return false;
616 }
617 unset( $_lsExists );
618
619 require "$IP/includes/DefaultSettings.php";
620 require "$IP/LocalSettings.php";
621
622 return get_defined_vars();
623 }
624
634 public function getFakePassword( $realPassword ) {
635 return str_repeat( '*', strlen( $realPassword ) );
636 }
637
645 public function setPassword( $name, $value ) {
646 if ( !preg_match( '/^\*+$/', $value ) ) {
647 $this->setVar( $name, $value );
648 }
649 }
650
662 public static function maybeGetWebserverPrimaryGroup() {
663 if ( !function_exists( 'posix_getegid' ) || !function_exists( 'posix_getpwuid' ) ) {
664 # I don't know this, this isn't UNIX.
665 return null;
666 }
667
668 # posix_getegid() *not* getmygid() because we want the group of the webserver,
669 # not whoever owns the current script.
670 $gid = posix_getegid();
671 $group = posix_getpwuid( $gid )['name'];
672
673 return $group;
674 }
675
692 public function parse( $text, $lineStart = false ) {
693 global $wgParser;
694
695 try {
696 $out = $wgParser->parse( $text, $this->parserTitle, $this->parserOptions, $lineStart );
697 $html = $out->getText( [
698 'enableSectionEditLinks' => false,
699 'unwrap' => true,
700 ] );
701 $html = Parser::stripOuterParagraph( $html );
702 } catch ( MediaWiki\Services\ServiceDisabledException $e ) {
703 $html = '<!--DB access attempted during parse--> ' . htmlspecialchars( $text );
704 }
705
706 return $html;
707 }
708
712 public function getParserOptions() {
714 }
715
716 public function disableLinkPopups() {
717 $this->parserOptions->setExternalLinkTarget( false );
718 }
719
720 public function restoreLinkPopups() {
722 $this->parserOptions->setExternalLinkTarget( $wgExternalLinkTarget );
723 }
724
733 public function populateSiteStats( DatabaseInstaller $installer ) {
734 $status = $installer->getConnection();
735 if ( !$status->isOK() ) {
736 return $status;
737 }
738 $status->value->insert(
739 'site_stats',
740 [
741 'ss_row_id' => 1,
742 'ss_total_edits' => 0,
743 'ss_good_articles' => 0,
744 'ss_total_pages' => 0,
745 'ss_users' => 0,
746 'ss_active_users' => 0,
747 'ss_images' => 0
748 ],
749 __METHOD__, 'IGNORE'
750 );
751
752 return Status::newGood();
753 }
754
759 protected function envCheckDB() {
760 global $wgLang;
761
762 $allNames = [];
763
764 // Messages: config-type-mysql, config-type-postgres, config-type-oracle,
765 // config-type-sqlite
766 foreach ( self::getDBTypes() as $name ) {
767 $allNames[] = wfMessage( "config-type-$name" )->text();
768 }
769
770 $databases = $this->getCompiledDBs();
771
772 $databases = array_flip( $databases );
773 foreach ( array_keys( $databases ) as $db ) {
774 $installer = $this->getDBInstaller( $db );
775 $status = $installer->checkPrerequisites();
776 if ( !$status->isGood() ) {
777 $this->showStatusMessage( $status );
778 }
779 if ( !$status->isOK() ) {
780 unset( $databases[$db] );
781 }
782 }
783 $databases = array_flip( $databases );
784 if ( !$databases ) {
785 $this->showError( 'config-no-db', $wgLang->commaList( $allNames ), count( $allNames ) );
786
787 // @todo FIXME: This only works for the web installer!
788 return false;
789 }
790
791 return true;
792 }
793
798 protected function envCheckBrokenXML() {
799 $test = new PhpXmlBugTester();
800 if ( !$test->ok ) {
801 $this->showError( 'config-brokenlibxml' );
802
803 return false;
804 }
805
806 return true;
807 }
808
817 protected function envCheckPCRE() {
818 Wikimedia\suppressWarnings();
819 $regexd = preg_replace( '/[\x{0430}-\x{04FF}]/iu', '', '-АБВГД-' );
820 // Need to check for \p support too, as PCRE can be compiled
821 // with utf8 support, but not unicode property support.
822 // check that \p{Zs} (space separators) matches
823 // U+3000 (Ideographic space)
824 $regexprop = preg_replace( '/\p{Zs}/u', '', "-\u{3000}-" );
825 Wikimedia\restoreWarnings();
826 if ( $regexd != '--' || $regexprop != '--' ) {
827 $this->showError( 'config-pcre-no-utf8' );
828
829 return false;
830 }
831
832 return true;
833 }
834
839 protected function envCheckMemory() {
840 $limit = ini_get( 'memory_limit' );
841
842 if ( !$limit || $limit == -1 ) {
843 return true;
844 }
845
846 $n = wfShorthandToInteger( $limit );
847
848 if ( $n < $this->minMemorySize * 1024 * 1024 ) {
849 $newLimit = "{$this->minMemorySize}M";
850
851 if ( ini_set( "memory_limit", $newLimit ) === false ) {
852 $this->showMessage( 'config-memory-bad', $limit );
853 } else {
854 $this->showMessage( 'config-memory-raised', $limit, $newLimit );
855 $this->setVar( '_RaiseMemory', true );
856 }
857 }
858
859 return true;
860 }
861
865 protected function envCheckCache() {
866 $caches = [];
867 foreach ( $this->objectCaches as $name => $function ) {
868 if ( function_exists( $function ) ) {
869 $caches[$name] = true;
870 }
871 }
872
873 if ( !$caches ) {
874 $key = 'config-no-cache-apcu';
875 $this->showMessage( $key );
876 }
877
878 $this->setVar( '_Caches', $caches );
879 }
880
885 protected function envCheckModSecurity() {
886 if ( self::apacheModulePresent( 'mod_security' )
887 || self::apacheModulePresent( 'mod_security2' ) ) {
888 $this->showMessage( 'config-mod-security' );
889 }
890
891 return true;
892 }
893
898 protected function envCheckDiff3() {
899 $names = [ "gdiff3", "diff3" ];
900 if ( wfIsWindows() ) {
901 $names[] = 'diff3.exe';
902 }
903 $versionInfo = [ '--version', 'GNU diffutils' ];
904
905 $diff3 = ExecutableFinder::findInDefaultPaths( $names, $versionInfo );
906
907 if ( $diff3 ) {
908 $this->setVar( 'wgDiff3', $diff3 );
909 } else {
910 $this->setVar( 'wgDiff3', false );
911 $this->showMessage( 'config-diff3-bad' );
912 }
913
914 return true;
915 }
916
921 protected function envCheckGraphics() {
922 $names = wfIsWindows() ? 'convert.exe' : 'convert';
923 $versionInfo = [ '-version', 'ImageMagick' ];
924 $convert = ExecutableFinder::findInDefaultPaths( $names, $versionInfo );
925
926 $this->setVar( 'wgImageMagickConvertCommand', '' );
927 if ( $convert ) {
928 $this->setVar( 'wgImageMagickConvertCommand', $convert );
929 $this->showMessage( 'config-imagemagick', $convert );
930
931 return true;
932 } elseif ( function_exists( 'imagejpeg' ) ) {
933 $this->showMessage( 'config-gd' );
934 } else {
935 $this->showMessage( 'config-no-scaling' );
936 }
937
938 return true;
939 }
940
947 protected function envCheckGit() {
948 $names = wfIsWindows() ? 'git.exe' : 'git';
949 $versionInfo = [ '--version', 'git version' ];
950
951 $git = ExecutableFinder::findInDefaultPaths( $names, $versionInfo );
952
953 if ( $git ) {
954 $this->setVar( 'wgGitBin', $git );
955 $this->showMessage( 'config-git', $git );
956 } else {
957 $this->setVar( 'wgGitBin', false );
958 $this->showMessage( 'config-git-bad' );
959 }
960
961 return true;
962 }
963
969 protected function envCheckServer() {
970 $server = $this->envGetDefaultServer();
971 if ( $server !== null ) {
972 $this->showMessage( 'config-using-server', $server );
973 }
974 return true;
975 }
976
982 protected function envCheckPath() {
983 $this->showMessage(
984 'config-using-uri',
985 $this->getVar( 'wgServer' ),
986 $this->getVar( 'wgScriptPath' )
987 );
988 return true;
989 }
990
995 protected function envCheckShellLocale() {
996 $os = php_uname( 's' );
997 $supported = [ 'Linux', 'SunOS', 'HP-UX', 'Darwin' ]; # Tested these
998
999 if ( !in_array( $os, $supported ) ) {
1000 return true;
1001 }
1002
1003 if ( Shell::isDisabled() ) {
1004 return true;
1005 }
1006
1007 # Get a list of available locales.
1008 $result = Shell::command( '/usr/bin/locale', '-a' )
1009 ->execute();
1010
1011 if ( $result->getExitCode() != 0 ) {
1012 return true;
1013 }
1014
1015 $lines = $result->getStdout();
1016 $lines = array_map( 'trim', explode( "\n", $lines ) );
1017 $candidatesByLocale = [];
1018 $candidatesByLang = [];
1019 foreach ( $lines as $line ) {
1020 if ( $line === '' ) {
1021 continue;
1022 }
1023
1024 if ( !preg_match( '/^([a-zA-Z]+)(_[a-zA-Z]+|)\.(utf8|UTF-8)(@[a-zA-Z_]*|)$/i', $line, $m ) ) {
1025 continue;
1026 }
1027
1028 list( , $lang, , , ) = $m;
1029
1030 $candidatesByLocale[$m[0]] = $m;
1031 $candidatesByLang[$lang][] = $m;
1032 }
1033
1034 # Try the current value of LANG.
1035 if ( isset( $candidatesByLocale[getenv( 'LANG' )] ) ) {
1036 $this->setVar( 'wgShellLocale', getenv( 'LANG' ) );
1037
1038 return true;
1039 }
1040
1041 # Try the most common ones.
1042 $commonLocales = [ 'C.UTF-8', 'en_US.UTF-8', 'en_US.utf8', 'de_DE.UTF-8', 'de_DE.utf8' ];
1043 foreach ( $commonLocales as $commonLocale ) {
1044 if ( isset( $candidatesByLocale[$commonLocale] ) ) {
1045 $this->setVar( 'wgShellLocale', $commonLocale );
1046
1047 return true;
1048 }
1049 }
1050
1051 # Is there an available locale in the Wiki's language?
1052 $wikiLang = $this->getVar( 'wgLanguageCode' );
1053
1054 if ( isset( $candidatesByLang[$wikiLang] ) ) {
1055 $m = reset( $candidatesByLang[$wikiLang] );
1056 $this->setVar( 'wgShellLocale', $m[0] );
1057
1058 return true;
1059 }
1060
1061 # Are there any at all?
1062 if ( count( $candidatesByLocale ) ) {
1063 $m = reset( $candidatesByLocale );
1064 $this->setVar( 'wgShellLocale', $m[0] );
1065
1066 return true;
1067 }
1068
1069 # Give up.
1070 return true;
1071 }
1072
1077 protected function envCheckUploadsDirectory() {
1078 global $IP;
1079
1080 $dir = $IP . '/images/';
1081 $url = $this->getVar( 'wgServer' ) . $this->getVar( 'wgScriptPath' ) . '/images/';
1082 $safe = !$this->dirIsExecutable( $dir, $url );
1083
1084 if ( !$safe ) {
1085 $this->showMessage( 'config-uploads-not-safe', $dir );
1086 }
1087
1088 return true;
1089 }
1090
1096 protected function envCheckSuhosinMaxValueLength() {
1097 $maxValueLength = ini_get( 'suhosin.get.max_value_length' );
1098 if ( $maxValueLength > 0 && $maxValueLength < 1024 ) {
1099 // Only warn if the value is below the sane 1024
1100 $this->showMessage( 'config-suhosin-max-value-length', $maxValueLength );
1101 }
1102
1103 return true;
1104 }
1105
1112 protected function envCheck64Bit() {
1113 if ( PHP_INT_SIZE == 4 ) {
1114 $this->showMessage( 'config-using-32bit' );
1115 }
1116
1117 return true;
1118 }
1119
1123 protected function envCheckLibicu() {
1131 $not_normal_c = "\u{FA6C}";
1132 $normal_c = "\u{242EE}";
1133
1134 $useNormalizer = 'php';
1135 $needsUpdate = false;
1136
1137 if ( function_exists( 'normalizer_normalize' ) ) {
1138 $useNormalizer = 'intl';
1139 $intl = normalizer_normalize( $not_normal_c, Normalizer::FORM_C );
1140 if ( $intl !== $normal_c ) {
1141 $needsUpdate = true;
1142 }
1143 }
1144
1145 // Uses messages 'config-unicode-using-php' and 'config-unicode-using-intl'
1146 if ( $useNormalizer === 'php' ) {
1147 $this->showMessage( 'config-unicode-pure-php-warning' );
1148 } else {
1149 $this->showMessage( 'config-unicode-using-' . $useNormalizer );
1150 if ( $needsUpdate ) {
1151 $this->showMessage( 'config-unicode-update-warning' );
1152 }
1153 }
1154 }
1155
1159 protected function envPrepServer() {
1160 $server = $this->envGetDefaultServer();
1161 if ( $server !== null ) {
1162 $this->setVar( 'wgServer', $server );
1163 }
1164 }
1165
1170 abstract protected function envGetDefaultServer();
1171
1175 protected function envPrepPath() {
1176 global $IP;
1177 $IP = dirname( dirname( __DIR__ ) );
1178 $this->setVar( 'IP', $IP );
1179 }
1180
1189 public function dirIsExecutable( $dir, $url ) {
1190 $scriptTypes = [
1191 'php' => [
1192 "<?php echo 'ex' . 'ec';",
1193 "#!/var/env php\n<?php echo 'ex' . 'ec';",
1194 ],
1195 ];
1196
1197 // it would be good to check other popular languages here, but it'll be slow.
1198
1199 Wikimedia\suppressWarnings();
1200
1201 foreach ( $scriptTypes as $ext => $contents ) {
1202 foreach ( $contents as $source ) {
1203 $file = 'exectest.' . $ext;
1204
1205 if ( !file_put_contents( $dir . $file, $source ) ) {
1206 break;
1207 }
1208
1209 try {
1210 $text = Http::get( $url . $file, [ 'timeout' => 3 ], __METHOD__ );
1211 } catch ( Exception $e ) {
1212 // Http::get throws with allow_url_fopen = false and no curl extension.
1213 $text = null;
1214 }
1215 unlink( $dir . $file );
1216
1217 if ( $text == 'exec' ) {
1218 Wikimedia\restoreWarnings();
1219
1220 return $ext;
1221 }
1222 }
1223 }
1224
1225 Wikimedia\restoreWarnings();
1226
1227 return false;
1228 }
1229
1236 public static function apacheModulePresent( $moduleName ) {
1237 if ( function_exists( 'apache_get_modules' ) && in_array( $moduleName, apache_get_modules() ) ) {
1238 return true;
1239 }
1240 // try it the hard way
1241 ob_start();
1242 phpinfo( INFO_MODULES );
1243 $info = ob_get_clean();
1244
1245 return strpos( $info, $moduleName ) !== false;
1246 }
1247
1253 public function setParserLanguage( $lang ) {
1254 $this->parserOptions->setTargetLanguage( $lang );
1255 $this->parserOptions->setUserLang( $lang );
1256 }
1257
1263 protected function getDocUrl( $page ) {
1264 return "{$_SERVER['PHP_SELF']}?page=" . urlencode( $page );
1265 }
1266
1275 public function findExtensions( $directory = 'extensions' ) {
1276 switch ( $directory ) {
1277 case 'extensions':
1278 return $this->findExtensionsByType( 'extension', 'extensions' );
1279 case 'skins':
1280 return $this->findExtensionsByType( 'skin', 'skins' );
1281 default:
1282 throw new InvalidArgumentException( "Invalid extension type" );
1283 }
1284 }
1285
1294 protected function findExtensionsByType( $type = 'extension', $directory = 'extensions' ) {
1295 if ( $this->getVar( 'IP' ) === null ) {
1296 return [];
1297 }
1298
1299 $extDir = $this->getVar( 'IP' ) . '/' . $directory;
1300 if ( !is_readable( $extDir ) || !is_dir( $extDir ) ) {
1301 return [];
1302 }
1303
1304 $dh = opendir( $extDir );
1305 $exts = [];
1306 while ( ( $file = readdir( $dh ) ) !== false ) {
1307 if ( !is_dir( "$extDir/$file" ) ) {
1308 continue;
1309 }
1310 $status = $this->getExtensionInfo( $type, $directory, $file );
1311 if ( $status->isOK() ) {
1312 $exts[$file] = $status->value;
1313 }
1314 }
1315 closedir( $dh );
1316 uksort( $exts, 'strnatcasecmp' );
1317
1318 return $exts;
1319 }
1320
1328 protected function getExtensionInfo( $type, $parentRelPath, $name ) {
1329 if ( $this->getVar( 'IP' ) === null ) {
1330 throw new Exception( 'Cannot find extensions since the IP variable is not yet set' );
1331 }
1332 if ( $type !== 'extension' && $type !== 'skin' ) {
1333 throw new InvalidArgumentException( "Invalid extension type" );
1334 }
1335 $absDir = $this->getVar( 'IP' ) . "/$parentRelPath/$name";
1336 $relDir = "../$parentRelPath/$name";
1337 if ( !is_dir( $absDir ) ) {
1338 return Status::newFatal( 'config-extension-not-found', $name );
1339 }
1340 $jsonFile = $type . '.json';
1341 $fullJsonFile = "$absDir/$jsonFile";
1342 $isJson = file_exists( $fullJsonFile );
1343 $isPhp = false;
1344 if ( !$isJson ) {
1345 // Only fallback to PHP file if JSON doesn't exist
1346 $fullPhpFile = "$absDir/$name.php";
1347 $isPhp = file_exists( $fullPhpFile );
1348 }
1349 if ( !$isJson && !$isPhp ) {
1350 return Status::newFatal( 'config-extension-not-found', $name );
1351 }
1352
1353 // Extension exists. Now see if there are screenshots
1354 $info = [];
1355 if ( is_dir( "$absDir/screenshots" ) ) {
1356 $paths = glob( "$absDir/screenshots/*.png" );
1357 foreach ( $paths as $path ) {
1358 $info['screenshots'][] = str_replace( $absDir, $relDir, $path );
1359 }
1360 }
1361
1362 if ( $isJson ) {
1363 $jsonStatus = $this->readExtension( $fullJsonFile );
1364 if ( !$jsonStatus->isOK() ) {
1365 return $jsonStatus;
1366 }
1367 $info += $jsonStatus->value;
1368 }
1369
1370 return Status::newGood( $info );
1371 }
1372
1381 private function readExtension( $fullJsonFile, $extDeps = [], $skinDeps = [] ) {
1382 $load = [
1383 $fullJsonFile => 1
1384 ];
1385 if ( $extDeps ) {
1386 $extDir = $this->getVar( 'IP' ) . '/extensions';
1387 foreach ( $extDeps as $dep ) {
1388 $fname = "$extDir/$dep/extension.json";
1389 if ( !file_exists( $fname ) ) {
1390 return Status::newFatal( 'config-extension-not-found', $dep );
1391 }
1392 $load[$fname] = 1;
1393 }
1394 }
1395 if ( $skinDeps ) {
1396 $skinDir = $this->getVar( 'IP' ) . '/skins';
1397 foreach ( $skinDeps as $dep ) {
1398 $fname = "$skinDir/$dep/skin.json";
1399 if ( !file_exists( $fname ) ) {
1400 return Status::newFatal( 'config-extension-not-found', $dep );
1401 }
1402 $load[$fname] = 1;
1403 }
1404 }
1405 $registry = new ExtensionRegistry();
1406 try {
1407 $info = $registry->readFromQueue( $load );
1408 } catch ( ExtensionDependencyError $e ) {
1409 if ( $e->incompatibleCore || $e->incompatibleSkins
1410 || $e->incompatibleExtensions
1411 ) {
1412 // If something is incompatible with a dependency, we have no real
1413 // option besides skipping it
1414 return Status::newFatal( 'config-extension-dependency',
1415 basename( dirname( $fullJsonFile ) ), $e->getMessage() );
1416 } elseif ( $e->missingExtensions || $e->missingSkins ) {
1417 // There's an extension missing in the dependency tree,
1418 // so add those to the dependency list and try again
1419 return $this->readExtension(
1420 $fullJsonFile,
1421 array_merge( $extDeps, $e->missingExtensions ),
1422 array_merge( $skinDeps, $e->missingSkins )
1423 );
1424 }
1425 // Some other kind of dependency error?
1426 return Status::newFatal( 'config-extension-dependency',
1427 basename( dirname( $fullJsonFile ) ), $e->getMessage() );
1428 }
1429 $ret = [];
1430 // The order of credits will be the order of $load,
1431 // so the first extension is the one we want to load,
1432 // everything else is a dependency
1433 $i = 0;
1434 foreach ( $info['credits'] as $name => $credit ) {
1435 $i++;
1436 if ( $i == 1 ) {
1437 // Extension we want to load
1438 continue;
1439 }
1440 $type = basename( $credit['path'] ) === 'skin.json' ? 'skins' : 'extensions';
1441 $ret['requires'][$type][] = $credit['name'];
1442 }
1443 $credits = array_values( $info['credits'] )[0];
1444 if ( isset( $credits['url'] ) ) {
1445 $ret['url'] = $credits['url'];
1446 }
1447 $ret['type'] = $credits['type'];
1448
1449 return Status::newGood( $ret );
1450 }
1451
1460 public function getDefaultSkin( array $skinNames ) {
1461 $defaultSkin = $GLOBALS['wgDefaultSkin'];
1462 if ( !$skinNames || in_array( $defaultSkin, $skinNames ) ) {
1463 return $defaultSkin;
1464 } else {
1465 return $skinNames[0];
1466 }
1467 }
1468
1474 protected function includeExtensions() {
1475 global $IP;
1476 $exts = $this->getVar( '_Extensions' );
1477 $IP = $this->getVar( 'IP' );
1478
1479 // Marker for DatabaseUpdater::loadExtensions so we don't
1480 // double load extensions
1481 define( 'MW_EXTENSIONS_LOADED', true );
1482
1491 global $wgAutoloadClasses;
1492 $wgAutoloadClasses = [];
1493 $queue = [];
1494
1495 require "$IP/includes/DefaultSettings.php";
1496
1497 foreach ( $exts as $e ) {
1498 if ( file_exists( "$IP/extensions/$e/extension.json" ) ) {
1499 $queue["$IP/extensions/$e/extension.json"] = 1;
1500 } else {
1501 require_once "$IP/extensions/$e/$e.php";
1502 }
1503 }
1504
1505 $registry = new ExtensionRegistry();
1506 $data = $registry->readFromQueue( $queue );
1507 $wgAutoloadClasses += $data['autoload'];
1508
1509 $hooksWeWant = isset( $wgHooks['LoadExtensionSchemaUpdates'] ) ?
1511 $wgHooks['LoadExtensionSchemaUpdates'] : [];
1512
1513 if ( isset( $data['globals']['wgHooks']['LoadExtensionSchemaUpdates'] ) ) {
1514 $hooksWeWant = array_merge_recursive(
1515 $hooksWeWant,
1516 $data['globals']['wgHooks']['LoadExtensionSchemaUpdates']
1517 );
1518 }
1519 // Unset everyone else's hooks. Lord knows what someone might be doing
1520 // in ParserFirstCallInit (see T29171)
1521 $GLOBALS['wgHooks'] = [ 'LoadExtensionSchemaUpdates' => $hooksWeWant ];
1522
1523 return Status::newGood();
1524 }
1525
1538 protected function getInstallSteps( DatabaseInstaller $installer ) {
1539 $coreInstallSteps = [
1540 [ 'name' => 'database', 'callback' => [ $installer, 'setupDatabase' ] ],
1541 [ 'name' => 'tables', 'callback' => [ $installer, 'createTables' ] ],
1542 [ 'name' => 'interwiki', 'callback' => [ $installer, 'populateInterwikiTable' ] ],
1543 [ 'name' => 'stats', 'callback' => [ $this, 'populateSiteStats' ] ],
1544 [ 'name' => 'keys', 'callback' => [ $this, 'generateKeys' ] ],
1545 [ 'name' => 'updates', 'callback' => [ $installer, 'insertUpdateKeys' ] ],
1546 [ 'name' => 'sysop', 'callback' => [ $this, 'createSysop' ] ],
1547 [ 'name' => 'mainpage', 'callback' => [ $this, 'createMainpage' ] ],
1548 ];
1549
1550 // Build the array of install steps starting from the core install list,
1551 // then adding any callbacks that wanted to attach after a given step
1552 foreach ( $coreInstallSteps as $step ) {
1553 $this->installSteps[] = $step;
1554 if ( isset( $this->extraInstallSteps[$step['name']] ) ) {
1555 $this->installSteps = array_merge(
1556 $this->installSteps,
1557 $this->extraInstallSteps[$step['name']]
1558 );
1559 }
1560 }
1561
1562 // Prepend any steps that want to be at the beginning
1563 if ( isset( $this->extraInstallSteps['BEGINNING'] ) ) {
1564 $this->installSteps = array_merge(
1565 $this->extraInstallSteps['BEGINNING'],
1566 $this->installSteps
1567 );
1568 }
1569
1570 // Extensions should always go first, chance to tie into hooks and such
1571 if ( count( $this->getVar( '_Extensions' ) ) ) {
1572 array_unshift( $this->installSteps,
1573 [ 'name' => 'extensions', 'callback' => [ $this, 'includeExtensions' ] ]
1574 );
1575 $this->installSteps[] = [
1576 'name' => 'extension-tables',
1577 'callback' => [ $installer, 'createExtensionTables' ]
1578 ];
1579 }
1580
1581 return $this->installSteps;
1582 }
1583
1592 public function performInstallation( $startCB, $endCB ) {
1593 $installResults = [];
1594 $installer = $this->getDBInstaller();
1595 $installer->preInstall();
1596 $steps = $this->getInstallSteps( $installer );
1597 foreach ( $steps as $stepObj ) {
1598 $name = $stepObj['name'];
1599 call_user_func_array( $startCB, [ $name ] );
1600
1601 // Perform the callback step
1602 $status = call_user_func( $stepObj['callback'], $installer );
1603
1604 // Output and save the results
1605 call_user_func( $endCB, $name, $status );
1606 $installResults[$name] = $status;
1607
1608 // If we've hit some sort of fatal, we need to bail.
1609 // Callback already had a chance to do output above.
1610 if ( !$status->isOk() ) {
1611 break;
1612 }
1613 }
1614 if ( $status->isOk() ) {
1615 $this->showMessage(
1616 'config-install-success',
1617 $this->getVar( 'wgServer' ),
1618 $this->getVar( 'wgScriptPath' )
1619 );
1620 $this->setVar( '_InstallDone', true );
1621 }
1622
1623 return $installResults;
1624 }
1625
1631 public function generateKeys() {
1632 $keys = [ 'wgSecretKey' => 64 ];
1633 if ( strval( $this->getVar( 'wgUpgradeKey' ) ) === '' ) {
1634 $keys['wgUpgradeKey'] = 16;
1635 }
1636
1637 return $this->doGenerateKeys( $keys );
1638 }
1639
1647 protected function doGenerateKeys( $keys ) {
1648 $status = Status::newGood();
1649
1650 foreach ( $keys as $name => $length ) {
1651 $secretKey = MWCryptRand::generateHex( $length );
1652 $this->setVar( $name, $secretKey );
1653 }
1654
1655 return $status;
1656 }
1657
1663 protected function createSysop() {
1664 $name = $this->getVar( '_AdminName' );
1666
1667 if ( !$user ) {
1668 // We should've validated this earlier anyway!
1669 return Status::newFatal( 'config-admin-error-user', $name );
1670 }
1671
1672 if ( $user->idForName() == 0 ) {
1673 $user->addToDatabase();
1674
1675 try {
1676 $user->setPassword( $this->getVar( '_AdminPassword' ) );
1677 } catch ( PasswordError $pwe ) {
1678 return Status::newFatal( 'config-admin-error-password', $name, $pwe->getMessage() );
1679 }
1680
1681 $user->addGroup( 'sysop' );
1682 $user->addGroup( 'bureaucrat' );
1683 $user->addGroup( 'interface-admin' );
1684 if ( $this->getVar( '_AdminEmail' ) ) {
1685 $user->setEmail( $this->getVar( '_AdminEmail' ) );
1686 }
1687 $user->saveSettings();
1688
1689 // Update user count
1690 $ssUpdate = SiteStatsUpdate::factory( [ 'users' => 1 ] );
1691 $ssUpdate->doUpdate();
1692 }
1693 $status = Status::newGood();
1694
1695 if ( $this->getVar( '_Subscribe' ) && $this->getVar( '_AdminEmail' ) ) {
1697 }
1698
1699 return $status;
1700 }
1701
1706 $params = [
1707 'email' => $this->getVar( '_AdminEmail' ),
1708 'language' => 'en',
1709 'digest' => 0
1710 ];
1711
1712 // Mailman doesn't support as many languages as we do, so check to make
1713 // sure their selected language is available
1714 $myLang = $this->getVar( '_UserLang' );
1715 if ( in_array( $myLang, $this->mediaWikiAnnounceLanguages ) ) {
1716 $myLang = $myLang == 'pt-br' ? 'pt_BR' : $myLang; // rewrite to Mailman's pt_BR
1717 $params['language'] = $myLang;
1718 }
1719
1720 if ( MWHttpRequest::canMakeRequests() ) {
1721 $res = MWHttpRequest::factory( $this->mediaWikiAnnounceUrl,
1722 [ 'method' => 'POST', 'postData' => $params ], __METHOD__ )->execute();
1723 if ( !$res->isOK() ) {
1724 $s->warning( 'config-install-subscribe-fail', $res->getMessage() );
1725 }
1726 } else {
1727 $s->warning( 'config-install-subscribe-notpossible' );
1728 }
1729 }
1730
1737 protected function createMainpage( DatabaseInstaller $installer ) {
1738 $status = Status::newGood();
1739 $title = Title::newMainPage();
1740 if ( $title->exists() ) {
1741 $status->warning( 'config-install-mainpage-exists' );
1742 return $status;
1743 }
1744 try {
1745 $page = WikiPage::factory( $title );
1747 wfMessage( 'mainpagetext' )->inContentLanguage()->text() . "\n\n" .
1748 wfMessage( 'mainpagedocfooter' )->inContentLanguage()->text()
1749 );
1750
1751 $status = $page->doEditContent( $content,
1752 '',
1753 EDIT_NEW,
1754 false,
1755 User::newFromName( 'MediaWiki default' )
1756 );
1757 } catch ( Exception $e ) {
1758 // using raw, because $wgShowExceptionDetails can not be set yet
1759 $status->fatal( 'config-install-mainpage-failed', $e->getMessage() );
1760 }
1761
1762 return $status;
1763 }
1764
1768 public static function overrideConfig() {
1769 // Use PHP's built-in session handling, since MediaWiki's
1770 // SessionHandler can't work before we have an object cache set up.
1771 define( 'MW_NO_SESSION_HANDLER', 1 );
1772
1773 // Don't access the database
1774 $GLOBALS['wgUseDatabaseMessages'] = false;
1775 // Don't cache langconv tables
1776 $GLOBALS['wgLanguageConverterCacheType'] = CACHE_NONE;
1777 // Debug-friendly
1778 $GLOBALS['wgShowExceptionDetails'] = true;
1779 $GLOBALS['wgShowHostnames'] = true;
1780 // Don't break forms
1781 $GLOBALS['wgExternalLinkTarget'] = '_blank';
1782
1783 // Allow multiple ob_flush() calls
1784 $GLOBALS['wgDisableOutputCompression'] = true;
1785
1786 // Use a sensible cookie prefix (not my_wiki)
1787 $GLOBALS['wgCookiePrefix'] = 'mw_installer';
1788
1789 // Some of the environment checks make shell requests, remove limits
1790 $GLOBALS['wgMaxShellMemory'] = 0;
1791
1792 // Override the default CookieSessionProvider with a dummy
1793 // implementation that won't stomp on PHP's cookies.
1794 $GLOBALS['wgSessionProviders'] = [
1795 [
1796 'class' => InstallerSessionProvider::class,
1797 'args' => [ [
1798 'priority' => 1,
1799 ] ]
1800 ]
1801 ];
1802
1803 // Don't try to use any object cache for SessionManager either.
1804 $GLOBALS['wgSessionCacheType'] = CACHE_NONE;
1805 }
1806
1814 public function addInstallStep( $callback, $findStep = 'BEGINNING' ) {
1815 $this->extraInstallSteps[$findStep][] = $callback;
1816 }
1817
1822 protected function disableTimeLimit() {
1823 Wikimedia\suppressWarnings();
1824 set_time_limit( 0 );
1825 Wikimedia\restoreWarnings();
1826 }
1827}
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
$GLOBALS['IP']
$wgObjectCaches
Advanced object cache configuration.
$wgStyleDirectory
Filesystem stylesheets directory.
$wgAutoloadClasses
Array mapping class names to filenames, for autoloading.
$wgExtensionDirectory
Filesystem extensions directory.
$wgExternalLinkTarget
Set a default target for external links, e.g.
wfIsWindows()
Check if the operating system is Windows.
wfShorthandToInteger( $string='', $default=-1)
Converts shorthand byte notation to integer form.
wfIsHHVM()
Check if we are running under HHVM.
if(defined( 'MW_SETUP_CALLBACK')) $fname
Customization point after all loading (constants, functions, classes, DefaultSettings,...
Definition Setup.php:121
$wgParser
Definition Setup.php:921
$wgLang
Definition Setup.php:910
$IP
Definition WebStart.php:41
$line
Definition cdb.php:59
Base class for DBMS-specific installation helper classes.
getConnection()
Connect to the database using the administrative user/password currently defined in the session.
Copyright (C) 2018 Kunal Mehta legoktm@member.fsf.org
ExtensionRegistry class.
Accesses configuration settings from $GLOBALS.
A Config instance which stores all settings as a member variable.
static get( $url, $options=[], $caller=__METHOD__)
Simple wrapper for Http::request( 'GET' )
Definition Http.php:98
Base installer class.
Definition Installer.php:46
envPrepServer()
Environment prep for the server hostname.
parse( $text, $lineStart=false)
Convert wikitext $text to HTML.
array $compiledDBs
List of detected DBs, access using getCompiledDBs().
Definition Installer.php:66
getExtensionInfo( $type, $parentRelPath, $name)
Title $parserTitle
Cached Title, used by parse().
Definition Installer.php:87
includeExtensions()
Installs the auto-detected extensions.
createMainpage(DatabaseInstaller $installer)
Insert Main Page with default content.
const MINIMUM_PCRE_VERSION
The oldest version of PCRE we can support.
Definition Installer.php:54
getDefaultSkin(array $skinNames)
Returns a default value to be used for $wgDefaultSkin: normally the one set in DefaultSettings,...
envCheckLibicu()
Check the libicu version.
getDBInstaller( $type=false)
Get an instance of DatabaseInstaller for the specified DB type.
envCheckDB()
Environment check for DB types.
envCheckSuhosinMaxValueLength()
Checks if suhosin.get.max_value_length is set, and if so generate a warning because it decreases Reso...
setVar( $name, $value)
Set a MW configuration variable, or internal installer configuration variable.
array $internalDefaults
Variables that are stored alongside globals, and are used for any configuration of the installation p...
envCheckModSecurity()
Scare user to death if they have mod_security or mod_security2.
getFakePassword( $realPassword)
Get a fake password for sending back to the user in HTML.
envCheckServer()
Environment check to inform user which server we've assumed.
disableTimeLimit()
Disable the time limit for execution.
$mediaWikiAnnounceUrl
URL to mediawiki-announce subscription.
static apacheModulePresent( $moduleName)
Checks for presence of an Apache module.
array $rightsProfiles
User rights profiles.
addInstallStep( $callback, $findStep='BEGINNING')
Add an installation step following the given step.
getParserOptions()
getCompiledDBs()
Get a list of DBs supported by current PHP setup.
envCheckBrokenXML()
Some versions of libxml+PHP break < and > encoding horribly.
array $installSteps
The actual list of installation steps.
ParserOptions $parserOptions
Cached ParserOptions, used by parse().
Definition Installer.php:94
dirIsExecutable( $dir, $url)
Checks if scripts located in the given directory can be executed via the given URL.
doEnvironmentPreps()
envCheckGit()
Search for git.
getDocUrl( $page)
Overridden by WebInstaller to provide lastPage parameters.
array $defaultVarNames
MediaWiki configuration globals that will eventually be passed through to LocalSettings....
showMessage( $msg)
UI interface for displaying a short message The parameters are like parameters to wfMessage().
static getExistingLocalSettings()
Determine if LocalSettings.php exists.
showError( $msg)
Same as showMessage(), but for displaying errors.
static getInstallerConfig(Config $baseConfig)
Constructs a Config object that contains configuration settings that should be overwritten for the in...
array $settings
Definition Installer.php:59
envCheckMemory()
Environment check for available memory.
array $objectCaches
Known object cache types and the functions used to test for their existence.
array $licenses
License types.
static maybeGetWebserverPrimaryGroup()
On POSIX systems return the primary group of the webserver we're running under.
doEnvironmentChecks()
Do initial checks of the PHP environment.
disableLinkPopups()
performInstallation( $startCB, $endCB)
Actually perform the installation.
envCheck64Bit()
Checks if we're running on 64 bit or not.
generateKeys()
Generate $wgSecretKey.
populateSiteStats(DatabaseInstaller $installer)
Install step which adds a row to the site_stats table with appropriate initial values.
subscribeToMediaWikiAnnounce(Status $s)
envCheckCache()
Environment check for compiled object cache types.
__construct()
Constructor, always call this from child classes.
int $minMemorySize
Minimum memory size in MB.
Definition Installer.php:80
findExtensionsByType( $type='extension', $directory='extensions')
Find extensions or skins, and return an array containing the value for 'Name' for each found extensio...
doGenerateKeys( $keys)
Generate a secret value for variables using our CryptRand generator.
showStatusMessage(Status $status)
Show a message to the installing user by using a Status object.
readExtension( $fullJsonFile, $extDeps=[], $skinDeps=[])
envCheckPath()
Environment check to inform user which paths we've assumed.
array $envPreps
A list of environment preparation methods called by doEnvironmentPreps().
$mediaWikiAnnounceLanguages
Supported language codes for Mailman.
setPassword( $name, $value)
Set a variable which stores a password, except if the new value is a fake password in which case leav...
envPrepPath()
Environment prep for setting $IP and $wgScriptPath.
static getDBTypes()
Get a list of known DB types.
createSysop()
Create the first user account, grant it sysop, bureaucrat and interface-admin rights.
envCheckPCRE()
Environment check for the PCRE module.
getVar( $name, $default=null)
Get an MW configuration variable, or internal installer configuration variable.
static getDBInstallerClass( $type)
Get the DatabaseInstaller class name for this type.
static overrideConfig()
Override the necessary bits of the config to run an installation.
restoreLinkPopups()
array $extraInstallSteps
Extra steps for installation, for things like DatabaseInstallers to modify.
static array $dbTypes
Known database types.
envCheckDiff3()
Search for GNU diff3.
envCheckShellLocale()
Environment check for preferred locale in shell.
envGetDefaultServer()
Helper function to be called from envPrepServer()
getInstallSteps(DatabaseInstaller $installer)
Get an array of install steps.
array $dbInstallers
Cached DB installer instances, access using getDBInstaller().
Definition Installer.php:73
array $envChecks
A list of environment check methods called by doEnvironmentChecks().
envCheckGraphics()
Environment check for ImageMagick and GD.
envCheckUploadsDirectory()
Environment check for the permissions of the uploads directory.
setParserLanguage( $lang)
ParserOptions are constructed before we determined the language, so fix it.
findExtensions( $directory='extensions')
Find extensions or skins in a subdirectory of $IP.
static generateHex( $chars)
Generate a run of cryptographically random data and return it in hexadecimal string format.
An interwiki lookup that has no data, intended for use in the installer.
MediaWikiServices is the service locator for the application scope of MediaWiki.
Executes shell commands.
Definition Shell.php:44
Provides a fallback sequence for Config objects.
Set options of the Parser.
Show an error when any operation involving passwords fails to run.
Test for PHP+libxml2 bug which breaks XML input subtly with certain versions.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Definition Status.php:40
Represents a title within MediaWiki.
Definition Title.php:39
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition User.php:592
static newFromId( $id)
Static factory method for creation from a given user ID.
Definition User.php:615
Content object for wiki text pages.
$res
Definition database.txt:21
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
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
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest to get request data $wgMemc
Definition globals.txt:64
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration settings
Definition globals.txt:37
const CACHE_NONE
Definition Defines.php:102
const CACHE_ANYTHING
Definition Defines.php:101
const CACHE_MEMCACHED
Definition Defines.php:104
const CACHE_DB
Definition Defines.php:103
const EDIT_NEW
Definition Defines.php:152
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 since 1.16! 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 since 1.28! 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:2042
Status::newGood()` to allow deletion, and then `return false` from the hook function. Ensure you consume the 'ChangeTagAfterDelete' hook to carry out custom deletion actions. $tag:name of the tag $user:user initiating the action & $status:Status object. See above. 'ChangeTagsListActive':Allows you to nominate which of the tags your extension uses are in active use. & $tags:list of all active tags. Append to this array. 'ChangeTagsAfterUpdateTags':Called after tags have been updated with the ChangeTags::updateTags function. Params:$addedTags:tags effectively added in the update $removedTags:tags effectively removed in the update $prevTags:tags that were present prior to the update $rc_id:recentchanges table id $rev_id:revision table id $log_id:logging table id $params:tag params $rc:RecentChange being tagged when the tagging accompanies the action, or null $user:User who performed the tagging when the tagging is subsequent to the action, or null 'ChangeTagsAllowedAdd':Called when checking if a user can add tags to a change. & $allowedTags:List of all the tags the user is allowed to add. Any tags the user wants to add( $addTags) that are not in this array will cause it to fail. You may add or remove tags to this array as required. $addTags:List of tags user intends to add. $user:User who is adding the tags. 'ChangeUserGroups':Called before user groups are changed. $performer:The User who will perform the change $user:The User whose groups will be changed & $add:The groups that will be added & $remove:The groups that will be removed 'Collation::factory':Called if $wgCategoryCollation is an unknown collation. $collationName:Name of the collation in question & $collationObject:Null. Replace with a subclass of the Collation class that implements the collation given in $collationName. 'ConfirmEmailComplete':Called after a user 's email has been confirmed successfully. $user:user(object) whose email is being confirmed 'ContentAlterParserOutput':Modify parser output for a given content object. Called by Content::getParserOutput after parsing has finished. Can be used for changes that depend on the result of the parsing but have to be done before LinksUpdate is called(such as adding tracking categories based on the rendered HTML). $content:The Content to render $title:Title of the page, as context $parserOutput:ParserOutput to manipulate 'ContentGetParserOutput':Customize parser output for a given content object, called by AbstractContent::getParserOutput. May be used to override the normal model-specific rendering of page content. $content:The Content to render $title:Title of the page, as context $revId:The revision ID, as context $options:ParserOptions for rendering. To avoid confusing the parser cache, the output can only depend on parameters provided to this hook function, not on global state. $generateHtml:boolean, indicating whether full HTML should be generated. If false, generation of HTML may be skipped, but other information should still be present in the ParserOutput object. & $output:ParserOutput, to manipulate or replace 'ContentHandlerDefaultModelFor':Called when the default content model is determined for a given title. May be used to assign a different model for that title. $title:the Title in question & $model:the model name. Use with CONTENT_MODEL_XXX constants. 'ContentHandlerForModelID':Called when a ContentHandler is requested for a given content model name, but no entry for that model exists in $wgContentHandlers. Note:if your extension implements additional models via this hook, please use GetContentModels hook to make them known to core. $modeName:the requested content model name & $handler:set this to a ContentHandler object, if desired. 'ContentModelCanBeUsedOn':Called to determine whether that content model can be used on a given page. This is especially useful to prevent some content models to be used in some special location. $contentModel:ID of the content model in question $title:the Title in question. & $ok:Output parameter, 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. 'ContribsPager::getQueryInfo':Before the contributions query is about to run & $pager:Pager object for contributions & $queryInfo:The query for the contribs Pager 'ContribsPager::reallyDoQuery':Called before really executing the query for My Contributions & $data:an array of results of all contribs queries $pager:The ContribsPager object hooked into $offset:Index offset, inclusive $limit:Exact query limit $descending:Query direction, false for ascending, true for descending 'ContributionsLineEnding':Called before a contributions HTML line is finished $page:SpecialPage object for contributions & $ret:the HTML line $row:the DB row for this line & $classes:the classes to add to the surrounding< li > & $attribs:associative array of other HTML attributes for the< li > element. Currently only data attributes reserved to MediaWiki are allowed(see Sanitizer::isReservedDataAttribute). 'ContributionsToolLinks':Change tool links above Special:Contributions $id:User identifier $title:User page title & $tools:Array of tool links $specialPage:SpecialPage instance for context and services. Can be either SpecialContributions or DeletedContributionsPage. Extensions should type hint against a generic SpecialPage though. 'ConvertContent':Called by AbstractContent::convert when a conversion to another content model is requested. Handler functions that modify $result should generally return false to disable further attempts at conversion. $content:The Content object to be converted. $toModel:The ID of the content model to convert to. $lossy:boolean indicating whether lossy conversion is allowed. & $result:Output parameter, in case the handler function wants to provide a converted Content object. Note that $result->getContentModel() must return $toModel. 'ContentSecurityPolicyDefaultSource':Modify the allowed CSP load sources. This affects all directives except for the script directive. If you want to add a script source, see ContentSecurityPolicyScriptSource hook. & $defaultSrc:Array of Content-Security-Policy allowed sources $policyConfig:Current configuration for the Content-Security-Policy header $mode:ContentSecurityPolicy::REPORT_ONLY_MODE or ContentSecurityPolicy::FULL_MODE depending on type of header 'ContentSecurityPolicyDirectives':Modify the content security policy directives. Use this only if ContentSecurityPolicyDefaultSource and ContentSecurityPolicyScriptSource do not meet your needs. & $directives:Array of CSP directives $policyConfig:Current configuration for the CSP header $mode:ContentSecurityPolicy::REPORT_ONLY_MODE or ContentSecurityPolicy::FULL_MODE depending on type of header 'ContentSecurityPolicyScriptSource':Modify the allowed CSP script sources. Note that you also have to use ContentSecurityPolicyDefaultSource if you want non-script sources to be loaded from whatever you add. & $scriptSrc:Array of CSP directives $policyConfig:Current configuration for the CSP header $mode:ContentSecurityPolicy::REPORT_ONLY_MODE or ContentSecurityPolicy::FULL_MODE depending on type of header 'CustomEditor':When invoking the page editor Return true to allow the normal editor to be used, or false if implementing a custom editor, e.g. for a special namespace, etc. $article:Article being edited $user:User performing the edit 'DatabaseOraclePostInit':Called after initialising an Oracle database $db:the DatabaseOracle object 'DeletedContribsPager::reallyDoQuery':Called before really executing the query for Special:DeletedContributions Similar to ContribsPager::reallyDoQuery & $data:an array of results of all contribs queries $pager:The DeletedContribsPager object hooked into $offset:Index offset, inclusive $limit:Exact query limit $descending:Query direction, false for ascending, true for descending 'DeletedContributionsLineEnding':Called before a DeletedContributions HTML line is finished. Similar to ContributionsLineEnding $page:SpecialPage object for DeletedContributions & $ret:the HTML line $row:the DB row for this line & $classes:the classes to add to the surrounding< li > & $attribs:associative array of other HTML attributes for the< li > element. Currently only data attributes reserved to MediaWiki are allowed(see Sanitizer::isReservedDataAttribute). 'DeleteUnknownPreferences':Called by the cleanupPreferences.php maintenance script to build a WHERE clause with which to delete preferences that are not known about. This hook is used by extensions that have dynamically-named preferences that should not be deleted in the usual cleanup process. For example, the Gadgets extension creates preferences prefixed with 'gadget-', and so anything with that prefix is excluded from the deletion. &where:An array that will be passed as the $cond parameter to IDatabase::select() to determine what will be deleted from the user_properties table. $db:The IDatabase object, useful for accessing $db->buildLike() etc. 'DifferenceEngineAfterLoadNewText':called in DifferenceEngine::loadNewText() after the new revision 's content has been loaded into the class member variable $differenceEngine->mNewContent but before returning true from this function. $differenceEngine:DifferenceEngine object 'DifferenceEngineLoadTextAfterNewContentIsLoaded':called in DifferenceEngine::loadText() after the new revision 's content has been loaded into the class member variable $differenceEngine->mNewContent but before checking if the variable 's value is null. This hook can be used to inject content into said class member variable. $differenceEngine:DifferenceEngine object 'DifferenceEngineMarkPatrolledLink':Allows extensions to change the "mark as patrolled" link which is shown both on the diff header as well as on the bottom of a page, usually wrapped in a span element which has class="patrollink". $differenceEngine:DifferenceEngine object & $markAsPatrolledLink:The "mark as patrolled" link HTML(string) $rcid:Recent change ID(rc_id) for this change(int) 'DifferenceEngineMarkPatrolledRCID':Allows extensions to possibly change the rcid parameter. For example the rcid might be set to zero due to the user being the same as the performer of the change but an extension might still want to show it under certain conditions. & $rcid:rc_id(int) of the change or 0 $differenceEngine:DifferenceEngine object $change:RecentChange object $user:User object representing the current user 'DifferenceEngineNewHeader':Allows extensions to change the $newHeader variable, which contains information about the new revision, such as the revision 's author, whether the revision was marked as a minor edit or not, etc. $differenceEngine:DifferenceEngine object & $newHeader:The string containing the various #mw-diff-otitle[1-5] divs, which include things like revision author info, revision comment, RevisionDelete link and more $formattedRevisionTools:Array containing revision tools, some of which may have been injected with the DiffRevisionTools hook $nextlink:String containing the link to the next revision(if any) $status
Definition hooks.txt:1305
namespace and then decline to actually register it file or subcat img or subcat $title
Definition hooks.txt:994
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:2054
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 use $formDescriptor instead 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;div ...>$1&lt;/div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
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 $out
Definition hooks.txt:894
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
Definition hooks.txt:2062
$wgHooks['ArticleShow'][]
Definition hooks.txt:108
Allows to change the fields on the form that will be generated $name
Definition hooks.txt:302
processing should stop and the error should be shown to the user * false
Definition hooks.txt:187
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 local account $user
Definition hooks.txt:247
returning false will NOT prevent logging $e
Definition hooks.txt:2226
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
Interface for configuration instances.
Definition Config.php:28
get( $name)
Get a configuration variable such as "Sitename" or "UploadMaintenance.".
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
$source
A helper class for throttling authentication attempts.
$content
$lines
Definition router.php:61
if(!is_readable( $file)) $ext
Definition router.php:55
$params
if(!isset( $args[0])) $lang