MediaWiki  1.23.2
Installer.php
Go to the documentation of this file.
1 <?php
39 abstract class Installer {
40 
41  // This is the absolute minimum PHP version we can support
42  const MINIMUM_PHP_VERSION = '5.3.2';
43 
50  const MINIMUM_PCRE_VERSION = '7.2';
51 
55  protected $settings;
56 
62  protected $compiledDBs;
63 
69  protected $dbInstallers = array();
70 
76  protected $minMemorySize = 50;
77 
83  protected $parserTitle;
84 
90  protected $parserOptions;
91 
101  protected static $dbTypes = array(
102  'mysql',
103  'postgres',
104  'oracle',
105  'mssql',
106  'sqlite',
107  );
108 
116  protected $envChecks = array(
117  'envCheckDB',
118  'envCheckRegisterGlobals',
119  'envCheckBrokenXML',
120  'envCheckMagicQuotes',
121  'envCheckMagicSybase',
122  'envCheckMbstring',
123  'envCheckSafeMode',
124  'envCheckXML',
125  'envCheckPCRE',
126  'envCheckMemory',
127  'envCheckCache',
128  'envCheckModSecurity',
129  'envCheckDiff3',
130  'envCheckGraphics',
131  'envCheckGit',
132  'envCheckServer',
133  'envCheckPath',
134  'envCheckExtension',
135  'envCheckShellLocale',
136  'envCheckUploadsDirectory',
137  'envCheckLibicu',
138  'envCheckSuhosinMaxValueLength',
139  'envCheckCtype',
140  'envCheckJSON',
141  );
142 
150  protected $defaultVarNames = array(
151  'wgSitename',
152  'wgPasswordSender',
153  'wgLanguageCode',
154  'wgRightsIcon',
155  'wgRightsText',
156  'wgRightsUrl',
157  'wgMainCacheType',
158  'wgEnableEmail',
159  'wgEnableUserEmail',
160  'wgEnotifUserTalk',
161  'wgEnotifWatchlist',
162  'wgEmailAuthentication',
163  'wgDBtype',
164  'wgDiff3',
165  'wgImageMagickConvertCommand',
166  'wgGitBin',
167  'IP',
168  'wgScriptPath',
169  'wgScriptExtension',
170  'wgMetaNamespace',
171  'wgDeletedDirectory',
172  'wgEnableUploads',
173  'wgShellLocale',
174  'wgSecretKey',
175  'wgUseInstantCommons',
176  'wgUpgradeKey',
177  'wgDefaultSkin',
178  'wgResourceLoaderMaxQueryLength',
179  );
180 
188  protected $internalDefaults = array(
189  '_UserLang' => 'en',
190  '_Environment' => false,
191  '_SafeMode' => false,
192  '_RaiseMemory' => false,
193  '_UpgradeDone' => false,
194  '_InstallDone' => false,
195  '_Caches' => array(),
196  '_InstallPassword' => '',
197  '_SameAccount' => true,
198  '_CreateDBAccount' => false,
199  '_NamespaceType' => 'site-name',
200  '_AdminName' => '', // will be set later, when the user selects language
201  '_AdminPassword' => '',
202  '_AdminPassword2' => '',
203  '_AdminEmail' => '',
204  '_Subscribe' => false,
205  '_SkipOptional' => 'continue',
206  '_RightsProfile' => 'wiki',
207  '_LicenseCode' => 'none',
208  '_CCDone' => false,
209  '_Extensions' => array(),
210  '_MemCachedServers' => '',
211  '_UpgradeKeySupplied' => false,
212  '_ExistingDBSettings' => false,
213 
214  // $wgLogo is probably wrong (bug 48084); set something that will work.
215  // Single quotes work fine here, as LocalSettingsGenerator outputs this unescaped.
216  'wgLogo' => '$wgStylePath/common/images/wiki.png',
217  );
218 
224  private $installSteps = array();
225 
231  protected $extraInstallSteps = array();
232 
238  protected $objectCaches = array(
239  'xcache' => 'xcache_get',
240  'apc' => 'apc_fetch',
241  'wincache' => 'wincache_ucache_get'
242  );
243 
249  public $rightsProfiles = array(
250  'wiki' => array(),
251  'no-anon' => array(
252  '*' => array( 'edit' => false )
253  ),
254  'fishbowl' => array(
255  '*' => array(
256  'createaccount' => false,
257  'edit' => false,
258  ),
259  ),
260  'private' => array(
261  '*' => array(
262  'createaccount' => false,
263  'edit' => false,
264  'read' => false,
265  ),
266  ),
267  );
268 
274  public $licenses = array(
275  'cc-by' => array(
276  'url' => 'http://creativecommons.org/licenses/by/3.0/',
277  'icon' => '{$wgStylePath}/common/images/cc-by.png',
278  ),
279  'cc-by-sa' => array(
280  'url' => 'http://creativecommons.org/licenses/by-sa/3.0/',
281  'icon' => '{$wgStylePath}/common/images/cc-by-sa.png',
282  ),
283  'cc-by-nc-sa' => array(
284  'url' => 'http://creativecommons.org/licenses/by-nc-sa/3.0/',
285  'icon' => '{$wgStylePath}/common/images/cc-by-nc-sa.png',
286  ),
287  'cc-0' => array(
288  'url' => 'https://creativecommons.org/publicdomain/zero/1.0/',
289  'icon' => '{$wgStylePath}/common/images/cc-0.png',
290  ),
291  'pd' => array(
292  'url' => '',
293  'icon' => '{$wgStylePath}/common/images/public-domain.png',
294  ),
295  'gfdl' => array(
296  'url' => 'http://www.gnu.org/copyleft/fdl.html',
297  'icon' => '{$wgStylePath}/common/images/gnu-fdl.png',
298  ),
299  'none' => array(
300  'url' => '',
301  'icon' => '',
302  'text' => ''
303  ),
304  'cc-choose' => array(
305  // Details will be filled in by the selector.
306  'url' => '',
307  'icon' => '',
308  'text' => '',
309  ),
310  );
311 
315  protected $mediaWikiAnnounceUrl =
316  'https://lists.wikimedia.org/mailman/subscribe/mediawiki-announce';
317 
322  'ca', 'cs', 'da', 'de', 'en', 'es', 'et', 'eu', 'fi', 'fr', 'hr', 'hu',
323  'it', 'ja', 'ko', 'lt', 'nl', 'no', 'pl', 'pt', 'pt-br', 'ro', 'ru',
324  'sl', 'sr', 'sv', 'tr', 'uk'
325  );
326 
334  abstract public function showMessage( $msg /*, ... */ );
335 
340  abstract public function showError( $msg /*, ... */ );
341 
346  abstract public function showStatusMessage( Status $status );
347 
351  public function __construct() {
352  global $wgMessagesDirs, $wgUser;
353 
354  // Disable the i18n cache and LoadBalancer
355  Language::getLocalisationCache()->disableBackend();
357 
358  // Load the installer's i18n.
359  $wgMessagesDirs['MediawikiInstaller'] = __DIR__ . '/i18n';
360 
361  // Having a user with id = 0 safeguards us from DB access via User::loadOptions().
362  $wgUser = User::newFromId( 0 );
363 
365 
366  foreach ( $this->defaultVarNames as $var ) {
367  $this->settings[$var] = $GLOBALS[$var];
368  }
369 
370  $compiledDBs = array();
371  foreach ( self::getDBTypes() as $type ) {
372  $installer = $this->getDBInstaller( $type );
373 
374  if ( !$installer->isCompiled() ) {
375  continue;
376  }
377  $compiledDBs[] = $type;
378 
379  $defaults = $installer->getGlobalDefaults();
380 
381  foreach ( $installer->getGlobalNames() as $var ) {
382  if ( isset( $defaults[$var] ) ) {
383  $this->settings[$var] = $defaults[$var];
384  } else {
385  $this->settings[$var] = $GLOBALS[$var];
386  }
387  }
388  }
389  $this->compiledDBs = $compiledDBs;
390 
391  $this->parserTitle = Title::newFromText( 'Installer' );
392  $this->parserOptions = new ParserOptions; // language will be wrong :(
393  $this->parserOptions->setEditSection( false );
394  }
395 
401  public static function getDBTypes() {
402  return self::$dbTypes;
403  }
404 
418  public function doEnvironmentChecks() {
419  $phpVersion = phpversion();
420  if ( version_compare( $phpVersion, self::MINIMUM_PHP_VERSION, '>=' ) ) {
421  $this->showMessage( 'config-env-php', $phpVersion );
422  $good = true;
423  } else {
424  $this->showMessage( 'config-env-php-toolow', $phpVersion, self::MINIMUM_PHP_VERSION );
425  $good = false;
426  }
427 
428  // Must go here because an old version of PCRE can prevent other checks from completing
429  if ( $good ) {
430  list( $pcreVersion ) = explode( ' ', PCRE_VERSION, 2 );
431  if ( version_compare( $pcreVersion, self::MINIMUM_PCRE_VERSION, '<' ) ) {
432  $this->showError( 'config-pcre-old', self::MINIMUM_PCRE_VERSION, $pcreVersion );
433  $good = false;
434  }
435  }
436 
437  if ( $good ) {
438  foreach ( $this->envChecks as $check ) {
439  $status = $this->$check();
440  if ( $status === false ) {
441  $good = false;
442  }
443  }
444  }
445 
446  $this->setVar( '_Environment', $good );
447 
448  return $good ? Status::newGood() : Status::newFatal( 'config-env-bad' );
449  }
450 
457  public function setVar( $name, $value ) {
458  $this->settings[$name] = $value;
459  }
460 
471  public function getVar( $name, $default = null ) {
472  if ( !isset( $this->settings[$name] ) ) {
473  return $default;
474  } else {
475  return $this->settings[$name];
476  }
477  }
478 
484  public function getCompiledDBs() {
485  return $this->compiledDBs;
486  }
487 
495  public function getDBInstaller( $type = false ) {
496  if ( !$type ) {
497  $type = $this->getVar( 'wgDBtype' );
498  }
499 
500  $type = strtolower( $type );
501 
502  if ( !isset( $this->dbInstallers[$type] ) ) {
503  $class = ucfirst( $type ) . 'Installer';
504  $this->dbInstallers[$type] = new $class( $this );
505  }
506 
507  return $this->dbInstallers[$type];
508  }
509 
515  public static function getExistingLocalSettings() {
516  global $IP;
517 
519  $_lsExists = file_exists( "$IP/LocalSettings.php" );
521 
522  if ( !$_lsExists ) {
523  return false;
524  }
525  unset( $_lsExists );
526 
527  require "$IP/includes/DefaultSettings.php";
528  require "$IP/LocalSettings.php";
529 
530  return get_defined_vars();
531  }
532 
542  public function getFakePassword( $realPassword ) {
543  return str_repeat( '*', strlen( $realPassword ) );
544  }
545 
553  public function setPassword( $name, $value ) {
554  if ( !preg_match( '/^\*+$/', $value ) ) {
555  $this->setVar( $name, $value );
556  }
557  }
558 
570  public static function maybeGetWebserverPrimaryGroup() {
571  if ( !function_exists( 'posix_getegid' ) || !function_exists( 'posix_getpwuid' ) ) {
572  # I don't know this, this isn't UNIX.
573  return null;
574  }
575 
576  # posix_getegid() *not* getmygid() because we want the group of the webserver,
577  # not whoever owns the current script.
578  $gid = posix_getegid();
579  $getpwuid = posix_getpwuid( $gid );
580  $group = $getpwuid['name'];
581 
582  return $group;
583  }
584 
601  public function parse( $text, $lineStart = false ) {
603 
604  try {
605  $out = $wgParser->parse( $text, $this->parserTitle, $this->parserOptions, $lineStart );
606  $html = $out->getText();
607  } catch ( DBAccessError $e ) {
608  $html = '<!--DB access attempted during parse--> ' . htmlspecialchars( $text );
609 
610  if ( !empty( $this->debug ) ) {
611  $html .= "<!--\n" . $e->getTraceAsString() . "\n-->";
612  }
613  }
614 
615  return $html;
616  }
617 
621  public function getParserOptions() {
622  return $this->parserOptions;
623  }
624 
625  public function disableLinkPopups() {
626  $this->parserOptions->setExternalLinkTarget( false );
627  }
628 
629  public function restoreLinkPopups() {
630  global $wgExternalLinkTarget;
631  $this->parserOptions->setExternalLinkTarget( $wgExternalLinkTarget );
632  }
633 
642  public function populateSiteStats( DatabaseInstaller $installer ) {
643  $status = $installer->getConnection();
644  if ( !$status->isOK() ) {
645  return $status;
646  }
647  $status->value->insert(
648  'site_stats',
649  array(
650  'ss_row_id' => 1,
651  'ss_total_views' => 0,
652  'ss_total_edits' => 0,
653  'ss_good_articles' => 0,
654  'ss_total_pages' => 0,
655  'ss_users' => 0,
656  'ss_images' => 0
657  ),
658  __METHOD__, 'IGNORE'
659  );
660 
661  return Status::newGood();
662  }
663 
667  public function exportVars() {
668  foreach ( $this->settings as $name => $value ) {
669  if ( substr( $name, 0, 2 ) == 'wg' ) {
670  $GLOBALS[$name] = $value;
671  }
672  }
673  }
674 
679  protected function envCheckDB() {
680  global $wgLang;
681 
682  $allNames = array();
683 
684  // Messages: config-type-mysql, config-type-postgres, config-type-oracle,
685  // config-type-sqlite
686  foreach ( self::getDBTypes() as $name ) {
687  $allNames[] = wfMessage( "config-type-$name" )->text();
688  }
689 
690  $databases = $this->getCompiledDBs();
691 
692  $databases = array_flip( $databases );
693  foreach ( array_keys( $databases ) as $db ) {
694  $installer = $this->getDBInstaller( $db );
695  $status = $installer->checkPrerequisites();
696  if ( !$status->isGood() ) {
697  $this->showStatusMessage( $status );
698  }
699  if ( !$status->isOK() ) {
700  unset( $databases[$db] );
701  }
702  }
703  $databases = array_flip( $databases );
704  if ( !$databases ) {
705  $this->showError( 'config-no-db', $wgLang->commaList( $allNames ) );
706 
707  // @todo FIXME: This only works for the web installer!
708  return false;
709  }
710 
711  return true;
712  }
713 
717  protected function envCheckRegisterGlobals() {
718  if ( wfIniGetBool( 'register_globals' ) ) {
719  $this->showMessage( 'config-register-globals' );
720  }
721  }
722 
727  protected function envCheckBrokenXML() {
729  if ( !$test->ok ) {
730  $this->showError( 'config-brokenlibxml' );
731 
732  return false;
733  }
734 
735  return true;
736  }
737 
742  protected function envCheckMagicQuotes() {
743  if ( wfIniGetBool( "magic_quotes_runtime" ) ) {
744  $this->showError( 'config-magic-quotes-runtime' );
745 
746  return false;
747  }
748 
749  return true;
750  }
751 
756  protected function envCheckMagicSybase() {
757  if ( wfIniGetBool( 'magic_quotes_sybase' ) ) {
758  $this->showError( 'config-magic-quotes-sybase' );
759 
760  return false;
761  }
762 
763  return true;
764  }
765 
770  protected function envCheckMbstring() {
771  if ( wfIniGetBool( 'mbstring.func_overload' ) ) {
772  $this->showError( 'config-mbstring' );
773 
774  return false;
775  }
776 
777  return true;
778  }
779 
784  protected function envCheckSafeMode() {
785  if ( wfIniGetBool( 'safe_mode' ) ) {
786  $this->setVar( '_SafeMode', true );
787  $this->showMessage( 'config-safe-mode' );
788  }
789 
790  return true;
791  }
792 
797  protected function envCheckXML() {
798  if ( !function_exists( "utf8_encode" ) ) {
799  $this->showError( 'config-xml-bad' );
800 
801  return false;
802  }
803 
804  return true;
805  }
806 
815  protected function envCheckPCRE() {
817  $regexd = preg_replace( '/[\x{0430}-\x{04FF}]/iu', '', '-АБВГД-' );
818  // Need to check for \p support too, as PCRE can be compiled
819  // with utf8 support, but not unicode property support.
820  // check that \p{Zs} (space separators) matches
821  // U+3000 (Ideographic space)
822  $regexprop = preg_replace( '/\p{Zs}/u', '', "-\xE3\x80\x80-" );
824  if ( $regexd != '--' || $regexprop != '--' ) {
825  $this->showError( 'config-pcre-no-utf8' );
826 
827  return false;
828  }
829 
830  return true;
831  }
832 
837  protected function envCheckMemory() {
838  $limit = ini_get( 'memory_limit' );
839 
840  if ( !$limit || $limit == -1 ) {
841  return true;
842  }
843 
845 
846  if ( $n < $this->minMemorySize * 1024 * 1024 ) {
847  $newLimit = "{$this->minMemorySize}M";
848 
849  if ( ini_set( "memory_limit", $newLimit ) === false ) {
850  $this->showMessage( 'config-memory-bad', $limit );
851  } else {
852  $this->showMessage( 'config-memory-raised', $limit, $newLimit );
853  $this->setVar( '_RaiseMemory', true );
854  }
855  }
856 
857  return true;
858  }
859 
863  protected function envCheckCache() {
864  $caches = array();
865  foreach ( $this->objectCaches as $name => $function ) {
866  if ( function_exists( $function ) ) {
867  if ( $name == 'xcache' && !wfIniGetBool( 'xcache.var_size' ) ) {
868  continue;
869  }
870  $caches[$name] = true;
871  }
872  }
873 
874  if ( !$caches ) {
875  $this->showMessage( 'config-no-cache' );
876  }
877 
878  $this->setVar( '_Caches', $caches );
879  }
880 
885  protected function envCheckModSecurity() {
886  if ( self::apacheModulePresent( 'mod_security' ) ) {
887  $this->showMessage( 'config-mod-security' );
888  }
889 
890  return true;
891  }
892 
897  protected function envCheckDiff3() {
898  $names = array( "gdiff3", "diff3", "diff3.exe" );
899  $versionInfo = array( '$1 --version 2>&1', 'GNU diffutils' );
900 
901  $diff3 = self::locateExecutableInDefaultPaths( $names, $versionInfo );
902 
903  if ( $diff3 ) {
904  $this->setVar( 'wgDiff3', $diff3 );
905  } else {
906  $this->setVar( 'wgDiff3', false );
907  $this->showMessage( 'config-diff3-bad' );
908  }
909 
910  return true;
911  }
912 
917  protected function envCheckGraphics() {
918  $names = array( wfIsWindows() ? 'convert.exe' : 'convert' );
919  $versionInfo = array( '$1 -version', 'ImageMagick' );
920  $convert = self::locateExecutableInDefaultPaths( $names, $versionInfo );
921 
922  $this->setVar( 'wgImageMagickConvertCommand', '' );
923  if ( $convert ) {
924  $this->setVar( 'wgImageMagickConvertCommand', $convert );
925  $this->showMessage( 'config-imagemagick', $convert );
926 
927  return true;
928  } elseif ( function_exists( 'imagejpeg' ) ) {
929  $this->showMessage( 'config-gd' );
930  } else {
931  $this->showMessage( 'config-no-scaling' );
932  }
933 
934  return true;
935  }
936 
943  protected function envCheckGit() {
944  $names = array( wfIsWindows() ? 'git.exe' : 'git' );
945  $versionInfo = array( '$1 --version', 'git version' );
946 
947  $git = self::locateExecutableInDefaultPaths( $names, $versionInfo );
948 
949  if ( $git ) {
950  $this->setVar( 'wgGitBin', $git );
951  $this->showMessage( 'config-git', $git );
952  } else {
953  $this->setVar( 'wgGitBin', false );
954  $this->showMessage( 'config-git-bad' );
955  }
956 
957  return true;
958  }
959 
963  protected function envCheckServer() {
964  $server = $this->envGetDefaultServer();
965  if ( $server !== null ) {
966  $this->showMessage( 'config-using-server', $server );
967  $this->setVar( 'wgServer', $server );
968  }
969 
970  return true;
971  }
972 
977  abstract protected function envGetDefaultServer();
978 
983  protected function envCheckPath() {
984  global $IP;
985  $IP = dirname( dirname( __DIR__ ) );
986  $this->setVar( 'IP', $IP );
987 
988  $this->showMessage(
989  'config-using-uri',
990  $this->getVar( 'wgServer' ),
991  $this->getVar( 'wgScriptPath' )
992  );
993 
994  return true;
995  }
996 
1001  protected function envCheckExtension() {
1002  // @todo FIXME: Detect this properly
1003  if ( defined( 'MW_INSTALL_PHP5_EXT' ) ) {
1004  $ext = 'php5';
1005  } else {
1006  $ext = 'php';
1007  }
1008  $this->setVar( 'wgScriptExtension', ".$ext" );
1009 
1010  return true;
1011  }
1012 
1017  protected function envCheckShellLocale() {
1018  $os = php_uname( 's' );
1019  $supported = array( 'Linux', 'SunOS', 'HP-UX', 'Darwin' ); # Tested these
1020 
1021  if ( !in_array( $os, $supported ) ) {
1022  return true;
1023  }
1024 
1025  # Get a list of available locales.
1026  $ret = false;
1027  $lines = wfShellExec( '/usr/bin/locale -a', $ret );
1028 
1029  if ( $ret ) {
1030  return true;
1031  }
1032 
1033  $lines = array_map( 'trim', explode( "\n", $lines ) );
1034  $candidatesByLocale = array();
1035  $candidatesByLang = array();
1036 
1037  foreach ( $lines as $line ) {
1038  if ( $line === '' ) {
1039  continue;
1040  }
1041 
1042  if ( !preg_match( '/^([a-zA-Z]+)(_[a-zA-Z]+|)\.(utf8|UTF-8)(@[a-zA-Z_]*|)$/i', $line, $m ) ) {
1043  continue;
1044  }
1045 
1046  list( , $lang, , , ) = $m;
1047 
1048  $candidatesByLocale[$m[0]] = $m;
1049  $candidatesByLang[$lang][] = $m;
1050  }
1051 
1052  # Try the current value of LANG.
1053  if ( isset( $candidatesByLocale[getenv( 'LANG' )] ) ) {
1054  $this->setVar( 'wgShellLocale', getenv( 'LANG' ) );
1055 
1056  return true;
1057  }
1058 
1059  # Try the most common ones.
1060  $commonLocales = array( 'en_US.UTF-8', 'en_US.utf8', 'de_DE.UTF-8', 'de_DE.utf8' );
1061  foreach ( $commonLocales as $commonLocale ) {
1062  if ( isset( $candidatesByLocale[$commonLocale] ) ) {
1063  $this->setVar( 'wgShellLocale', $commonLocale );
1064 
1065  return true;
1066  }
1067  }
1068 
1069  # Is there an available locale in the Wiki's language?
1070  $wikiLang = $this->getVar( 'wgLanguageCode' );
1071 
1072  if ( isset( $candidatesByLang[$wikiLang] ) ) {
1073  $m = reset( $candidatesByLang[$wikiLang] );
1074  $this->setVar( 'wgShellLocale', $m[0] );
1075 
1076  return true;
1077  }
1078 
1079  # Are there any at all?
1080  if ( count( $candidatesByLocale ) ) {
1081  $m = reset( $candidatesByLocale );
1082  $this->setVar( 'wgShellLocale', $m[0] );
1083 
1084  return true;
1085  }
1086 
1087  # Give up.
1088  return true;
1089  }
1090 
1095  protected function envCheckUploadsDirectory() {
1096  global $IP;
1097 
1098  $dir = $IP . '/images/';
1099  $url = $this->getVar( 'wgServer' ) . $this->getVar( 'wgScriptPath' ) . '/images/';
1100  $safe = !$this->dirIsExecutable( $dir, $url );
1101 
1102  if ( !$safe ) {
1103  $this->showMessage( 'config-uploads-not-safe', $dir );
1104  }
1105 
1106  return true;
1107  }
1108 
1114  protected function envCheckSuhosinMaxValueLength() {
1115  $maxValueLength = ini_get( 'suhosin.get.max_value_length' );
1116  if ( $maxValueLength > 0 && $maxValueLength < 1024 ) {
1117  // Only warn if the value is below the sane 1024
1118  $this->showMessage( 'config-suhosin-max-value-length', $maxValueLength );
1119  }
1120 
1121  return true;
1122  }
1123 
1129  protected function unicodeChar( $c ) {
1130  $c = hexdec( $c );
1131  if ( $c <= 0x7F ) {
1132  return chr( $c );
1133  } elseif ( $c <= 0x7FF ) {
1134  return chr( 0xC0 | $c >> 6 ) . chr( 0x80 | $c & 0x3F );
1135  } elseif ( $c <= 0xFFFF ) {
1136  return chr( 0xE0 | $c >> 12 ) . chr( 0x80 | $c >> 6 & 0x3F )
1137  . chr( 0x80 | $c & 0x3F );
1138  } elseif ( $c <= 0x10FFFF ) {
1139  return chr( 0xF0 | $c >> 18 ) . chr( 0x80 | $c >> 12 & 0x3F )
1140  . chr( 0x80 | $c >> 6 & 0x3F )
1141  . chr( 0x80 | $c & 0x3F );
1142  } else {
1143  return false;
1144  }
1145  }
1146 
1150  protected function envCheckLibicu() {
1151  $utf8 = function_exists( 'utf8_normalize' );
1152  $intl = function_exists( 'normalizer_normalize' );
1153 
1161  $not_normal_c = $this->unicodeChar( "FA6C" );
1162  $normal_c = $this->unicodeChar( "242EE" );
1163 
1164  $useNormalizer = 'php';
1165  $needsUpdate = false;
1166 
1171  if ( $utf8 ) {
1172  $useNormalizer = 'utf8';
1173  $utf8 = utf8_normalize( $not_normal_c, UtfNormal::UNORM_NFC );
1174  if ( $utf8 !== $normal_c ) {
1175  $needsUpdate = true;
1176  }
1177  }
1178  if ( $intl ) {
1179  $useNormalizer = 'intl';
1180  $intl = normalizer_normalize( $not_normal_c, Normalizer::FORM_C );
1181  if ( $intl !== $normal_c ) {
1182  $needsUpdate = true;
1183  }
1184  }
1185 
1186  // Uses messages 'config-unicode-using-php', 'config-unicode-using-utf8',
1187  // 'config-unicode-using-intl'
1188  if ( $useNormalizer === 'php' ) {
1189  $this->showMessage( 'config-unicode-pure-php-warning' );
1190  } else {
1191  $this->showMessage( 'config-unicode-using-' . $useNormalizer );
1192  if ( $needsUpdate ) {
1193  $this->showMessage( 'config-unicode-update-warning' );
1194  }
1195  }
1196  }
1197 
1201  protected function envCheckCtype() {
1202  if ( !function_exists( 'ctype_digit' ) ) {
1203  $this->showError( 'config-ctype' );
1204 
1205  return false;
1206  }
1207 
1208  return true;
1209  }
1210 
1214  protected function envCheckJSON() {
1215  if ( !function_exists( 'json_decode' ) ) {
1216  $this->showError( 'config-json' );
1218  return false;
1219  }
1220 
1221  return true;
1222  }
1223 
1231  protected static function getPossibleBinPaths() {
1232  return array_merge(
1233  array( '/usr/bin', '/usr/local/bin', '/opt/csw/bin',
1234  '/usr/gnu/bin', '/usr/sfw/bin', '/sw/bin', '/opt/local/bin' ),
1235  explode( PATH_SEPARATOR, getenv( 'PATH' ) )
1236  );
1237  }
1238 
1256  public static function locateExecutable( $path, $names, $versionInfo = false ) {
1257  if ( !is_array( $names ) ) {
1258  $names = array( $names );
1259  }
1260 
1261  foreach ( $names as $name ) {
1262  $command = $path . DIRECTORY_SEPARATOR . $name;
1263 
1265  $file_exists = file_exists( $command );
1267 
1268  if ( $file_exists ) {
1269  if ( !$versionInfo ) {
1270  return $command;
1271  }
1272 
1273  $file = str_replace( '$1', wfEscapeShellArg( $command ), $versionInfo[0] );
1274  if ( strstr( wfShellExec( $file ), $versionInfo[1] ) !== false ) {
1275  return $command;
1276  }
1277  }
1278  }
1279 
1280  return false;
1281  }
1282 
1295  public static function locateExecutableInDefaultPaths( $names, $versionInfo = false ) {
1296  foreach ( self::getPossibleBinPaths() as $path ) {
1297  $exe = self::locateExecutable( $path, $names, $versionInfo );
1298  if ( $exe !== false ) {
1299  return $exe;
1300  }
1301  }
1302 
1303  return false;
1304  }
1305 
1314  public function dirIsExecutable( $dir, $url ) {
1315  $scriptTypes = array(
1316  'php' => array(
1317  "<?php echo 'ex' . 'ec';",
1318  "#!/var/env php5\n<?php echo 'ex' . 'ec';",
1319  ),
1320  );
1321 
1322  // it would be good to check other popular languages here, but it'll be slow.
1323 
1325 
1326  foreach ( $scriptTypes as $ext => $contents ) {
1327  foreach ( $contents as $source ) {
1328  $file = 'exectest.' . $ext;
1329 
1330  if ( !file_put_contents( $dir . $file, $source ) ) {
1331  break;
1332  }
1333 
1334  try {
1335  $text = Http::get( $url . $file, array( 'timeout' => 3 ) );
1336  } catch ( MWException $e ) {
1337  // Http::get throws with allow_url_fopen = false and no curl extension.
1338  $text = null;
1339  }
1340  unlink( $dir . $file );
1341 
1342  if ( $text == 'exec' ) {
1344 
1345  return $ext;
1346  }
1347  }
1348  }
1349 
1351 
1352  return false;
1353  }
1354 
1361  public static function apacheModulePresent( $moduleName ) {
1362  if ( function_exists( 'apache_get_modules' ) && in_array( $moduleName, apache_get_modules() ) ) {
1363  return true;
1364  }
1365  // try it the hard way
1366  ob_start();
1367  phpinfo( INFO_MODULES );
1368  $info = ob_get_clean();
1369 
1370  return strpos( $info, $moduleName ) !== false;
1371  }
1372 
1378  public function setParserLanguage( $lang ) {
1379  $this->parserOptions->setTargetLanguage( $lang );
1380  $this->parserOptions->setUserLang( $lang );
1381  }
1382 
1388  protected function getDocUrl( $page ) {
1389  return "{$_SERVER['PHP_SELF']}?page=" . urlencode( $page );
1390  }
1391 
1398  public function findExtensions() {
1399  if ( $this->getVar( 'IP' ) === null ) {
1400  return array();
1401  }
1402 
1403  $extDir = $this->getVar( 'IP' ) . '/extensions';
1404  if ( !is_readable( $extDir ) || !is_dir( $extDir ) ) {
1405  return array();
1406  }
1407 
1408  $dh = opendir( $extDir );
1409  $exts = array();
1410  while ( ( $file = readdir( $dh ) ) !== false ) {
1411  if ( !is_dir( "$extDir/$file" ) ) {
1412  continue;
1413  }
1414  if ( file_exists( "$extDir/$file/$file.php" ) ) {
1415  $exts[] = $file;
1416  }
1417  }
1418  closedir( $dh );
1419  natcasesort( $exts );
1420 
1421  return $exts;
1422  }
1423 
1429  protected function includeExtensions() {
1430  global $IP;
1431  $exts = $this->getVar( '_Extensions' );
1432  $IP = $this->getVar( 'IP' );
1433 
1443  $wgAutoloadClasses = array();
1444 
1445  require "$IP/includes/DefaultSettings.php";
1446 
1447  foreach ( $exts as $e ) {
1448  require_once "$IP/extensions/$e/$e.php";
1449  }
1450 
1451  $hooksWeWant = isset( $wgHooks['LoadExtensionSchemaUpdates'] ) ?
1452  $wgHooks['LoadExtensionSchemaUpdates'] : array();
1453 
1454  // Unset everyone else's hooks. Lord knows what someone might be doing
1455  // in ParserFirstCallInit (see bug 27171)
1456  $GLOBALS['wgHooks'] = array( 'LoadExtensionSchemaUpdates' => $hooksWeWant );
1457 
1458  return Status::newGood();
1459  }
1460 
1473  protected function getInstallSteps( DatabaseInstaller $installer ) {
1474  $coreInstallSteps = array(
1475  array( 'name' => 'database', 'callback' => array( $installer, 'setupDatabase' ) ),
1476  array( 'name' => 'tables', 'callback' => array( $installer, 'createTables' ) ),
1477  array( 'name' => 'interwiki', 'callback' => array( $installer, 'populateInterwikiTable' ) ),
1478  array( 'name' => 'stats', 'callback' => array( $this, 'populateSiteStats' ) ),
1479  array( 'name' => 'keys', 'callback' => array( $this, 'generateKeys' ) ),
1480  array( 'name' => 'sysop', 'callback' => array( $this, 'createSysop' ) ),
1481  array( 'name' => 'mainpage', 'callback' => array( $this, 'createMainpage' ) ),
1482  );
1483 
1484  // Build the array of install steps starting from the core install list,
1485  // then adding any callbacks that wanted to attach after a given step
1486  foreach ( $coreInstallSteps as $step ) {
1487  $this->installSteps[] = $step;
1488  if ( isset( $this->extraInstallSteps[$step['name']] ) ) {
1489  $this->installSteps = array_merge(
1490  $this->installSteps,
1491  $this->extraInstallSteps[$step['name']]
1492  );
1493  }
1494  }
1495 
1496  // Prepend any steps that want to be at the beginning
1497  if ( isset( $this->extraInstallSteps['BEGINNING'] ) ) {
1498  $this->installSteps = array_merge(
1499  $this->extraInstallSteps['BEGINNING'],
1500  $this->installSteps
1501  );
1502  }
1503 
1504  // Extensions should always go first, chance to tie into hooks and such
1505  if ( count( $this->getVar( '_Extensions' ) ) ) {
1506  array_unshift( $this->installSteps,
1507  array( 'name' => 'extensions', 'callback' => array( $this, 'includeExtensions' ) )
1508  );
1509  $this->installSteps[] = array(
1510  'name' => 'extension-tables',
1511  'callback' => array( $installer, 'createExtensionTables' )
1512  );
1513  }
1514 
1515  return $this->installSteps;
1516  }
1517 
1526  public function performInstallation( $startCB, $endCB ) {
1527  $installResults = array();
1528  $installer = $this->getDBInstaller();
1529  $installer->preInstall();
1530  $steps = $this->getInstallSteps( $installer );
1531  foreach ( $steps as $stepObj ) {
1532  $name = $stepObj['name'];
1533  call_user_func_array( $startCB, array( $name ) );
1534 
1535  // Perform the callback step
1536  $status = call_user_func( $stepObj['callback'], $installer );
1537 
1538  // Output and save the results
1539  call_user_func( $endCB, $name, $status );
1540  $installResults[$name] = $status;
1541 
1542  // If we've hit some sort of fatal, we need to bail.
1543  // Callback already had a chance to do output above.
1544  if ( !$status->isOk() ) {
1545  break;
1546  }
1547  }
1548  if ( $status->isOk() ) {
1549  $this->setVar( '_InstallDone', true );
1550  }
1551 
1552  return $installResults;
1553  }
1554 
1560  public function generateKeys() {
1561  $keys = array( 'wgSecretKey' => 64 );
1562  if ( strval( $this->getVar( 'wgUpgradeKey' ) ) === '' ) {
1563  $keys['wgUpgradeKey'] = 16;
1564  }
1565 
1566  return $this->doGenerateKeys( $keys );
1567  }
1568 
1576  protected function doGenerateKeys( $keys ) {
1577  $status = Status::newGood();
1578 
1579  $strong = true;
1580  foreach ( $keys as $name => $length ) {
1581  $secretKey = MWCryptRand::generateHex( $length, true );
1582  if ( !MWCryptRand::wasStrong() ) {
1583  $strong = false;
1584  }
1585 
1586  $this->setVar( $name, $secretKey );
1587  }
1588 
1589  if ( !$strong ) {
1590  $names = array_keys( $keys );
1591  $names = preg_replace( '/^(.*)$/', '\$$1', $names );
1592  global $wgLang;
1593  $status->warning( 'config-insecure-keys', $wgLang->listToText( $names ), count( $names ) );
1594  }
1595 
1596  return $status;
1597  }
1598 
1604  protected function createSysop() {
1605  $name = $this->getVar( '_AdminName' );
1606  $user = User::newFromName( $name );
1607 
1608  if ( !$user ) {
1609  // We should've validated this earlier anyway!
1610  return Status::newFatal( 'config-admin-error-user', $name );
1611  }
1612 
1613  if ( $user->idForName() == 0 ) {
1614  $user->addToDatabase();
1615 
1616  try {
1617  $user->setPassword( $this->getVar( '_AdminPassword' ) );
1618  } catch ( PasswordError $pwe ) {
1619  return Status::newFatal( 'config-admin-error-password', $name, $pwe->getMessage() );
1620  }
1621 
1622  $user->addGroup( 'sysop' );
1623  $user->addGroup( 'bureaucrat' );
1624  if ( $this->getVar( '_AdminEmail' ) ) {
1625  $user->setEmail( $this->getVar( '_AdminEmail' ) );
1626  }
1627  $user->saveSettings();
1628 
1629  // Update user count
1630  $ssUpdate = new SiteStatsUpdate( 0, 0, 0, 0, 1 );
1631  $ssUpdate->doUpdate();
1632  }
1633  $status = Status::newGood();
1634 
1635  if ( $this->getVar( '_Subscribe' ) && $this->getVar( '_AdminEmail' ) ) {
1636  $this->subscribeToMediaWikiAnnounce( $status );
1637  }
1638 
1639  return $status;
1640  }
1641 
1645  private function subscribeToMediaWikiAnnounce( Status $s ) {
1646  $params = array(
1647  'email' => $this->getVar( '_AdminEmail' ),
1648  'language' => 'en',
1649  'digest' => 0
1650  );
1651 
1652  // Mailman doesn't support as many languages as we do, so check to make
1653  // sure their selected language is available
1654  $myLang = $this->getVar( '_UserLang' );
1655  if ( in_array( $myLang, $this->mediaWikiAnnounceLanguages ) ) {
1656  $myLang = $myLang == 'pt-br' ? 'pt_BR' : $myLang; // rewrite to Mailman's pt_BR
1657  $params['language'] = $myLang;
1658  }
1659 
1661  $res = MWHttpRequest::factory( $this->mediaWikiAnnounceUrl,
1662  array( 'method' => 'POST', 'postData' => $params ) )->execute();
1663  if ( !$res->isOK() ) {
1664  $s->warning( 'config-install-subscribe-fail', $res->getMessage() );
1665  }
1666  } else {
1667  $s->warning( 'config-install-subscribe-notpossible' );
1668  }
1669  }
1670 
1677  protected function createMainpage( DatabaseInstaller $installer ) {
1678  $status = Status::newGood();
1679  try {
1681  $content = new WikitextContent(
1682  wfMessage( 'mainpagetext' )->inContentLanguage()->text() . "\n\n" .
1683  wfMessage( 'mainpagedocfooter' )->inContentLanguage()->text()
1684  );
1685 
1686  $page->doEditContent( $content,
1687  '',
1688  EDIT_NEW,
1689  false,
1690  User::newFromName( 'MediaWiki default' )
1691  );
1692  } catch ( MWException $e ) {
1693  //using raw, because $wgShowExceptionDetails can not be set yet
1694  $status->fatal( 'config-install-mainpage-failed', $e->getMessage() );
1695  }
1696 
1697  return $status;
1698  }
1699 
1703  public static function overrideConfig() {
1704  define( 'MW_NO_SESSION', 1 );
1705 
1706  // Don't access the database
1707  $GLOBALS['wgUseDatabaseMessages'] = false;
1708  // Don't cache langconv tables
1709  $GLOBALS['wgLanguageConverterCacheType'] = CACHE_NONE;
1710  // Debug-friendly
1711  $GLOBALS['wgShowExceptionDetails'] = true;
1712  // Don't break forms
1713  $GLOBALS['wgExternalLinkTarget'] = '_blank';
1714 
1715  // Extended debugging
1716  $GLOBALS['wgShowSQLErrors'] = true;
1717  $GLOBALS['wgShowDBErrorBacktrace'] = true;
1718 
1719  // Allow multiple ob_flush() calls
1720  $GLOBALS['wgDisableOutputCompression'] = true;
1721 
1722  // Use a sensible cookie prefix (not my_wiki)
1723  $GLOBALS['wgCookiePrefix'] = 'mw_installer';
1724 
1725  // Some of the environment checks make shell requests, remove limits
1726  $GLOBALS['wgMaxShellMemory'] = 0;
1728  // Don't bother embedding images into generated CSS, which is not cached
1729  $GLOBALS['wgResourceLoaderLESSFunctions']['embeddable'] = function ( $frame, $less ) {
1730  return $less->toBool( false );
1731  };
1732  }
1733 
1741  public function addInstallStep( $callback, $findStep = 'BEGINNING' ) {
1742  $this->extraInstallSteps[$findStep][] = $callback;
1743  }
1744 
1749  protected function disableTimeLimit() {
1751  set_time_limit( 0 );
1753  }
1754 }
Installer\envCheckBrokenXML
envCheckBrokenXML()
Some versions of libxml+PHP break < and > encoding horribly.
Definition: Installer.php:713
ParserOptions
Set options of the Parser.
Definition: ParserOptions.php:31
$wgUser
$wgUser
Definition: Setup.php:552
Installer\__construct
__construct()
Constructor, always call this from child classes.
Definition: Installer.php:337
User\newFromId
static newFromId( $id)
Static factory method for creation from a given user ID.
Definition: User.php:411
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:189
wfShellExec
wfShellExec( $cmd, &$retval=null, $environ=array(), $limits=array(), $options=array())
Execute a shell command, with time and memory limits mirrored from the PHP configuration if supported...
Definition: GlobalFunctions.php:2804
LBFactory\disableBackend
static disableBackend()
Disables all access to the load balancer, will cause all database access to throw a DBAccessError.
Definition: LBFactory.php:36
MWCryptRand\wasStrong
static wasStrong()
Return a boolean indicating whether or not the source used for cryptographic random bytes generation ...
Definition: MWCryptRand.php:482
Installer\createMainpage
createMainpage(DatabaseInstaller $installer)
Insert Main Page with default content.
Definition: Installer.php:1663
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
Installer\showMessage
showMessage( $msg)
UI interface for displaying a short message The parameters are like parameters to wfMessage().
$html
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
Definition: hooks.txt:1530
Installer\MINIMUM_PHP_VERSION
const MINIMUM_PHP_VERSION
Definition: Installer.php:42
Installer\parse
parse( $text, $lineStart=false)
Convert wikitext $text to HTML.
Definition: Installer.php:587
$wgAutoloadClasses
global $wgAutoloadClasses
Definition: TestsAutoLoader.php:24
Installer\showStatusMessage
showStatusMessage(Status $status)
Show a message to the installing user by using a Status object.
Installer\dirIsExecutable
dirIsExecutable( $dir, $url)
Checks if scripts located in the given directory can be executed via the given URL.
Definition: Installer.php:1300
text
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
Definition: design.txt:12
CACHE_NONE
const CACHE_NONE
Definition: Defines.php:112
Installer\envCheckLibicu
envCheckLibicu()
Check the libicu version.
Definition: Installer.php:1136
Title\newMainPage
static newMainPage()
Create a new Title for the Main Page.
Definition: Title.php:441
Installer\envCheckExtension
envCheckExtension()
Environment check for setting the preferred PHP file extension.
Definition: Installer.php:987
Installer\envCheckCtype
envCheckCtype()
Definition: Installer.php:1187
Installer\populateSiteStats
populateSiteStats(DatabaseInstaller $installer)
Install step which adds a row to the site_stats table with appropriate initial values.
Definition: Installer.php:628
Installer\$extraInstallSteps
array $extraInstallSteps
Extra steps for installation, for things like DatabaseInstallers to modify.
Definition: Installer.php:220
DatabaseInstaller\getConnection
getConnection()
Connect to the database using the administrative user/password currently defined in the session.
Definition: DatabaseInstaller.php:145
$n
$n
Definition: RandomTest.php:76
Installer\$rightsProfiles
array $rightsProfiles
User rights profiles.
Definition: Installer.php:236
Installer\envCheckShellLocale
envCheckShellLocale()
Environment check for preferred locale in shell.
Definition: Installer.php:1003
$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:1530
wfSuppressWarnings
wfSuppressWarnings( $end=false)
Reference-counted warning suppression.
Definition: GlobalFunctions.php:2387
Installer\envCheckMbstring
envCheckMbstring()
Environment check for mbstring.func_overload.
Definition: Installer.php:756
Installer\envCheckUploadsDirectory
envCheckUploadsDirectory()
Environment check for the permissions of the uploads directory.
Definition: Installer.php:1081
Installer\$settings
array $settings
Definition: Installer.php:54
Status\newGood
static newGood( $value=null)
Factory function for good results.
Definition: Status.php:77
$params
$params
Definition: styleTest.css.php:40
$limit
if( $sleep) $limit
Definition: importImages.php:99
Installer\performInstallation
performInstallation( $startCB, $endCB)
Actually perform the installation.
Definition: Installer.php:1512
Installer\$mediaWikiAnnounceLanguages
$mediaWikiAnnounceLanguages
Supported language codes for Mailman.
Definition: Installer.php:307
PasswordError
Thrown by User::setPassword() on error.
Definition: User.php:45
User\newFromName
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition: User.php:388
DatabaseInstaller\checkPrerequisites
checkPrerequisites()
Checks for installation prerequisites other than those checked by isCompiled()
Definition: DatabaseInstaller.php:73
$s
$s
Definition: mergeMessageFileList.php:156
MWCryptRand\generateHex
static generateHex( $chars, $forceStrong=false)
Generate a run of (ideally) cryptographically random data and return it in hexadecimal string format.
Definition: MWCryptRand.php:514
Installer\$dbInstallers
array $dbInstallers
Cached DB installer instances, access using getDBInstaller().
Definition: Installer.php:66
Installer\setParserLanguage
setParserLanguage( $lang)
ParserOptions are constructed before we determined the language, so fix it.
Definition: Installer.php:1364
$wgHooks
$wgHooks['ArticleShow'][]
Definition: hooks.txt:110
Installer\addInstallStep
addInstallStep( $callback, $findStep='BEGINNING')
Add an installation step following the given step.
Definition: Installer.php:1727
Installer\$internalDefaults
array $internalDefaults
Variables that are stored alongside globals, and are used for any configuration of the installation p...
Definition: Installer.php:179
Installer\setPassword
setPassword( $name, $value)
Set a variable which stores a password, except if the new value is a fake password in which case leav...
Definition: Installer.php:539
Installer\envGetDefaultServer
envGetDefaultServer()
Helper function to be called from envCheckServer()
DatabaseInstaller\preInstall
preInstall()
Allow DB installers a chance to make last-minute changes before installation occurs.
Definition: DatabaseInstaller.php:293
Installer\setVar
setVar( $name, $value)
Set a MW configuration variable, or internal installer configuration variable.
Definition: Installer.php:443
Installer\$parserTitle
Title $parserTitle
Cached Title, used by parse().
Definition: Installer.php:78
Installer\$objectCaches
array $objectCaches
Known object cache types and the functions used to test for their existence.
Definition: Installer.php:226
Installer\locateExecutableInDefaultPaths
static locateExecutableInDefaultPaths( $names, $versionInfo=false)
Same as locateExecutable(), but checks in getPossibleBinPaths() by default.
Definition: Installer.php:1281
Status
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Definition: Status.php:40
Installer\overrideConfig
static overrideConfig()
Override the necessary bits of the config to run an installation.
Definition: Installer.php:1689
Installer\createSysop
createSysop()
Create the first user account, grant it sysop and bureaucrat rights.
Definition: Installer.php:1590
Installer\getFakePassword
getFakePassword( $realPassword)
Get a fake password for sending back to the user in HTML.
Definition: Installer.php:528
$test
$test
Definition: Utf8Test.php:89
Installer\envCheckSuhosinMaxValueLength
envCheckSuhosinMaxValueLength()
Checks if suhosin.get.max_value_length is set, and if so generate a warning because it decreases Reso...
Definition: Installer.php:1100
Language\getLocalisationCache
static getLocalisationCache()
Get the LocalisationCache instance.
Definition: Language.php:443
Installer\showError
showError( $msg)
Same as showMessage(), but for displaying errors.
MWException
MediaWiki exception.
Definition: MWException.php:26
Installer\getPossibleBinPaths
static getPossibleBinPaths()
Get an array of likely places we can find executables.
Definition: Installer.php:1217
$out
$out
Definition: UtfNormalGenerate.php:167
WikiPage\factory
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
Definition: WikiPage.php:103
Installer\envCheckRegisterGlobals
envCheckRegisterGlobals()
Environment check for register_globals.
Definition: Installer.php:703
wfRestoreWarnings
wfRestoreWarnings()
Restore error level to previous value.
Definition: GlobalFunctions.php:2417
Installer\envCheckDiff3
envCheckDiff3()
Search for GNU diff3.
Definition: Installer.php:883
Installer\envCheckMagicQuotes
envCheckMagicQuotes()
Environment check for magic_quotes_runtime.
Definition: Installer.php:728
Installer\envCheckJSON
envCheckJSON()
Definition: Installer.php:1200
Installer\generateKeys
generateKeys()
Generate $wgSecretKey.
Definition: Installer.php:1546
Installer\envCheckMagicSybase
envCheckMagicSybase()
Environment check for magic_quotes_sybase.
Definition: Installer.php:742
Installer\envCheckMemory
envCheckMemory()
Environment check for available memory.
Definition: Installer.php:823
wfMessage
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 after processing after in associative array form externallinks including delete and has completed for all link tables 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
Installer\getCompiledDBs
getCompiledDBs()
Get a list of DBs supported by current PHP setup.
Definition: Installer.php:470
Installer\exportVars
exportVars()
Exports all wg* variables stored by the installer into global scope.
Definition: Installer.php:653
Installer\$minMemorySize
integer $minMemorySize
Minimum memory size in MB.
Definition: Installer.php:72
Installer\envCheckCache
envCheckCache()
Environment check for compiled object cache types.
Definition: Installer.php:849
Installer\getExistingLocalSettings
static getExistingLocalSettings()
Determine if LocalSettings.php exists.
Definition: Installer.php:501
Installer\envCheckPath
envCheckPath()
Environment check for setting $IP and $wgScriptPath.
Definition: Installer.php:969
wfShorthandToInteger
wfShorthandToInteger( $string='')
Converts shorthand byte notation to integer form.
Definition: GlobalFunctions.php:3889
Installer\doGenerateKeys
doGenerateKeys( $keys)
Generate a secret value for variables using our CryptRand generator.
Definition: Installer.php:1562
$lines
$lines
Definition: router.php:65
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
Installer\$parserOptions
ParserOptions $parserOptions
Cached ParserOptions, used by parse().
Definition: Installer.php:84
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
settings
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:25
SiteStatsUpdate
Class for handling updates to the site_stats table.
Definition: SiteStatsUpdate.php:24
Installer\getVar
getVar( $name, $default=null)
Get an MW configuration variable, or internal installer configuration variable.
Definition: Installer.php:457
WikitextContent
Content object for wiki text pages.
Definition: WikitextContent.php:33
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
Installer\restoreLinkPopups
restoreLinkPopups()
Definition: Installer.php:615
Installer\envCheckXML
envCheckXML()
Environment check for the XML module.
Definition: Installer.php:783
Http\get
static get( $url, $timeout='default', $options=array())
Simple wrapper for Http::request( 'GET' )
Definition: HttpFunctions.php:93
$command
$command
Definition: cdb.php:63
$line
$line
Definition: cdb.php:57
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:336
UtfNormal\UNORM_NFC
const UNORM_NFC
Definition: UtfNormal.php:55
$value
$value
Definition: styleTest.css.php:45
DBAccessError
Exception class for attempted DB access.
Definition: LBFactory.php:379
Installer\$installSteps
array $installSteps
The actual list of installation steps.
Definition: Installer.php:214
wfIsWindows
wfIsWindows()
Check if the operating system is Windows.
Definition: GlobalFunctions.php:2524
wfEscapeShellArg
wfEscapeShellArg()
Windows-compatible version of escapeshellarg() Windows doesn't recognise single-quotes in the shell,...
Definition: GlobalFunctions.php:2705
Installer\getDBInstaller
getDBInstaller( $type=false)
Get an instance of DatabaseInstaller for the specified DB type.
Definition: Installer.php:481
DatabaseInstaller
Base class for DBMS-specific installation helper classes.
Definition: DatabaseInstaller.php:30
Installer\envCheckDB
envCheckDB()
Environment check for DB types.
Definition: Installer.php:665
Installer\getInstallSteps
getInstallSteps(DatabaseInstaller $installer)
Get an array of install steps.
Definition: Installer.php:1459
$user
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Definition: hooks.txt:237
Installer\$compiledDBs
array $compiledDBs
List of detected DBs, access using getCompiledDBs().
Definition: Installer.php:60
wfIniGetBool
wfIniGetBool( $setting)
Safety wrapper around ini_get() for boolean settings.
Definition: GlobalFunctions.php:2685
Installer\doEnvironmentChecks
doEnvironmentChecks()
Do initial checks of the PHP environment.
Definition: Installer.php:404
$file
if(PHP_SAPI !='cli') $file
Definition: UtfNormalTest2.php:30
EDIT_NEW
const EDIT_NEW
Definition: Defines.php:189
Installer\envCheckGraphics
envCheckGraphics()
Environment check for ImageMagick and GD.
Definition: Installer.php:903
Installer\apacheModulePresent
static apacheModulePresent( $moduleName)
Checks for presence of an Apache module.
Definition: Installer.php:1347
PhpXmlBugTester
Test for PHP+libxml2 bug which breaks XML input subtly with certain versions.
Definition: PhpBugTests.php:30
Title
Represents a title within MediaWiki.
Definition: Title.php:35
Installer\envCheckPCRE
envCheckPCRE()
Environment check for the PCRE module.
Definition: Installer.php:801
$wgLang
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 $wgLang
Definition: design.txt:56
$wgParser
$wgParser
Definition: Setup.php:567
$dir
if(count( $args)==0) $dir
Definition: importImages.php:49
$ext
$ext
Definition: NoLocalSettings.php:34
Installer\getParserOptions
getParserOptions()
Definition: Installer.php:607
MWHttpRequest\canMakeRequests
static canMakeRequests()
Simple function to test if we can make any sort of requests at all, using cURL or fopen()
Definition: HttpFunctions.php:272
$path
$path
Definition: NoLocalSettings.php:35
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
Installer\$licenses
array $licenses
License types.
Definition: Installer.php:260
Installer\disableTimeLimit
disableTimeLimit()
Disable the time limit for execution.
Definition: Installer.php:1735
$keys
$keys
Definition: testCompression.php:63
Installer\$dbTypes
static $dbTypes
Definition: Installer.php:95
ParserOptions\setEditSection
setEditSection( $x)
Definition: ParserOptions.php:300
Installer\findExtensions
findExtensions()
Finds extensions that follow the format /extensions/Name/Name.php, and returns an array containing th...
Definition: Installer.php:1384
$source
if(PHP_SAPI !='cli') $source
Definition: mwdoc-filter.php:18
Installer\envCheckServer
envCheckServer()
Environment check for the server hostname.
Definition: Installer.php:949
Installer
Base installer class.
Definition: Installer.php:39
Installer\MINIMUM_PCRE_VERSION
const MINIMUM_PCRE_VERSION
The oldest version of PCRE we can support.
Definition: Installer.php:50
Installer\getDBTypes
static getDBTypes()
Get a list of known DB types.
Definition: Installer.php:387
Installer\disableLinkPopups
disableLinkPopups()
Definition: Installer.php:611
Installer\envCheckSafeMode
envCheckSafeMode()
Environment check for safe_mode.
Definition: Installer.php:770
$e
if( $useReadline) $e
Definition: eval.php:66
Installer\$mediaWikiAnnounceUrl
$mediaWikiAnnounceUrl
URL to mediawiki-announce subscription.
Definition: Installer.php:301
$IP
$IP
Definition: WebStart.php:88
Installer\includeExtensions
includeExtensions()
Installs the auto-detected extensions.
Definition: Installer.php:1415
$res
$res
Definition: database.txt:21
MWHttpRequest\factory
static factory( $url, $options=null)
Generate a new request object.
Definition: HttpFunctions.php:284
Installer\envCheckGit
envCheckGit()
Search for git.
Definition: Installer.php:929
Installer\getDocUrl
getDocUrl( $page)
Overridden by WebInstaller to provide lastPage parameters.
Definition: Installer.php:1374
$GLOBALS
$GLOBALS['IP']
Definition: ComposerHookHandler.php:6
Installer\subscribeToMediaWikiAnnounce
subscribeToMediaWikiAnnounce(Status $s)
Definition: Installer.php:1631
Installer\unicodeChar
unicodeChar( $c)
Convert a hex string representing a Unicode code point to that code point.
Definition: Installer.php:1115
Installer\maybeGetWebserverPrimaryGroup
static maybeGetWebserverPrimaryGroup()
On POSIX systems return the primary group of the webserver we're running under.
Definition: Installer.php:556
Installer\$defaultVarNames
array $defaultVarNames
MediaWiki configuration globals that will eventually be passed through to LocalSettings....
Definition: Installer.php:142
Status\newFatal
static newFatal( $message)
Factory function for fatal errors.
Definition: Status.php:63
Installer\$envChecks
array $envChecks
A list of environment check methods called by doEnvironmentChecks().
Definition: Installer.php:109
$type
$type
Definition: testCompression.php:46
Installer\envCheckModSecurity
envCheckModSecurity()
Scare user to death if they have mod_security.
Definition: Installer.php:871
Installer\locateExecutable
static locateExecutable( $path, $names, $versionInfo=false)
Search a path for any of the given executable names.
Definition: Installer.php:1242