MediaWiki  1.23.15
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  $this->compiledDBs = array();
371  foreach ( self::getDBTypes() as $type ) {
372  $installer = $this->getDBInstaller( $type );
373 
374  if ( !$installer->isCompiled() ) {
375  continue;
376  }
377  $this->compiledDBs[] = $type;
378  }
379 
380  $this->parserTitle = Title::newFromText( 'Installer' );
381  $this->parserOptions = new ParserOptions; // language will be wrong :(
382  $this->parserOptions->setEditSection( false );
383  }
384 
390  public static function getDBTypes() {
391  return self::$dbTypes;
392  }
393 
407  public function doEnvironmentChecks() {
408  $phpVersion = phpversion();
409  if ( version_compare( $phpVersion, self::MINIMUM_PHP_VERSION, '>=' ) ) {
410  $this->showMessage( 'config-env-php', $phpVersion );
411  $good = true;
412  } else {
413  $this->showMessage( 'config-env-php-toolow', $phpVersion, self::MINIMUM_PHP_VERSION );
414  $good = false;
415  }
416 
417  // Must go here because an old version of PCRE can prevent other checks from completing
418  if ( $good ) {
419  list( $pcreVersion ) = explode( ' ', PCRE_VERSION, 2 );
420  if ( version_compare( $pcreVersion, self::MINIMUM_PCRE_VERSION, '<' ) ) {
421  $this->showError( 'config-pcre-old', self::MINIMUM_PCRE_VERSION, $pcreVersion );
422  $good = false;
423  }
424  }
425 
426  if ( $good ) {
427  foreach ( $this->envChecks as $check ) {
428  $status = $this->$check();
429  if ( $status === false ) {
430  $good = false;
431  }
432  }
433  }
434 
435  $this->setVar( '_Environment', $good );
436 
437  return $good ? Status::newGood() : Status::newFatal( 'config-env-bad' );
438  }
439 
446  public function setVar( $name, $value ) {
447  $this->settings[$name] = $value;
448  }
449 
460  public function getVar( $name, $default = null ) {
461  if ( !isset( $this->settings[$name] ) ) {
462  return $default;
463  } else {
464  return $this->settings[$name];
465  }
466  }
467 
473  public function getCompiledDBs() {
474  return $this->compiledDBs;
475  }
476 
484  public function getDBInstaller( $type = false ) {
485  if ( !$type ) {
486  $type = $this->getVar( 'wgDBtype' );
487  }
488 
489  $type = strtolower( $type );
490 
491  if ( !isset( $this->dbInstallers[$type] ) ) {
492  $class = ucfirst( $type ) . 'Installer';
493  $this->dbInstallers[$type] = new $class( $this );
494  }
495 
496  return $this->dbInstallers[$type];
497  }
498 
504  public static function getExistingLocalSettings() {
505  global $IP;
506 
507  // You might be wondering why this is here. Well if you don't do this
508  // then some poorly-formed extensions try to call their own classes
509  // after immediately registering them. We really need to get extension
510  // registration out of the global scope and into a real format.
511  // @see https://bugzilla.wikimedia.org/67440
513 
515  $_lsExists = file_exists( "$IP/LocalSettings.php" );
517 
518  if ( !$_lsExists ) {
519  return false;
520  }
521  unset( $_lsExists );
522 
523  require "$IP/includes/DefaultSettings.php";
524  require "$IP/LocalSettings.php";
525 
526  return get_defined_vars();
527  }
528 
538  public function getFakePassword( $realPassword ) {
539  return str_repeat( '*', strlen( $realPassword ) );
540  }
541 
549  public function setPassword( $name, $value ) {
550  if ( !preg_match( '/^\*+$/', $value ) ) {
551  $this->setVar( $name, $value );
552  }
553  }
554 
566  public static function maybeGetWebserverPrimaryGroup() {
567  if ( !function_exists( 'posix_getegid' ) || !function_exists( 'posix_getpwuid' ) ) {
568  # I don't know this, this isn't UNIX.
569  return null;
570  }
571 
572  # posix_getegid() *not* getmygid() because we want the group of the webserver,
573  # not whoever owns the current script.
574  $gid = posix_getegid();
575  $getpwuid = posix_getpwuid( $gid );
576  $group = $getpwuid['name'];
577 
578  return $group;
579  }
580 
597  public function parse( $text, $lineStart = false ) {
599 
600  try {
601  $out = $wgParser->parse( $text, $this->parserTitle, $this->parserOptions, $lineStart );
602  $html = $out->getText();
603  } catch ( DBAccessError $e ) {
604  $html = '<!--DB access attempted during parse--> ' . htmlspecialchars( $text );
605 
606  if ( !empty( $this->debug ) ) {
607  $html .= "<!--\n" . $e->getTraceAsString() . "\n-->";
608  }
609  }
610 
611  return $html;
612  }
613 
617  public function getParserOptions() {
618  return $this->parserOptions;
619  }
620 
621  public function disableLinkPopups() {
622  $this->parserOptions->setExternalLinkTarget( false );
623  }
624 
625  public function restoreLinkPopups() {
626  global $wgExternalLinkTarget;
627  $this->parserOptions->setExternalLinkTarget( $wgExternalLinkTarget );
628  }
629 
638  public function populateSiteStats( DatabaseInstaller $installer ) {
639  $status = $installer->getConnection();
640  if ( !$status->isOK() ) {
641  return $status;
642  }
643  $status->value->insert(
644  'site_stats',
645  array(
646  'ss_row_id' => 1,
647  'ss_total_views' => 0,
648  'ss_total_edits' => 0,
649  'ss_good_articles' => 0,
650  'ss_total_pages' => 0,
651  'ss_users' => 0,
652  'ss_images' => 0
653  ),
654  __METHOD__, 'IGNORE'
655  );
656 
657  return Status::newGood();
658  }
659 
663  public function exportVars() {
664  foreach ( $this->settings as $name => $value ) {
665  if ( substr( $name, 0, 2 ) == 'wg' ) {
666  $GLOBALS[$name] = $value;
667  }
668  }
669  }
670 
675  protected function envCheckDB() {
676  global $wgLang;
677 
678  $allNames = array();
679 
680  // Messages: config-type-mysql, config-type-postgres, config-type-oracle,
681  // config-type-sqlite
682  foreach ( self::getDBTypes() as $name ) {
683  $allNames[] = wfMessage( "config-type-$name" )->text();
684  }
685 
686  $databases = $this->getCompiledDBs();
687 
688  $databases = array_flip( $databases );
689  foreach ( array_keys( $databases ) as $db ) {
690  $installer = $this->getDBInstaller( $db );
691  $status = $installer->checkPrerequisites();
692  if ( !$status->isGood() ) {
693  $this->showStatusMessage( $status );
694  }
695  if ( !$status->isOK() ) {
696  unset( $databases[$db] );
697  }
698  }
699  $databases = array_flip( $databases );
700  if ( !$databases ) {
701  $this->showError( 'config-no-db', $wgLang->commaList( $allNames ) );
702 
703  // @todo FIXME: This only works for the web installer!
704  return false;
705  }
706 
707  return true;
708  }
709 
713  protected function envCheckRegisterGlobals() {
714  if ( wfIniGetBool( 'register_globals' ) ) {
715  $this->showMessage( 'config-register-globals' );
716  }
717  }
718 
723  protected function envCheckBrokenXML() {
725  if ( !$test->ok ) {
726  $this->showError( 'config-brokenlibxml' );
727 
728  return false;
729  }
730 
731  return true;
732  }
733 
738  protected function envCheckMagicQuotes() {
739  if ( wfIniGetBool( "magic_quotes_runtime" ) ) {
740  $this->showError( 'config-magic-quotes-runtime' );
741 
742  return false;
743  }
744 
745  return true;
746  }
747 
752  protected function envCheckMagicSybase() {
753  if ( wfIniGetBool( 'magic_quotes_sybase' ) ) {
754  $this->showError( 'config-magic-quotes-sybase' );
755 
756  return false;
757  }
758 
759  return true;
760  }
761 
766  protected function envCheckMbstring() {
767  if ( wfIniGetBool( 'mbstring.func_overload' ) ) {
768  $this->showError( 'config-mbstring' );
769 
770  return false;
771  }
772 
773  return true;
774  }
775 
780  protected function envCheckSafeMode() {
781  if ( wfIniGetBool( 'safe_mode' ) ) {
782  $this->setVar( '_SafeMode', true );
783  $this->showMessage( 'config-safe-mode' );
784  }
785 
786  return true;
787  }
788 
793  protected function envCheckXML() {
794  if ( !function_exists( "utf8_encode" ) ) {
795  $this->showError( 'config-xml-bad' );
796 
797  return false;
798  }
799 
800  return true;
801  }
802 
811  protected function envCheckPCRE() {
813  $regexd = preg_replace( '/[\x{0430}-\x{04FF}]/iu', '', '-АБВГД-' );
814  // Need to check for \p support too, as PCRE can be compiled
815  // with utf8 support, but not unicode property support.
816  // check that \p{Zs} (space separators) matches
817  // U+3000 (Ideographic space)
818  $regexprop = preg_replace( '/\p{Zs}/u', '', "-\xE3\x80\x80-" );
820  if ( $regexd != '--' || $regexprop != '--' ) {
821  $this->showError( 'config-pcre-no-utf8' );
822 
823  return false;
824  }
825 
826  return true;
827  }
828 
833  protected function envCheckMemory() {
834  $limit = ini_get( 'memory_limit' );
835 
836  if ( !$limit || $limit == -1 ) {
837  return true;
838  }
839 
841 
842  if ( $n < $this->minMemorySize * 1024 * 1024 ) {
843  $newLimit = "{$this->minMemorySize}M";
844 
845  if ( ini_set( "memory_limit", $newLimit ) === false ) {
846  $this->showMessage( 'config-memory-bad', $limit );
847  } else {
848  $this->showMessage( 'config-memory-raised', $limit, $newLimit );
849  $this->setVar( '_RaiseMemory', true );
850  }
851  }
852 
853  return true;
854  }
855 
859  protected function envCheckCache() {
860  $caches = array();
861  foreach ( $this->objectCaches as $name => $function ) {
862  if ( function_exists( $function ) ) {
863  if ( $name == 'xcache' && !wfIniGetBool( 'xcache.var_size' ) ) {
864  continue;
865  }
866  $caches[$name] = true;
867  }
868  }
869 
870  if ( !$caches ) {
871  $this->showMessage( 'config-no-cache' );
872  }
873 
874  $this->setVar( '_Caches', $caches );
875  }
876 
881  protected function envCheckModSecurity() {
882  if ( self::apacheModulePresent( 'mod_security' ) ) {
883  $this->showMessage( 'config-mod-security' );
884  }
885 
886  return true;
887  }
888 
893  protected function envCheckDiff3() {
894  $names = array( "gdiff3", "diff3", "diff3.exe" );
895  $versionInfo = array( '$1 --version 2>&1', 'GNU diffutils' );
896 
897  $diff3 = self::locateExecutableInDefaultPaths( $names, $versionInfo );
898 
899  if ( $diff3 ) {
900  $this->setVar( 'wgDiff3', $diff3 );
901  } else {
902  $this->setVar( 'wgDiff3', false );
903  $this->showMessage( 'config-diff3-bad' );
904  }
905 
906  return true;
907  }
908 
913  protected function envCheckGraphics() {
914  $names = array( wfIsWindows() ? 'convert.exe' : 'convert' );
915  $versionInfo = array( '$1 -version', 'ImageMagick' );
916  $convert = self::locateExecutableInDefaultPaths( $names, $versionInfo );
917 
918  $this->setVar( 'wgImageMagickConvertCommand', '' );
919  if ( $convert ) {
920  $this->setVar( 'wgImageMagickConvertCommand', $convert );
921  $this->showMessage( 'config-imagemagick', $convert );
922 
923  return true;
924  } elseif ( function_exists( 'imagejpeg' ) ) {
925  $this->showMessage( 'config-gd' );
926  } else {
927  $this->showMessage( 'config-no-scaling' );
928  }
929 
930  return true;
931  }
932 
939  protected function envCheckGit() {
940  $names = array( wfIsWindows() ? 'git.exe' : 'git' );
941  $versionInfo = array( '$1 --version', 'git version' );
942 
943  $git = self::locateExecutableInDefaultPaths( $names, $versionInfo );
944 
945  if ( $git ) {
946  $this->setVar( 'wgGitBin', $git );
947  $this->showMessage( 'config-git', $git );
948  } else {
949  $this->setVar( 'wgGitBin', false );
950  $this->showMessage( 'config-git-bad' );
951  }
952 
953  return true;
954  }
955 
959  protected function envCheckServer() {
960  $server = $this->envGetDefaultServer();
961  if ( $server !== null ) {
962  $this->showMessage( 'config-using-server', $server );
963  $this->setVar( 'wgServer', $server );
964  }
965 
966  return true;
967  }
968 
973  abstract protected function envGetDefaultServer();
974 
979  protected function envCheckPath() {
980  global $IP;
981  $IP = dirname( dirname( __DIR__ ) );
982  $this->setVar( 'IP', $IP );
983 
984  $this->showMessage(
985  'config-using-uri',
986  $this->getVar( 'wgServer' ),
987  $this->getVar( 'wgScriptPath' )
988  );
989 
990  return true;
991  }
992 
997  protected function envCheckExtension() {
998  // @todo FIXME: Detect this properly
999  if ( defined( 'MW_INSTALL_PHP5_EXT' ) ) {
1000  $ext = 'php5';
1001  } else {
1002  $ext = 'php';
1003  }
1004  $this->setVar( 'wgScriptExtension', ".$ext" );
1005 
1006  return true;
1007  }
1008 
1013  protected function envCheckShellLocale() {
1014  $os = php_uname( 's' );
1015  $supported = array( 'Linux', 'SunOS', 'HP-UX', 'Darwin' ); # Tested these
1016 
1017  if ( !in_array( $os, $supported ) ) {
1018  return true;
1019  }
1020 
1021  # Get a list of available locales.
1022  $ret = false;
1023  $lines = wfShellExec( '/usr/bin/locale -a', $ret );
1024 
1025  if ( $ret ) {
1026  return true;
1027  }
1028 
1029  $lines = array_map( 'trim', explode( "\n", $lines ) );
1030  $candidatesByLocale = array();
1031  $candidatesByLang = array();
1032 
1033  foreach ( $lines as $line ) {
1034  if ( $line === '' ) {
1035  continue;
1036  }
1037 
1038  if ( !preg_match( '/^([a-zA-Z]+)(_[a-zA-Z]+|)\.(utf8|UTF-8)(@[a-zA-Z_]*|)$/i', $line, $m ) ) {
1039  continue;
1040  }
1041 
1042  list( , $lang, , , ) = $m;
1043 
1044  $candidatesByLocale[$m[0]] = $m;
1045  $candidatesByLang[$lang][] = $m;
1046  }
1047 
1048  # Try the current value of LANG.
1049  if ( isset( $candidatesByLocale[getenv( 'LANG' )] ) ) {
1050  $this->setVar( 'wgShellLocale', getenv( 'LANG' ) );
1051 
1052  return true;
1053  }
1054 
1055  # Try the most common ones.
1056  $commonLocales = array( 'en_US.UTF-8', 'en_US.utf8', 'de_DE.UTF-8', 'de_DE.utf8' );
1057  foreach ( $commonLocales as $commonLocale ) {
1058  if ( isset( $candidatesByLocale[$commonLocale] ) ) {
1059  $this->setVar( 'wgShellLocale', $commonLocale );
1060 
1061  return true;
1062  }
1063  }
1064 
1065  # Is there an available locale in the Wiki's language?
1066  $wikiLang = $this->getVar( 'wgLanguageCode' );
1067 
1068  if ( isset( $candidatesByLang[$wikiLang] ) ) {
1069  $m = reset( $candidatesByLang[$wikiLang] );
1070  $this->setVar( 'wgShellLocale', $m[0] );
1071 
1072  return true;
1073  }
1074 
1075  # Are there any at all?
1076  if ( count( $candidatesByLocale ) ) {
1077  $m = reset( $candidatesByLocale );
1078  $this->setVar( 'wgShellLocale', $m[0] );
1079 
1080  return true;
1081  }
1082 
1083  # Give up.
1084  return true;
1085  }
1086 
1091  protected function envCheckUploadsDirectory() {
1092  global $IP;
1093 
1094  $dir = $IP . '/images/';
1095  $url = $this->getVar( 'wgServer' ) . $this->getVar( 'wgScriptPath' ) . '/images/';
1096  $safe = !$this->dirIsExecutable( $dir, $url );
1097 
1098  if ( !$safe ) {
1099  $this->showMessage( 'config-uploads-not-safe', $dir );
1100  }
1101 
1102  return true;
1103  }
1104 
1110  protected function envCheckSuhosinMaxValueLength() {
1111  $maxValueLength = ini_get( 'suhosin.get.max_value_length' );
1112  if ( $maxValueLength > 0 && $maxValueLength < 1024 ) {
1113  // Only warn if the value is below the sane 1024
1114  $this->showMessage( 'config-suhosin-max-value-length', $maxValueLength );
1115  }
1116 
1117  return true;
1118  }
1119 
1125  protected function unicodeChar( $c ) {
1126  $c = hexdec( $c );
1127  if ( $c <= 0x7F ) {
1128  return chr( $c );
1129  } elseif ( $c <= 0x7FF ) {
1130  return chr( 0xC0 | $c >> 6 ) . chr( 0x80 | $c & 0x3F );
1131  } elseif ( $c <= 0xFFFF ) {
1132  return chr( 0xE0 | $c >> 12 ) . chr( 0x80 | $c >> 6 & 0x3F )
1133  . chr( 0x80 | $c & 0x3F );
1134  } elseif ( $c <= 0x10FFFF ) {
1135  return chr( 0xF0 | $c >> 18 ) . chr( 0x80 | $c >> 12 & 0x3F )
1136  . chr( 0x80 | $c >> 6 & 0x3F )
1137  . chr( 0x80 | $c & 0x3F );
1138  } else {
1139  return false;
1140  }
1141  }
1142 
1146  protected function envCheckLibicu() {
1147  $utf8 = function_exists( 'utf8_normalize' );
1148  $intl = function_exists( 'normalizer_normalize' );
1149 
1157  $not_normal_c = $this->unicodeChar( "FA6C" );
1158  $normal_c = $this->unicodeChar( "242EE" );
1159 
1160  $useNormalizer = 'php';
1161  $needsUpdate = false;
1162 
1167  if ( $utf8 ) {
1168  $useNormalizer = 'utf8';
1169  $utf8 = utf8_normalize( $not_normal_c, UtfNormal::UNORM_NFC );
1170  if ( $utf8 !== $normal_c ) {
1171  $needsUpdate = true;
1172  }
1173  }
1174  if ( $intl ) {
1175  $useNormalizer = 'intl';
1176  $intl = normalizer_normalize( $not_normal_c, Normalizer::FORM_C );
1177  if ( $intl !== $normal_c ) {
1178  $needsUpdate = true;
1179  }
1180  }
1181 
1182  // Uses messages 'config-unicode-using-php', 'config-unicode-using-utf8',
1183  // 'config-unicode-using-intl'
1184  if ( $useNormalizer === 'php' ) {
1185  $this->showMessage( 'config-unicode-pure-php-warning' );
1186  } else {
1187  $this->showMessage( 'config-unicode-using-' . $useNormalizer );
1188  if ( $needsUpdate ) {
1189  $this->showMessage( 'config-unicode-update-warning' );
1190  }
1191  }
1192  }
1193 
1197  protected function envCheckCtype() {
1198  if ( !function_exists( 'ctype_digit' ) ) {
1199  $this->showError( 'config-ctype' );
1200 
1201  return false;
1202  }
1203 
1204  return true;
1205  }
1206 
1210  protected function envCheckJSON() {
1211  if ( !function_exists( 'json_decode' ) ) {
1212  $this->showError( 'config-json' );
1214  return false;
1215  }
1216 
1217  return true;
1218  }
1219 
1227  protected static function getPossibleBinPaths() {
1228  return array_merge(
1229  array( '/usr/bin', '/usr/local/bin', '/opt/csw/bin',
1230  '/usr/gnu/bin', '/usr/sfw/bin', '/sw/bin', '/opt/local/bin' ),
1231  explode( PATH_SEPARATOR, getenv( 'PATH' ) )
1232  );
1233  }
1234 
1252  public static function locateExecutable( $path, $names, $versionInfo = false ) {
1253  if ( !is_array( $names ) ) {
1254  $names = array( $names );
1255  }
1256 
1257  foreach ( $names as $name ) {
1258  $command = $path . DIRECTORY_SEPARATOR . $name;
1259 
1261  $file_exists = file_exists( $command );
1263 
1264  if ( $file_exists ) {
1265  if ( !$versionInfo ) {
1266  return $command;
1267  }
1268 
1269  $file = str_replace( '$1', wfEscapeShellArg( $command ), $versionInfo[0] );
1270  if ( strstr( wfShellExec( $file ), $versionInfo[1] ) !== false ) {
1271  return $command;
1272  }
1273  }
1274  }
1275 
1276  return false;
1277  }
1278 
1291  public static function locateExecutableInDefaultPaths( $names, $versionInfo = false ) {
1292  foreach ( self::getPossibleBinPaths() as $path ) {
1293  $exe = self::locateExecutable( $path, $names, $versionInfo );
1294  if ( $exe !== false ) {
1295  return $exe;
1296  }
1297  }
1298 
1299  return false;
1300  }
1301 
1310  public function dirIsExecutable( $dir, $url ) {
1311  $scriptTypes = array(
1312  'php' => array(
1313  "<?php echo 'ex' . 'ec';",
1314  "#!/var/env php5\n<?php echo 'ex' . 'ec';",
1315  ),
1316  );
1317 
1318  // it would be good to check other popular languages here, but it'll be slow.
1319 
1321 
1322  foreach ( $scriptTypes as $ext => $contents ) {
1323  foreach ( $contents as $source ) {
1324  $file = 'exectest.' . $ext;
1325 
1326  if ( !file_put_contents( $dir . $file, $source ) ) {
1327  break;
1328  }
1329 
1330  try {
1331  $text = Http::get( $url . $file, array( 'timeout' => 3 ) );
1332  } catch ( MWException $e ) {
1333  // Http::get throws with allow_url_fopen = false and no curl extension.
1334  $text = null;
1335  }
1336  unlink( $dir . $file );
1337 
1338  if ( $text == 'exec' ) {
1340 
1341  return $ext;
1342  }
1343  }
1344  }
1345 
1347 
1348  return false;
1349  }
1350 
1357  public static function apacheModulePresent( $moduleName ) {
1358  if ( function_exists( 'apache_get_modules' ) && in_array( $moduleName, apache_get_modules() ) ) {
1359  return true;
1360  }
1361  // try it the hard way
1362  ob_start();
1363  phpinfo( INFO_MODULES );
1364  $info = ob_get_clean();
1365 
1366  return strpos( $info, $moduleName ) !== false;
1367  }
1368 
1374  public function setParserLanguage( $lang ) {
1375  $this->parserOptions->setTargetLanguage( $lang );
1376  $this->parserOptions->setUserLang( $lang );
1377  }
1378 
1384  protected function getDocUrl( $page ) {
1385  return "{$_SERVER['PHP_SELF']}?page=" . urlencode( $page );
1386  }
1387 
1394  public function findExtensions() {
1395  if ( $this->getVar( 'IP' ) === null ) {
1396  return array();
1397  }
1398 
1399  $extDir = $this->getVar( 'IP' ) . '/extensions';
1400  if ( !is_readable( $extDir ) || !is_dir( $extDir ) ) {
1401  return array();
1402  }
1403 
1404  $dh = opendir( $extDir );
1405  $exts = array();
1406  while ( ( $file = readdir( $dh ) ) !== false ) {
1407  if ( !is_dir( "$extDir/$file" ) ) {
1408  continue;
1409  }
1410  if ( file_exists( "$extDir/$file/$file.php" ) ) {
1411  $exts[] = $file;
1412  }
1413  }
1414  closedir( $dh );
1415  natcasesort( $exts );
1416 
1417  return $exts;
1418  }
1419 
1425  protected function includeExtensions() {
1426  global $IP;
1427  $exts = $this->getVar( '_Extensions' );
1428  $IP = $this->getVar( 'IP' );
1429 
1439  $wgAutoloadClasses = array();
1440 
1441  require "$IP/includes/DefaultSettings.php";
1442 
1443  foreach ( $exts as $e ) {
1444  require_once "$IP/extensions/$e/$e.php";
1445  }
1446 
1447  $hooksWeWant = isset( $wgHooks['LoadExtensionSchemaUpdates'] ) ?
1448  $wgHooks['LoadExtensionSchemaUpdates'] : array();
1449 
1450  // Unset everyone else's hooks. Lord knows what someone might be doing
1451  // in ParserFirstCallInit (see bug 27171)
1452  $GLOBALS['wgHooks'] = array( 'LoadExtensionSchemaUpdates' => $hooksWeWant );
1453 
1454  return Status::newGood();
1455  }
1456 
1469  protected function getInstallSteps( DatabaseInstaller $installer ) {
1470  $coreInstallSteps = array(
1471  array( 'name' => 'database', 'callback' => array( $installer, 'setupDatabase' ) ),
1472  array( 'name' => 'tables', 'callback' => array( $installer, 'createTables' ) ),
1473  array( 'name' => 'interwiki', 'callback' => array( $installer, 'populateInterwikiTable' ) ),
1474  array( 'name' => 'stats', 'callback' => array( $this, 'populateSiteStats' ) ),
1475  array( 'name' => 'keys', 'callback' => array( $this, 'generateKeys' ) ),
1476  array( 'name' => 'sysop', 'callback' => array( $this, 'createSysop' ) ),
1477  array( 'name' => 'mainpage', 'callback' => array( $this, 'createMainpage' ) ),
1478  );
1479 
1480  // Build the array of install steps starting from the core install list,
1481  // then adding any callbacks that wanted to attach after a given step
1482  foreach ( $coreInstallSteps as $step ) {
1483  $this->installSteps[] = $step;
1484  if ( isset( $this->extraInstallSteps[$step['name']] ) ) {
1485  $this->installSteps = array_merge(
1486  $this->installSteps,
1487  $this->extraInstallSteps[$step['name']]
1488  );
1489  }
1490  }
1491 
1492  // Prepend any steps that want to be at the beginning
1493  if ( isset( $this->extraInstallSteps['BEGINNING'] ) ) {
1494  $this->installSteps = array_merge(
1495  $this->extraInstallSteps['BEGINNING'],
1496  $this->installSteps
1497  );
1498  }
1499 
1500  // Extensions should always go first, chance to tie into hooks and such
1501  if ( count( $this->getVar( '_Extensions' ) ) ) {
1502  array_unshift( $this->installSteps,
1503  array( 'name' => 'extensions', 'callback' => array( $this, 'includeExtensions' ) )
1504  );
1505  $this->installSteps[] = array(
1506  'name' => 'extension-tables',
1507  'callback' => array( $installer, 'createExtensionTables' )
1508  );
1509  }
1510 
1511  return $this->installSteps;
1512  }
1513 
1522  public function performInstallation( $startCB, $endCB ) {
1523  $installResults = array();
1524  $installer = $this->getDBInstaller();
1525  $installer->preInstall();
1526  $steps = $this->getInstallSteps( $installer );
1527  foreach ( $steps as $stepObj ) {
1528  $name = $stepObj['name'];
1529  call_user_func_array( $startCB, array( $name ) );
1530 
1531  // Perform the callback step
1532  $status = call_user_func( $stepObj['callback'], $installer );
1533 
1534  // Output and save the results
1535  call_user_func( $endCB, $name, $status );
1536  $installResults[$name] = $status;
1537 
1538  // If we've hit some sort of fatal, we need to bail.
1539  // Callback already had a chance to do output above.
1540  if ( !$status->isOk() ) {
1541  break;
1542  }
1543  }
1544  if ( $status->isOk() ) {
1545  $this->setVar( '_InstallDone', true );
1546  }
1547 
1548  return $installResults;
1549  }
1550 
1556  public function generateKeys() {
1557  $keys = array( 'wgSecretKey' => 64 );
1558  if ( strval( $this->getVar( 'wgUpgradeKey' ) ) === '' ) {
1559  $keys['wgUpgradeKey'] = 16;
1560  }
1561 
1562  return $this->doGenerateKeys( $keys );
1563  }
1564 
1572  protected function doGenerateKeys( $keys ) {
1573  $status = Status::newGood();
1574 
1575  $strong = true;
1576  foreach ( $keys as $name => $length ) {
1577  $secretKey = MWCryptRand::generateHex( $length, true );
1578  if ( !MWCryptRand::wasStrong() ) {
1579  $strong = false;
1580  }
1581 
1582  $this->setVar( $name, $secretKey );
1583  }
1584 
1585  if ( !$strong ) {
1586  $names = array_keys( $keys );
1587  $names = preg_replace( '/^(.*)$/', '\$$1', $names );
1588  global $wgLang;
1589  $status->warning( 'config-insecure-keys', $wgLang->listToText( $names ), count( $names ) );
1590  }
1591 
1592  return $status;
1593  }
1594 
1600  protected function createSysop() {
1601  $name = $this->getVar( '_AdminName' );
1602  $user = User::newFromName( $name );
1603 
1604  if ( !$user ) {
1605  // We should've validated this earlier anyway!
1606  return Status::newFatal( 'config-admin-error-user', $name );
1607  }
1608 
1609  if ( $user->idForName() == 0 ) {
1610  $user->addToDatabase();
1611 
1612  try {
1613  $user->setPassword( $this->getVar( '_AdminPassword' ) );
1614  } catch ( PasswordError $pwe ) {
1615  return Status::newFatal( 'config-admin-error-password', $name, $pwe->getMessage() );
1616  }
1617 
1618  $user->addGroup( 'sysop' );
1619  $user->addGroup( 'bureaucrat' );
1620  if ( $this->getVar( '_AdminEmail' ) ) {
1621  $user->setEmail( $this->getVar( '_AdminEmail' ) );
1622  }
1623  $user->saveSettings();
1624 
1625  // Update user count
1626  $ssUpdate = new SiteStatsUpdate( 0, 0, 0, 0, 1 );
1627  $ssUpdate->doUpdate();
1628  }
1629  $status = Status::newGood();
1630 
1631  if ( $this->getVar( '_Subscribe' ) && $this->getVar( '_AdminEmail' ) ) {
1632  $this->subscribeToMediaWikiAnnounce( $status );
1633  }
1634 
1635  return $status;
1636  }
1637 
1641  private function subscribeToMediaWikiAnnounce( Status $s ) {
1642  $params = array(
1643  'email' => $this->getVar( '_AdminEmail' ),
1644  'language' => 'en',
1645  'digest' => 0
1646  );
1647 
1648  // Mailman doesn't support as many languages as we do, so check to make
1649  // sure their selected language is available
1650  $myLang = $this->getVar( '_UserLang' );
1651  if ( in_array( $myLang, $this->mediaWikiAnnounceLanguages ) ) {
1652  $myLang = $myLang == 'pt-br' ? 'pt_BR' : $myLang; // rewrite to Mailman's pt_BR
1653  $params['language'] = $myLang;
1654  }
1655 
1657  $res = MWHttpRequest::factory( $this->mediaWikiAnnounceUrl,
1658  array( 'method' => 'POST', 'postData' => $params ) )->execute();
1659  if ( !$res->isOK() ) {
1660  $s->warning( 'config-install-subscribe-fail', $res->getMessage() );
1661  }
1662  } else {
1663  $s->warning( 'config-install-subscribe-notpossible' );
1664  }
1665  }
1666 
1673  protected function createMainpage( DatabaseInstaller $installer ) {
1674  $status = Status::newGood();
1675  try {
1677  $content = new WikitextContent(
1678  wfMessage( 'mainpagetext' )->inContentLanguage()->text() . "\n\n" .
1679  wfMessage( 'mainpagedocfooter' )->inContentLanguage()->text()
1680  );
1681 
1682  $page->doEditContent( $content,
1683  '',
1684  EDIT_NEW,
1685  false,
1686  User::newFromName( 'MediaWiki default' )
1687  );
1688  } catch ( MWException $e ) {
1689  //using raw, because $wgShowExceptionDetails can not be set yet
1690  $status->fatal( 'config-install-mainpage-failed', $e->getMessage() );
1691  }
1692 
1693  return $status;
1694  }
1695 
1699  public static function overrideConfig() {
1700  define( 'MW_NO_SESSION', 1 );
1701 
1702  // Don't access the database
1703  $GLOBALS['wgUseDatabaseMessages'] = false;
1704  // Don't cache langconv tables
1705  $GLOBALS['wgLanguageConverterCacheType'] = CACHE_NONE;
1706  // Debug-friendly
1707  $GLOBALS['wgShowExceptionDetails'] = true;
1708  // Don't break forms
1709  $GLOBALS['wgExternalLinkTarget'] = '_blank';
1710 
1711  // Extended debugging
1712  $GLOBALS['wgShowSQLErrors'] = true;
1713  $GLOBALS['wgShowDBErrorBacktrace'] = true;
1714 
1715  // Allow multiple ob_flush() calls
1716  $GLOBALS['wgDisableOutputCompression'] = true;
1717 
1718  // Use a sensible cookie prefix (not my_wiki)
1719  $GLOBALS['wgCookiePrefix'] = 'mw_installer';
1720 
1721  // Some of the environment checks make shell requests, remove limits
1722  $GLOBALS['wgMaxShellMemory'] = 0;
1724  // Don't bother embedding images into generated CSS, which is not cached
1725  $GLOBALS['wgResourceLoaderLESSFunctions']['embeddable'] = function ( $frame, $less ) {
1726  return $less->toBool( false );
1727  };
1728  }
1729 
1737  public function addInstallStep( $callback, $findStep = 'BEGINNING' ) {
1738  $this->extraInstallSteps[$findStep][] = $callback;
1739  }
1740 
1745  protected function disableTimeLimit() {
1747  set_time_limit( 0 );
1749  }
1750 }
Installer\envCheckBrokenXML
envCheckBrokenXML()
Some versions of libxml+PHP break < and > encoding horribly.
Definition: Installer.php:709
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:1659
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:583
$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:1296
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:1132
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:983
Installer\envCheckCtype
envCheckCtype()
Definition: Installer.php:1183
Installer\populateSiteStats
populateSiteStats(DatabaseInstaller $installer)
Install step which adds a row to the site_stats table with appropriate initial values.
Definition: Installer.php:624
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:999
$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:752
Installer\envCheckUploadsDirectory
envCheckUploadsDirectory()
Environment check for the permissions of the uploads directory.
Definition: Installer.php:1077
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:1508
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:1360
$wgHooks
$wgHooks['ArticleShow'][]
Definition: hooks.txt:110
Installer\addInstallStep
addInstallStep( $callback, $findStep='BEGINNING')
Add an installation step following the given step.
Definition: Installer.php:1723
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:535
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:432
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:1277
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:1685
Installer\createSysop
createSysop()
Create the first user account, grant it sysop and bureaucrat rights.
Definition: Installer.php:1586
Installer\getFakePassword
getFakePassword( $realPassword)
Get a fake password for sending back to the user in HTML.
Definition: Installer.php:524
$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:1096
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:1213
$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:699
wfRestoreWarnings
wfRestoreWarnings()
Restore error level to previous value.
Definition: GlobalFunctions.php:2464
Installer\envCheckDiff3
envCheckDiff3()
Search for GNU diff3.
Definition: Installer.php:879
Installer\envCheckMagicQuotes
envCheckMagicQuotes()
Environment check for magic_quotes_runtime.
Definition: Installer.php:724
Installer\envCheckJSON
envCheckJSON()
Definition: Installer.php:1196
Installer\generateKeys
generateKeys()
Generate $wgSecretKey.
Definition: Installer.php:1542
Installer\envCheckMagicSybase
envCheckMagicSybase()
Environment check for magic_quotes_sybase.
Definition: Installer.php:738
Installer\envCheckMemory
envCheckMemory()
Environment check for available memory.
Definition: Installer.php:819
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:459
Installer\exportVars
exportVars()
Exports all wg* variables stored by the installer into global scope.
Definition: Installer.php:649
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:845
Installer\getExistingLocalSettings
static getExistingLocalSettings()
Determine if LocalSettings.php exists.
Definition: Installer.php:490
Installer\envCheckPath
envCheckPath()
Environment check for setting $IP and $wgScriptPath.
Definition: Installer.php:965
Installer\doGenerateKeys
doGenerateKeys( $keys)
Generate a secret value for variables using our CryptRand generator.
Definition: Installer.php:1558
$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:446
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:611
Installer\envCheckXML
envCheckXML()
Environment check for the XML module.
Definition: Installer.php:779
Http\get
static get( $url, $timeout='default', $options=array())
Simple wrapper for Http::request( 'GET' )
Definition: HttpFunctions.php:98
$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:470
DatabaseInstaller
Base class for DBMS-specific installation helper classes.
Definition: DatabaseInstaller.php:30
Installer\envCheckDB
envCheckDB()
Environment check for DB types.
Definition: Installer.php:661
Installer\getInstallSteps
getInstallSteps(DatabaseInstaller $installer)
Get an array of install steps.
Definition: Installer.php:1455
$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:393
$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:899
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:1343
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:797
$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:603
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:277
$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:1731
$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:1380
$source
if(PHP_SAPI !='cli') $source
Definition: mwdoc-filter.php:18
Installer\envCheckServer
envCheckServer()
Environment check for the server hostname.
Definition: Installer.php:945
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:376
Installer\disableLinkPopups
disableLinkPopups()
Definition: Installer.php:607
Installer\envCheckSafeMode
envCheckSafeMode()
Environment check for safe_mode.
Definition: Installer.php:766
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:1411
$res
$res
Definition: database.txt:21
MWHttpRequest\factory
static factory( $url, $options=null)
Generate a new request object.
Definition: HttpFunctions.php:289
Installer\envCheckGit
envCheckGit()
Search for git.
Definition: Installer.php:925
Installer\getDocUrl
getDocUrl( $page)
Overridden by WebInstaller to provide lastPage parameters.
Definition: Installer.php:1370
$GLOBALS
$GLOBALS['IP']
Definition: ComposerHookHandler.php:6
Installer\subscribeToMediaWikiAnnounce
subscribeToMediaWikiAnnounce(Status $s)
Definition: Installer.php:1627
Installer\unicodeChar
unicodeChar( $c)
Convert a hex string representing a Unicode code point to that code point.
Definition: Installer.php:1111
Installer\maybeGetWebserverPrimaryGroup
static maybeGetWebserverPrimaryGroup()
On POSIX systems return the primary group of the webserver we're running under.
Definition: Installer.php:552
$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:867
Installer\locateExecutable
static locateExecutable( $path, $names, $versionInfo=false)
Search a path for any of the given executable names.
Definition: Installer.php:1238