MediaWiki  1.23.14
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 
518  // You might be wondering why this is here. Well if you don't do this
519  // then some poorly-formed extensions try to call their own classes
520  // after immediately registering them. We really need to get extension
521  // registration out of the global scope and into a real format.
522  // @see https://bugzilla.wikimedia.org/67440
524 
526  $_lsExists = file_exists( "$IP/LocalSettings.php" );
528 
529  if ( !$_lsExists ) {
530  return false;
531  }
532  unset( $_lsExists );
533 
534  require "$IP/includes/DefaultSettings.php";
535  require "$IP/LocalSettings.php";
536 
537  return get_defined_vars();
538  }
539 
549  public function getFakePassword( $realPassword ) {
550  return str_repeat( '*', strlen( $realPassword ) );
551  }
552 
560  public function setPassword( $name, $value ) {
561  if ( !preg_match( '/^\*+$/', $value ) ) {
562  $this->setVar( $name, $value );
563  }
564  }
565 
577  public static function maybeGetWebserverPrimaryGroup() {
578  if ( !function_exists( 'posix_getegid' ) || !function_exists( 'posix_getpwuid' ) ) {
579  # I don't know this, this isn't UNIX.
580  return null;
581  }
582 
583  # posix_getegid() *not* getmygid() because we want the group of the webserver,
584  # not whoever owns the current script.
585  $gid = posix_getegid();
586  $getpwuid = posix_getpwuid( $gid );
587  $group = $getpwuid['name'];
588 
589  return $group;
590  }
591 
608  public function parse( $text, $lineStart = false ) {
610 
611  try {
612  $out = $wgParser->parse( $text, $this->parserTitle, $this->parserOptions, $lineStart );
613  $html = $out->getText();
614  } catch ( DBAccessError $e ) {
615  $html = '<!--DB access attempted during parse--> ' . htmlspecialchars( $text );
616 
617  if ( !empty( $this->debug ) ) {
618  $html .= "<!--\n" . $e->getTraceAsString() . "\n-->";
619  }
620  }
621 
622  return $html;
623  }
624 
628  public function getParserOptions() {
629  return $this->parserOptions;
630  }
631 
632  public function disableLinkPopups() {
633  $this->parserOptions->setExternalLinkTarget( false );
634  }
635 
636  public function restoreLinkPopups() {
637  global $wgExternalLinkTarget;
638  $this->parserOptions->setExternalLinkTarget( $wgExternalLinkTarget );
639  }
640 
649  public function populateSiteStats( DatabaseInstaller $installer ) {
650  $status = $installer->getConnection();
651  if ( !$status->isOK() ) {
652  return $status;
653  }
654  $status->value->insert(
655  'site_stats',
656  array(
657  'ss_row_id' => 1,
658  'ss_total_views' => 0,
659  'ss_total_edits' => 0,
660  'ss_good_articles' => 0,
661  'ss_total_pages' => 0,
662  'ss_users' => 0,
663  'ss_images' => 0
664  ),
665  __METHOD__, 'IGNORE'
666  );
667 
668  return Status::newGood();
669  }
670 
674  public function exportVars() {
675  foreach ( $this->settings as $name => $value ) {
676  if ( substr( $name, 0, 2 ) == 'wg' ) {
677  $GLOBALS[$name] = $value;
678  }
679  }
680  }
681 
686  protected function envCheckDB() {
687  global $wgLang;
688 
689  $allNames = array();
690 
691  // Messages: config-type-mysql, config-type-postgres, config-type-oracle,
692  // config-type-sqlite
693  foreach ( self::getDBTypes() as $name ) {
694  $allNames[] = wfMessage( "config-type-$name" )->text();
695  }
696 
697  $databases = $this->getCompiledDBs();
698 
699  $databases = array_flip( $databases );
700  foreach ( array_keys( $databases ) as $db ) {
701  $installer = $this->getDBInstaller( $db );
702  $status = $installer->checkPrerequisites();
703  if ( !$status->isGood() ) {
704  $this->showStatusMessage( $status );
705  }
706  if ( !$status->isOK() ) {
707  unset( $databases[$db] );
708  }
709  }
710  $databases = array_flip( $databases );
711  if ( !$databases ) {
712  $this->showError( 'config-no-db', $wgLang->commaList( $allNames ) );
713 
714  // @todo FIXME: This only works for the web installer!
715  return false;
716  }
717 
718  return true;
719  }
720 
724  protected function envCheckRegisterGlobals() {
725  if ( wfIniGetBool( 'register_globals' ) ) {
726  $this->showMessage( 'config-register-globals' );
727  }
728  }
729 
734  protected function envCheckBrokenXML() {
736  if ( !$test->ok ) {
737  $this->showError( 'config-brokenlibxml' );
738 
739  return false;
740  }
741 
742  return true;
743  }
744 
749  protected function envCheckMagicQuotes() {
750  if ( wfIniGetBool( "magic_quotes_runtime" ) ) {
751  $this->showError( 'config-magic-quotes-runtime' );
752 
753  return false;
754  }
755 
756  return true;
757  }
758 
763  protected function envCheckMagicSybase() {
764  if ( wfIniGetBool( 'magic_quotes_sybase' ) ) {
765  $this->showError( 'config-magic-quotes-sybase' );
766 
767  return false;
768  }
769 
770  return true;
771  }
772 
777  protected function envCheckMbstring() {
778  if ( wfIniGetBool( 'mbstring.func_overload' ) ) {
779  $this->showError( 'config-mbstring' );
780 
781  return false;
782  }
783 
784  return true;
785  }
786 
791  protected function envCheckSafeMode() {
792  if ( wfIniGetBool( 'safe_mode' ) ) {
793  $this->setVar( '_SafeMode', true );
794  $this->showMessage( 'config-safe-mode' );
795  }
796 
797  return true;
798  }
799 
804  protected function envCheckXML() {
805  if ( !function_exists( "utf8_encode" ) ) {
806  $this->showError( 'config-xml-bad' );
807 
808  return false;
809  }
810 
811  return true;
812  }
813 
822  protected function envCheckPCRE() {
824  $regexd = preg_replace( '/[\x{0430}-\x{04FF}]/iu', '', '-АБВГД-' );
825  // Need to check for \p support too, as PCRE can be compiled
826  // with utf8 support, but not unicode property support.
827  // check that \p{Zs} (space separators) matches
828  // U+3000 (Ideographic space)
829  $regexprop = preg_replace( '/\p{Zs}/u', '', "-\xE3\x80\x80-" );
831  if ( $regexd != '--' || $regexprop != '--' ) {
832  $this->showError( 'config-pcre-no-utf8' );
833 
834  return false;
835  }
836 
837  return true;
838  }
839 
844  protected function envCheckMemory() {
845  $limit = ini_get( 'memory_limit' );
846 
847  if ( !$limit || $limit == -1 ) {
848  return true;
849  }
850 
852 
853  if ( $n < $this->minMemorySize * 1024 * 1024 ) {
854  $newLimit = "{$this->minMemorySize}M";
855 
856  if ( ini_set( "memory_limit", $newLimit ) === false ) {
857  $this->showMessage( 'config-memory-bad', $limit );
858  } else {
859  $this->showMessage( 'config-memory-raised', $limit, $newLimit );
860  $this->setVar( '_RaiseMemory', true );
861  }
862  }
863 
864  return true;
865  }
866 
870  protected function envCheckCache() {
871  $caches = array();
872  foreach ( $this->objectCaches as $name => $function ) {
873  if ( function_exists( $function ) ) {
874  if ( $name == 'xcache' && !wfIniGetBool( 'xcache.var_size' ) ) {
875  continue;
876  }
877  $caches[$name] = true;
878  }
879  }
880 
881  if ( !$caches ) {
882  $this->showMessage( 'config-no-cache' );
883  }
884 
885  $this->setVar( '_Caches', $caches );
886  }
887 
892  protected function envCheckModSecurity() {
893  if ( self::apacheModulePresent( 'mod_security' ) ) {
894  $this->showMessage( 'config-mod-security' );
895  }
896 
897  return true;
898  }
899 
904  protected function envCheckDiff3() {
905  $names = array( "gdiff3", "diff3", "diff3.exe" );
906  $versionInfo = array( '$1 --version 2>&1', 'GNU diffutils' );
907 
908  $diff3 = self::locateExecutableInDefaultPaths( $names, $versionInfo );
909 
910  if ( $diff3 ) {
911  $this->setVar( 'wgDiff3', $diff3 );
912  } else {
913  $this->setVar( 'wgDiff3', false );
914  $this->showMessage( 'config-diff3-bad' );
915  }
916 
917  return true;
918  }
919 
924  protected function envCheckGraphics() {
925  $names = array( wfIsWindows() ? 'convert.exe' : 'convert' );
926  $versionInfo = array( '$1 -version', 'ImageMagick' );
927  $convert = self::locateExecutableInDefaultPaths( $names, $versionInfo );
928 
929  $this->setVar( 'wgImageMagickConvertCommand', '' );
930  if ( $convert ) {
931  $this->setVar( 'wgImageMagickConvertCommand', $convert );
932  $this->showMessage( 'config-imagemagick', $convert );
933 
934  return true;
935  } elseif ( function_exists( 'imagejpeg' ) ) {
936  $this->showMessage( 'config-gd' );
937  } else {
938  $this->showMessage( 'config-no-scaling' );
939  }
940 
941  return true;
942  }
943 
950  protected function envCheckGit() {
951  $names = array( wfIsWindows() ? 'git.exe' : 'git' );
952  $versionInfo = array( '$1 --version', 'git version' );
953 
954  $git = self::locateExecutableInDefaultPaths( $names, $versionInfo );
955 
956  if ( $git ) {
957  $this->setVar( 'wgGitBin', $git );
958  $this->showMessage( 'config-git', $git );
959  } else {
960  $this->setVar( 'wgGitBin', false );
961  $this->showMessage( 'config-git-bad' );
962  }
963 
964  return true;
965  }
966 
970  protected function envCheckServer() {
971  $server = $this->envGetDefaultServer();
972  if ( $server !== null ) {
973  $this->showMessage( 'config-using-server', $server );
974  $this->setVar( 'wgServer', $server );
975  }
976 
977  return true;
978  }
979 
984  abstract protected function envGetDefaultServer();
985 
990  protected function envCheckPath() {
991  global $IP;
992  $IP = dirname( dirname( __DIR__ ) );
993  $this->setVar( 'IP', $IP );
994 
995  $this->showMessage(
996  'config-using-uri',
997  $this->getVar( 'wgServer' ),
998  $this->getVar( 'wgScriptPath' )
999  );
1000 
1001  return true;
1002  }
1003 
1008  protected function envCheckExtension() {
1009  // @todo FIXME: Detect this properly
1010  if ( defined( 'MW_INSTALL_PHP5_EXT' ) ) {
1011  $ext = 'php5';
1012  } else {
1013  $ext = 'php';
1014  }
1015  $this->setVar( 'wgScriptExtension', ".$ext" );
1016 
1017  return true;
1018  }
1019 
1024  protected function envCheckShellLocale() {
1025  $os = php_uname( 's' );
1026  $supported = array( 'Linux', 'SunOS', 'HP-UX', 'Darwin' ); # Tested these
1027 
1028  if ( !in_array( $os, $supported ) ) {
1029  return true;
1030  }
1031 
1032  # Get a list of available locales.
1033  $ret = false;
1034  $lines = wfShellExec( '/usr/bin/locale -a', $ret );
1035 
1036  if ( $ret ) {
1037  return true;
1038  }
1039 
1040  $lines = array_map( 'trim', explode( "\n", $lines ) );
1041  $candidatesByLocale = array();
1042  $candidatesByLang = array();
1043 
1044  foreach ( $lines as $line ) {
1045  if ( $line === '' ) {
1046  continue;
1047  }
1048 
1049  if ( !preg_match( '/^([a-zA-Z]+)(_[a-zA-Z]+|)\.(utf8|UTF-8)(@[a-zA-Z_]*|)$/i', $line, $m ) ) {
1050  continue;
1051  }
1052 
1053  list( , $lang, , , ) = $m;
1054 
1055  $candidatesByLocale[$m[0]] = $m;
1056  $candidatesByLang[$lang][] = $m;
1057  }
1058 
1059  # Try the current value of LANG.
1060  if ( isset( $candidatesByLocale[getenv( 'LANG' )] ) ) {
1061  $this->setVar( 'wgShellLocale', getenv( 'LANG' ) );
1062 
1063  return true;
1064  }
1065 
1066  # Try the most common ones.
1067  $commonLocales = array( 'en_US.UTF-8', 'en_US.utf8', 'de_DE.UTF-8', 'de_DE.utf8' );
1068  foreach ( $commonLocales as $commonLocale ) {
1069  if ( isset( $candidatesByLocale[$commonLocale] ) ) {
1070  $this->setVar( 'wgShellLocale', $commonLocale );
1071 
1072  return true;
1073  }
1074  }
1075 
1076  # Is there an available locale in the Wiki's language?
1077  $wikiLang = $this->getVar( 'wgLanguageCode' );
1078 
1079  if ( isset( $candidatesByLang[$wikiLang] ) ) {
1080  $m = reset( $candidatesByLang[$wikiLang] );
1081  $this->setVar( 'wgShellLocale', $m[0] );
1082 
1083  return true;
1084  }
1085 
1086  # Are there any at all?
1087  if ( count( $candidatesByLocale ) ) {
1088  $m = reset( $candidatesByLocale );
1089  $this->setVar( 'wgShellLocale', $m[0] );
1090 
1091  return true;
1092  }
1093 
1094  # Give up.
1095  return true;
1096  }
1097 
1102  protected function envCheckUploadsDirectory() {
1103  global $IP;
1104 
1105  $dir = $IP . '/images/';
1106  $url = $this->getVar( 'wgServer' ) . $this->getVar( 'wgScriptPath' ) . '/images/';
1107  $safe = !$this->dirIsExecutable( $dir, $url );
1108 
1109  if ( !$safe ) {
1110  $this->showMessage( 'config-uploads-not-safe', $dir );
1111  }
1112 
1113  return true;
1114  }
1115 
1121  protected function envCheckSuhosinMaxValueLength() {
1122  $maxValueLength = ini_get( 'suhosin.get.max_value_length' );
1123  if ( $maxValueLength > 0 && $maxValueLength < 1024 ) {
1124  // Only warn if the value is below the sane 1024
1125  $this->showMessage( 'config-suhosin-max-value-length', $maxValueLength );
1126  }
1127 
1128  return true;
1129  }
1130 
1136  protected function unicodeChar( $c ) {
1137  $c = hexdec( $c );
1138  if ( $c <= 0x7F ) {
1139  return chr( $c );
1140  } elseif ( $c <= 0x7FF ) {
1141  return chr( 0xC0 | $c >> 6 ) . chr( 0x80 | $c & 0x3F );
1142  } elseif ( $c <= 0xFFFF ) {
1143  return chr( 0xE0 | $c >> 12 ) . chr( 0x80 | $c >> 6 & 0x3F )
1144  . chr( 0x80 | $c & 0x3F );
1145  } elseif ( $c <= 0x10FFFF ) {
1146  return chr( 0xF0 | $c >> 18 ) . chr( 0x80 | $c >> 12 & 0x3F )
1147  . chr( 0x80 | $c >> 6 & 0x3F )
1148  . chr( 0x80 | $c & 0x3F );
1149  } else {
1150  return false;
1151  }
1152  }
1153 
1157  protected function envCheckLibicu() {
1158  $utf8 = function_exists( 'utf8_normalize' );
1159  $intl = function_exists( 'normalizer_normalize' );
1160 
1168  $not_normal_c = $this->unicodeChar( "FA6C" );
1169  $normal_c = $this->unicodeChar( "242EE" );
1170 
1171  $useNormalizer = 'php';
1172  $needsUpdate = false;
1173 
1178  if ( $utf8 ) {
1179  $useNormalizer = 'utf8';
1180  $utf8 = utf8_normalize( $not_normal_c, UtfNormal::UNORM_NFC );
1181  if ( $utf8 !== $normal_c ) {
1182  $needsUpdate = true;
1183  }
1184  }
1185  if ( $intl ) {
1186  $useNormalizer = 'intl';
1187  $intl = normalizer_normalize( $not_normal_c, Normalizer::FORM_C );
1188  if ( $intl !== $normal_c ) {
1189  $needsUpdate = true;
1190  }
1191  }
1192 
1193  // Uses messages 'config-unicode-using-php', 'config-unicode-using-utf8',
1194  // 'config-unicode-using-intl'
1195  if ( $useNormalizer === 'php' ) {
1196  $this->showMessage( 'config-unicode-pure-php-warning' );
1197  } else {
1198  $this->showMessage( 'config-unicode-using-' . $useNormalizer );
1199  if ( $needsUpdate ) {
1200  $this->showMessage( 'config-unicode-update-warning' );
1201  }
1202  }
1203  }
1204 
1208  protected function envCheckCtype() {
1209  if ( !function_exists( 'ctype_digit' ) ) {
1210  $this->showError( 'config-ctype' );
1211 
1212  return false;
1213  }
1214 
1215  return true;
1216  }
1217 
1221  protected function envCheckJSON() {
1222  if ( !function_exists( 'json_decode' ) ) {
1223  $this->showError( 'config-json' );
1225  return false;
1226  }
1227 
1228  return true;
1229  }
1230 
1238  protected static function getPossibleBinPaths() {
1239  return array_merge(
1240  array( '/usr/bin', '/usr/local/bin', '/opt/csw/bin',
1241  '/usr/gnu/bin', '/usr/sfw/bin', '/sw/bin', '/opt/local/bin' ),
1242  explode( PATH_SEPARATOR, getenv( 'PATH' ) )
1243  );
1244  }
1245 
1263  public static function locateExecutable( $path, $names, $versionInfo = false ) {
1264  if ( !is_array( $names ) ) {
1265  $names = array( $names );
1266  }
1267 
1268  foreach ( $names as $name ) {
1269  $command = $path . DIRECTORY_SEPARATOR . $name;
1270 
1272  $file_exists = file_exists( $command );
1274 
1275  if ( $file_exists ) {
1276  if ( !$versionInfo ) {
1277  return $command;
1278  }
1279 
1280  $file = str_replace( '$1', wfEscapeShellArg( $command ), $versionInfo[0] );
1281  if ( strstr( wfShellExec( $file ), $versionInfo[1] ) !== false ) {
1282  return $command;
1283  }
1284  }
1285  }
1286 
1287  return false;
1288  }
1289 
1302  public static function locateExecutableInDefaultPaths( $names, $versionInfo = false ) {
1303  foreach ( self::getPossibleBinPaths() as $path ) {
1304  $exe = self::locateExecutable( $path, $names, $versionInfo );
1305  if ( $exe !== false ) {
1306  return $exe;
1307  }
1308  }
1309 
1310  return false;
1311  }
1312 
1321  public function dirIsExecutable( $dir, $url ) {
1322  $scriptTypes = array(
1323  'php' => array(
1324  "<?php echo 'ex' . 'ec';",
1325  "#!/var/env php5\n<?php echo 'ex' . 'ec';",
1326  ),
1327  );
1328 
1329  // it would be good to check other popular languages here, but it'll be slow.
1330 
1332 
1333  foreach ( $scriptTypes as $ext => $contents ) {
1334  foreach ( $contents as $source ) {
1335  $file = 'exectest.' . $ext;
1336 
1337  if ( !file_put_contents( $dir . $file, $source ) ) {
1338  break;
1339  }
1340 
1341  try {
1342  $text = Http::get( $url . $file, array( 'timeout' => 3 ) );
1343  } catch ( MWException $e ) {
1344  // Http::get throws with allow_url_fopen = false and no curl extension.
1345  $text = null;
1346  }
1347  unlink( $dir . $file );
1348 
1349  if ( $text == 'exec' ) {
1351 
1352  return $ext;
1353  }
1354  }
1355  }
1356 
1358 
1359  return false;
1360  }
1361 
1368  public static function apacheModulePresent( $moduleName ) {
1369  if ( function_exists( 'apache_get_modules' ) && in_array( $moduleName, apache_get_modules() ) ) {
1370  return true;
1371  }
1372  // try it the hard way
1373  ob_start();
1374  phpinfo( INFO_MODULES );
1375  $info = ob_get_clean();
1376 
1377  return strpos( $info, $moduleName ) !== false;
1378  }
1379 
1385  public function setParserLanguage( $lang ) {
1386  $this->parserOptions->setTargetLanguage( $lang );
1387  $this->parserOptions->setUserLang( $lang );
1388  }
1389 
1395  protected function getDocUrl( $page ) {
1396  return "{$_SERVER['PHP_SELF']}?page=" . urlencode( $page );
1397  }
1398 
1405  public function findExtensions() {
1406  if ( $this->getVar( 'IP' ) === null ) {
1407  return array();
1408  }
1409 
1410  $extDir = $this->getVar( 'IP' ) . '/extensions';
1411  if ( !is_readable( $extDir ) || !is_dir( $extDir ) ) {
1412  return array();
1413  }
1414 
1415  $dh = opendir( $extDir );
1416  $exts = array();
1417  while ( ( $file = readdir( $dh ) ) !== false ) {
1418  if ( !is_dir( "$extDir/$file" ) ) {
1419  continue;
1420  }
1421  if ( file_exists( "$extDir/$file/$file.php" ) ) {
1422  $exts[] = $file;
1423  }
1424  }
1425  closedir( $dh );
1426  natcasesort( $exts );
1427 
1428  return $exts;
1429  }
1430 
1436  protected function includeExtensions() {
1437  global $IP;
1438  $exts = $this->getVar( '_Extensions' );
1439  $IP = $this->getVar( 'IP' );
1440 
1450  $wgAutoloadClasses = array();
1451 
1452  require "$IP/includes/DefaultSettings.php";
1453 
1454  foreach ( $exts as $e ) {
1455  require_once "$IP/extensions/$e/$e.php";
1456  }
1457 
1458  $hooksWeWant = isset( $wgHooks['LoadExtensionSchemaUpdates'] ) ?
1459  $wgHooks['LoadExtensionSchemaUpdates'] : array();
1460 
1461  // Unset everyone else's hooks. Lord knows what someone might be doing
1462  // in ParserFirstCallInit (see bug 27171)
1463  $GLOBALS['wgHooks'] = array( 'LoadExtensionSchemaUpdates' => $hooksWeWant );
1464 
1465  return Status::newGood();
1466  }
1467 
1480  protected function getInstallSteps( DatabaseInstaller $installer ) {
1481  $coreInstallSteps = array(
1482  array( 'name' => 'database', 'callback' => array( $installer, 'setupDatabase' ) ),
1483  array( 'name' => 'tables', 'callback' => array( $installer, 'createTables' ) ),
1484  array( 'name' => 'interwiki', 'callback' => array( $installer, 'populateInterwikiTable' ) ),
1485  array( 'name' => 'stats', 'callback' => array( $this, 'populateSiteStats' ) ),
1486  array( 'name' => 'keys', 'callback' => array( $this, 'generateKeys' ) ),
1487  array( 'name' => 'sysop', 'callback' => array( $this, 'createSysop' ) ),
1488  array( 'name' => 'mainpage', 'callback' => array( $this, 'createMainpage' ) ),
1489  );
1490 
1491  // Build the array of install steps starting from the core install list,
1492  // then adding any callbacks that wanted to attach after a given step
1493  foreach ( $coreInstallSteps as $step ) {
1494  $this->installSteps[] = $step;
1495  if ( isset( $this->extraInstallSteps[$step['name']] ) ) {
1496  $this->installSteps = array_merge(
1497  $this->installSteps,
1498  $this->extraInstallSteps[$step['name']]
1499  );
1500  }
1501  }
1502 
1503  // Prepend any steps that want to be at the beginning
1504  if ( isset( $this->extraInstallSteps['BEGINNING'] ) ) {
1505  $this->installSteps = array_merge(
1506  $this->extraInstallSteps['BEGINNING'],
1507  $this->installSteps
1508  );
1509  }
1510 
1511  // Extensions should always go first, chance to tie into hooks and such
1512  if ( count( $this->getVar( '_Extensions' ) ) ) {
1513  array_unshift( $this->installSteps,
1514  array( 'name' => 'extensions', 'callback' => array( $this, 'includeExtensions' ) )
1515  );
1516  $this->installSteps[] = array(
1517  'name' => 'extension-tables',
1518  'callback' => array( $installer, 'createExtensionTables' )
1519  );
1520  }
1521 
1522  return $this->installSteps;
1523  }
1524 
1533  public function performInstallation( $startCB, $endCB ) {
1534  $installResults = array();
1535  $installer = $this->getDBInstaller();
1536  $installer->preInstall();
1537  $steps = $this->getInstallSteps( $installer );
1538  foreach ( $steps as $stepObj ) {
1539  $name = $stepObj['name'];
1540  call_user_func_array( $startCB, array( $name ) );
1541 
1542  // Perform the callback step
1543  $status = call_user_func( $stepObj['callback'], $installer );
1544 
1545  // Output and save the results
1546  call_user_func( $endCB, $name, $status );
1547  $installResults[$name] = $status;
1548 
1549  // If we've hit some sort of fatal, we need to bail.
1550  // Callback already had a chance to do output above.
1551  if ( !$status->isOk() ) {
1552  break;
1553  }
1554  }
1555  if ( $status->isOk() ) {
1556  $this->setVar( '_InstallDone', true );
1557  }
1558 
1559  return $installResults;
1560  }
1561 
1567  public function generateKeys() {
1568  $keys = array( 'wgSecretKey' => 64 );
1569  if ( strval( $this->getVar( 'wgUpgradeKey' ) ) === '' ) {
1570  $keys['wgUpgradeKey'] = 16;
1571  }
1572 
1573  return $this->doGenerateKeys( $keys );
1574  }
1575 
1583  protected function doGenerateKeys( $keys ) {
1584  $status = Status::newGood();
1585 
1586  $strong = true;
1587  foreach ( $keys as $name => $length ) {
1588  $secretKey = MWCryptRand::generateHex( $length, true );
1589  if ( !MWCryptRand::wasStrong() ) {
1590  $strong = false;
1591  }
1592 
1593  $this->setVar( $name, $secretKey );
1594  }
1595 
1596  if ( !$strong ) {
1597  $names = array_keys( $keys );
1598  $names = preg_replace( '/^(.*)$/', '\$$1', $names );
1599  global $wgLang;
1600  $status->warning( 'config-insecure-keys', $wgLang->listToText( $names ), count( $names ) );
1601  }
1602 
1603  return $status;
1604  }
1605 
1611  protected function createSysop() {
1612  $name = $this->getVar( '_AdminName' );
1613  $user = User::newFromName( $name );
1614 
1615  if ( !$user ) {
1616  // We should've validated this earlier anyway!
1617  return Status::newFatal( 'config-admin-error-user', $name );
1618  }
1619 
1620  if ( $user->idForName() == 0 ) {
1621  $user->addToDatabase();
1622 
1623  try {
1624  $user->setPassword( $this->getVar( '_AdminPassword' ) );
1625  } catch ( PasswordError $pwe ) {
1626  return Status::newFatal( 'config-admin-error-password', $name, $pwe->getMessage() );
1627  }
1628 
1629  $user->addGroup( 'sysop' );
1630  $user->addGroup( 'bureaucrat' );
1631  if ( $this->getVar( '_AdminEmail' ) ) {
1632  $user->setEmail( $this->getVar( '_AdminEmail' ) );
1633  }
1634  $user->saveSettings();
1635 
1636  // Update user count
1637  $ssUpdate = new SiteStatsUpdate( 0, 0, 0, 0, 1 );
1638  $ssUpdate->doUpdate();
1639  }
1640  $status = Status::newGood();
1641 
1642  if ( $this->getVar( '_Subscribe' ) && $this->getVar( '_AdminEmail' ) ) {
1643  $this->subscribeToMediaWikiAnnounce( $status );
1644  }
1645 
1646  return $status;
1647  }
1648 
1652  private function subscribeToMediaWikiAnnounce( Status $s ) {
1653  $params = array(
1654  'email' => $this->getVar( '_AdminEmail' ),
1655  'language' => 'en',
1656  'digest' => 0
1657  );
1658 
1659  // Mailman doesn't support as many languages as we do, so check to make
1660  // sure their selected language is available
1661  $myLang = $this->getVar( '_UserLang' );
1662  if ( in_array( $myLang, $this->mediaWikiAnnounceLanguages ) ) {
1663  $myLang = $myLang == 'pt-br' ? 'pt_BR' : $myLang; // rewrite to Mailman's pt_BR
1664  $params['language'] = $myLang;
1665  }
1666 
1668  $res = MWHttpRequest::factory( $this->mediaWikiAnnounceUrl,
1669  array( 'method' => 'POST', 'postData' => $params ) )->execute();
1670  if ( !$res->isOK() ) {
1671  $s->warning( 'config-install-subscribe-fail', $res->getMessage() );
1672  }
1673  } else {
1674  $s->warning( 'config-install-subscribe-notpossible' );
1675  }
1676  }
1677 
1684  protected function createMainpage( DatabaseInstaller $installer ) {
1685  $status = Status::newGood();
1686  try {
1688  $content = new WikitextContent(
1689  wfMessage( 'mainpagetext' )->inContentLanguage()->text() . "\n\n" .
1690  wfMessage( 'mainpagedocfooter' )->inContentLanguage()->text()
1691  );
1692 
1693  $page->doEditContent( $content,
1694  '',
1695  EDIT_NEW,
1696  false,
1697  User::newFromName( 'MediaWiki default' )
1698  );
1699  } catch ( MWException $e ) {
1700  //using raw, because $wgShowExceptionDetails can not be set yet
1701  $status->fatal( 'config-install-mainpage-failed', $e->getMessage() );
1702  }
1703 
1704  return $status;
1705  }
1706 
1710  public static function overrideConfig() {
1711  define( 'MW_NO_SESSION', 1 );
1712 
1713  // Don't access the database
1714  $GLOBALS['wgUseDatabaseMessages'] = false;
1715  // Don't cache langconv tables
1716  $GLOBALS['wgLanguageConverterCacheType'] = CACHE_NONE;
1717  // Debug-friendly
1718  $GLOBALS['wgShowExceptionDetails'] = true;
1719  // Don't break forms
1720  $GLOBALS['wgExternalLinkTarget'] = '_blank';
1721 
1722  // Extended debugging
1723  $GLOBALS['wgShowSQLErrors'] = true;
1724  $GLOBALS['wgShowDBErrorBacktrace'] = true;
1725 
1726  // Allow multiple ob_flush() calls
1727  $GLOBALS['wgDisableOutputCompression'] = true;
1728 
1729  // Use a sensible cookie prefix (not my_wiki)
1730  $GLOBALS['wgCookiePrefix'] = 'mw_installer';
1731 
1732  // Some of the environment checks make shell requests, remove limits
1733  $GLOBALS['wgMaxShellMemory'] = 0;
1735  // Don't bother embedding images into generated CSS, which is not cached
1736  $GLOBALS['wgResourceLoaderLESSFunctions']['embeddable'] = function ( $frame, $less ) {
1737  return $less->toBool( false );
1738  };
1739  }
1740 
1748  public function addInstallStep( $callback, $findStep = 'BEGINNING' ) {
1749  $this->extraInstallSteps[$findStep][] = $callback;
1750  }
1751 
1756  protected function disableTimeLimit() {
1758  set_time_limit( 0 );
1760  }
1761 }
Installer\envCheckBrokenXML
envCheckBrokenXML()
Some versions of libxml+PHP break < and > encoding horribly.
Definition: Installer.php:720
ParserOptions
Set options of the Parser.
Definition: ParserOptions.php:31
$wgUser
$wgUser
Definition: Setup.php:572
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:412
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:2851
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:1670
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:594
$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:1307
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:1143
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:994
Installer\envCheckCtype
envCheckCtype()
Definition: Installer.php:1194
Installer\populateSiteStats
populateSiteStats(DatabaseInstaller $installer)
Install step which adds a row to the site_stats table with appropriate initial values.
Definition: Installer.php:635
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:1010
$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:2434
Installer\envCheckMbstring
envCheckMbstring()
Environment check for mbstring.func_overload.
Definition: Installer.php:763
Installer\envCheckUploadsDirectory
envCheckUploadsDirectory()
Environment check for the permissions of the uploads directory.
Definition: Installer.php:1088
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:1519
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:389
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:1371
$wgHooks
$wgHooks['ArticleShow'][]
Definition: hooks.txt:110
Installer\addInstallStep
addInstallStep( $callback, $findStep='BEGINNING')
Add an installation step following the given step.
Definition: Installer.php:1734
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:546
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:1288
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:1696
Installer\createSysop
createSysop()
Create the first user account, grant it sysop and bureaucrat rights.
Definition: Installer.php:1597
Installer\getFakePassword
getFakePassword( $realPassword)
Get a fake password for sending back to the user in HTML.
Definition: Installer.php:535
$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:1107
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:1224
$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:710
wfRestoreWarnings
wfRestoreWarnings()
Restore error level to previous value.
Definition: GlobalFunctions.php:2464
Installer\envCheckDiff3
envCheckDiff3()
Search for GNU diff3.
Definition: Installer.php:890
Installer\envCheckMagicQuotes
envCheckMagicQuotes()
Environment check for magic_quotes_runtime.
Definition: Installer.php:735
Installer\envCheckJSON
envCheckJSON()
Definition: Installer.php:1207
Installer\generateKeys
generateKeys()
Generate $wgSecretKey.
Definition: Installer.php:1553
Installer\envCheckMagicSybase
envCheckMagicSybase()
Environment check for magic_quotes_sybase.
Definition: Installer.php:749
Installer\envCheckMemory
envCheckMemory()
Environment check for available memory.
Definition: Installer.php:830
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:660
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:856
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:976
Installer\doGenerateKeys
doGenerateKeys( $keys)
Generate a secret value for variables using our CryptRand generator.
Definition: Installer.php:1569
$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:622
Installer\envCheckXML
envCheckXML()
Environment check for the XML module.
Definition: Installer.php:790
Http\get
static get( $url, $timeout='default', $options=array())
Simple wrapper for Http::request( 'GET' )
Definition: HttpFunctions.php:99
$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:2571
wfEscapeShellArg
wfEscapeShellArg()
Windows-compatible version of escapeshellarg() Windows doesn't recognise single-quotes in the shell,...
Definition: GlobalFunctions.php:2752
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:672
Installer\getInstallSteps
getInstallSteps(DatabaseInstaller $installer)
Get an array of install steps.
Definition: Installer.php:1466
$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:2732
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:910
wfShorthandToInteger
wfShorthandToInteger( $string='', $default=-1)
Converts shorthand byte notation to integer form.
Definition: GlobalFunctions.php:3954
Installer\apacheModulePresent
static apacheModulePresent( $moduleName)
Checks for presence of an Apache module.
Definition: Installer.php:1354
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:808
$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:587
$dir
if(count( $args)==0) $dir
Definition: importImages.php:49
$ext
$ext
Definition: NoLocalSettings.php:34
Installer\getParserOptions
getParserOptions()
Definition: Installer.php:614
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:278
$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:1742
$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:1391
$source
if(PHP_SAPI !='cli') $source
Definition: mwdoc-filter.php:18
Installer\envCheckServer
envCheckServer()
Environment check for the server hostname.
Definition: Installer.php:956
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:618
Installer\envCheckSafeMode
envCheckSafeMode()
Environment check for safe_mode.
Definition: Installer.php:777
Installer\$mediaWikiAnnounceUrl
$mediaWikiAnnounceUrl
URL to mediawiki-announce subscription.
Definition: Installer.php:301
$IP
$IP
Definition: WebStart.php:92
Installer\includeExtensions
includeExtensions()
Installs the auto-detected extensions.
Definition: Installer.php:1422
$res
$res
Definition: database.txt:21
MWHttpRequest\factory
static factory( $url, $options=null)
Generate a new request object.
Definition: HttpFunctions.php:290
Installer\envCheckGit
envCheckGit()
Search for git.
Definition: Installer.php:936
Installer\getDocUrl
getDocUrl( $page)
Overridden by WebInstaller to provide lastPage parameters.
Definition: Installer.php:1381
$GLOBALS
$GLOBALS['IP']
Definition: ComposerHookHandler.php:6
Installer\subscribeToMediaWikiAnnounce
subscribeToMediaWikiAnnounce(Status $s)
Definition: Installer.php:1638
Installer\unicodeChar
unicodeChar( $c)
Convert a hex string representing a Unicode code point to that code point.
Definition: Installer.php:1122
Installer\maybeGetWebserverPrimaryGroup
static maybeGetWebserverPrimaryGroup()
On POSIX systems return the primary group of the webserver we're running under.
Definition: Installer.php:563
$e
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
Definition: hooks.txt:1632
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:878
Installer\locateExecutable
static locateExecutable( $path, $names, $versionInfo=false)
Search a path for any of the given executable names.
Definition: Installer.php:1249