5 * Handles everything that is independent of user interface
7 abstract class Installer
{
8 var $settings, $output;
11 * MediaWiki configuration globals that will eventually be passed through
12 * to LocalSettings.php. The names only are given here, the defaults
13 * typically come from DefaultSettings.php.
16 var $defaultVarNames = array(
28 'wgEmailAuthentication',
31 'wgImageMagickConvertCommand',
36 // 'wgDeletedDirectory',
44 * Variables that are stored alongside globals, and are used for any
45 * configuration of the installation process aside from the MediaWiki
46 * configuration. Map of names to defaults.
49 var $internalDefaults = array(
51 '_Environment' => false,
52 '_CompiledDBs' => array(),
54 '_RaiseMemory' => false,
55 '_UpgradeDone' => false,
57 '_InstallUser' => 'root',
58 '_InstallPassword' => '',
59 '_SameAccount' => true,
60 '_CreateDBAccount' => false,
61 '_NamespaceType' => 'site-name',
62 '_AdminName' => null, // will be set later, when the user selects language
63 '_AdminPassword' => '',
64 '_AdminPassword2' => '',
66 '_Subscribe' => false,
67 '_SkipOptional' => 'continue',
68 '_RightsProfile' => 'wiki',
69 '_LicenseCode' => 'none',
71 '_Extensions' => array(),
72 '_MemCachedServers' => '',
76 * Known database types. These correspond to the class names <type>Installer,
77 * and are also MediaWiki database types valid for $wgDBtype.
79 * To add a new type, create a <type>Installer class and a Database<type>
80 * class, and add a config-type-<type> message to MessagesEn.php.
91 * Minimum memory size in MB
93 private $minMemorySize = 50;
96 * Cached DB installer instances, access using getDBInstaller()
99 var $dbInstallers = array();
102 * A list of environment check methods called by doEnvironmentChecks().
103 * These may output warnings using showMessage(), and/or abort the
104 * installation process by returning false.
107 var $envChecks = array(
110 'envCheckRegisterGlobals',
111 'envCheckMagicQuotes',
112 'envCheckMagicSybase',
123 'envCheckWriteableDir',
125 'envCheckShellLocale',
126 'envCheckUploadsDirectory',
129 var $installSteps = array(
139 * Known object cache types and the functions used to test for their existence
142 var $objectCaches = array(
143 'xcache' => 'xcache_get',
144 'apc' => 'apc_fetch',
145 'eaccel' => 'eaccelerator_get',
146 'wincache' => 'wincache_ucache_get'
150 * User rights profiles
152 var $rightsProfiles = array(
155 '*' => array( 'edit' => false )
159 'createaccount' => false,
165 'createaccount' => false,
175 var $licenses = array(
182 'url' => 'http://creativecommons.org/licenses/by-sa/3.0/',
183 'icon' => '{$wgStylePath}/common/images/cc-by-sa.png',
185 'cc-by-nc-sa' => array(
186 'url' => 'http://creativecommons.org/licenses/by-nc-sa/3.0/',
187 'icon' => '{$wgStylePath}/common/images/cc-by-nc-sa.png',
190 'url' => 'http://creativecommons.org/licenses/publicdomain/',
191 'icon' => '{$wgStylePath}/common/images/public-domain.png',
194 'url' => 'http://www.gnu.org/licenses/old-licenses/fdl-1.2.html',
195 'icon' => '{$wgStylePath}/common/images/gnu-fdl.png',
197 'gfdl-current' => array(
198 'url' => 'http://www.gnu.org/copyleft/fdl.html',
199 'icon' => '{$wgStylePath}/common/images/gnu-fdl.png',
201 'cc-choose' => array(
202 // details will be filled in by the selector
209 * Cached Title and ParserOptions used by parse()
212 var $parserTitle, $parserOptions;
215 * Constructor, always call this from child classes
217 function __construct() {
218 $this->settings
= $this->internalDefaults
;
219 foreach ( $this->defaultVarNames
as $var ) {
220 $this->settings
[$var] = $GLOBALS[$var];
222 foreach ( $this->dbTypes
as $type ) {
223 $installer = $this->getDBInstaller( $type );
224 if ( !$installer->isCompiled() ) {
227 $defaults = $installer->getGlobalDefaults();
228 foreach ( $installer->getGlobalNames() as $var ) {
229 if ( isset( $defaults[$var] ) ) {
230 $this->settings
[$var] = $defaults[$var];
232 $this->settings
[$var] = $GLOBALS[$var];
237 $this->parserTitle
= Title
::newFromText( 'Installer' );
238 $this->parserOptions
= new ParserOptions
;
239 $this->parserOptions
->setEditSection( false );
243 * UI interface for displaying a short message
244 * The parameters are like parameters to wfMsg().
245 * The messages will be in wikitext format, which will be converted to an
246 * output format such as HTML or text before being sent to the user.
248 abstract function showMessage( $msg /*, ... */ );
250 abstract function showStatusError( $status );
253 * Get a list of known DB types
255 function getDBTypes() {
256 return $this->dbTypes
;
260 * Get an instance of InstallerDBType for the specified DB type
261 * @param $type Mixed: DB installer for which is needed, false to use default
263 function getDBInstaller( $type = false ) {
265 $type = $this->getVar( 'wgDBtype' );
267 if ( !isset( $this->dbInstallers
[$type] ) ) {
268 $class = ucfirst( $type ). 'Installer';
269 $this->dbInstallers
[$type] = new $class( $this );
271 return $this->dbInstallers
[$type];
275 * Do initial checks of the PHP environment. Set variables according to
276 * the observed environment.
278 * It's possible that this may be called under the CLI SAPI, not the SAPI
279 * that the wiki will primarily run under. In that case, the subclass should
280 * initialise variables such as wgScriptPath, before calling this function.
282 * Under the web subclass, it can already be assumed that PHP 5+ is in use
283 * and that sessions are working.
285 function doEnvironmentChecks() {
286 $this->showMessage( 'config-env-php', phpversion() );
289 foreach ( $this->envChecks
as $check ) {
290 $status = $this->$check();
291 if ( $status === false ) {
295 $this->setVar( '_Environment', $good );
297 $this->showMessage( 'config-env-good' );
299 $this->showMessage( 'config-env-bad' );
305 * Get an MW configuration variable, or internal installer configuration variable.
306 * The defaults come from $GLOBALS (ultimately DefaultSettings.php).
307 * Installer variables are typically prefixed by an underscore.
309 function getVar( $name, $default = null ) {
310 if ( !isset( $this->settings
[$name] ) ) {
313 return $this->settings
[$name];
318 * Set a MW configuration variable, or internal installer configuration variable.
320 function setVar( $name, $value ) {
321 $this->settings
[$name] = $value;
325 * Exports all wg* variables stored by the installer into global scope
327 function exportVars() {
328 foreach ( $this->settings
as $name => $value ) {
329 if ( substr( $name, 0, 2 ) == 'wg' ) {
330 $GLOBALS[$name] = $value;
336 * Get a fake password for sending back to the user in HTML.
337 * This is a security mechanism to avoid compromise of the password in the
338 * event of session ID compromise.
340 function getFakePassword( $realPassword ) {
341 return str_repeat( '*', strlen( $realPassword ) );
345 * Set a variable which stores a password, except if the new value is a
346 * fake password in which case leave it as it is.
348 function setPassword( $name, $value ) {
349 if ( !preg_match( '/^\*+$/', $value ) ) {
350 $this->setVar( $name, $value );
355 * Returns true if dl() can be used
358 return function_exists( 'dl' )
359 && is_callable( 'dl' )
360 && wfIniGetBool( 'enable_dl' )
361 && !wfIniGetBool( 'safe_mode' );
364 /** Check if we're installing the latest version */
365 function envLatestVersion() {
367 $latestInfoUrl = 'http://www.mediawiki.org/w/api.php?action=mwreleases&format=json';
368 $latestInfo = Http
::get( $latestInfoUrl );
370 $this->showMessage( 'config-env-latest-can-not-check', $latestInfoUrl );
373 $latestInfo = FormatJson
::decode($latestInfo);
374 if ($latestInfo === false ||
!isset( $latestInfo->mwreleases
) ) {
375 # For when the request is successful but there's e.g. some silly man in
376 # the middle firewall blocking us, e.g. one of those annoying airport ones
377 $this->showMessage( 'config-env-latest-data-invalid', $latestInfoUrl );
380 foreach( $latestInfo->mwreleases
as $rel ) {
381 if( isset( $rel->current
) )
382 $currentVersion = $rel->version
;
384 if( version_compare( $wgVersion, $currentVersion, '<' ) ) {
385 $this->showMessage( 'config-env-latest-old' );
386 $this->showHelpBox( 'config-env-latest-help', $wgVersion, $currentVersion );
387 } elseif( version_compare( $wgVersion, $currentVersion, '>' ) ) {
388 $this->showMessage( 'config-env-latest-new' );
390 $this->showMessage( 'config-env-latest-ok' );
393 /** Environment check for DB types */
394 function envCheckDB() {
395 $compiledDBs = array();
396 $haveDl = $this->haveDl();
397 $goodNames = array();
399 foreach ( $this->dbTypes
as $name ) {
400 $db = $this->getDBInstaller( $name );
401 $readableName = wfMsg( 'config-type-' . $name );
402 if ( $db->isCompiled() ) {
403 $compiledDBs[] = $name;
404 $goodNames[] = $readableName;
406 $allNames[] = $readableName;
408 $this->setVar( '_CompiledDBs', $compiledDBs );
411 if ( !$compiledDBs ) {
412 $this->showMessage( 'config-no-db' );
413 $this->showHelpBox( 'config-no-db-help', $wgLang->commaList( $allNames ) );
416 $this->showMessage( 'config-have-db', $wgLang->commaList( $goodNames ) );
419 /** Environment check for register_globals */
420 function envCheckRegisterGlobals() {
421 if( wfIniGetBool( "magic_quotes_runtime" ) ) {
422 $this->showMessage( 'config-register-globals' );
426 /** Environment check for magic_quotes_runtime */
427 function envCheckMagicQuotes() {
428 if( wfIniGetBool( "magic_quotes_runtime" ) ) {
429 $this->showMessage( 'config-magic-quotes-runtime' );
434 /** Environment check for magic_quotes_sybase */
435 function envCheckMagicSybase() {
436 if ( wfIniGetBool( 'magic_quotes_sybase' ) ) {
437 $this->showMessage( 'config-magic-quotes-sybase' );
442 /* Environment check for mbstring.func_overload */
443 function envCheckMbstring() {
444 if ( wfIniGetBool( 'mbstring.func_overload' ) ) {
445 $this->showMessage( 'config-mbstring' );
450 /** Environment check for zend.ze1_compatibility_mode */
451 function envCheckZE1() {
452 if ( wfIniGetBool( 'zend.ze1_compatibility_mode' ) ) {
453 $this->showMessage( 'config-ze1' );
458 /** Environment check for safe_mode */
459 function envCheckSafeMode() {
460 if ( wfIniGetBool( 'safe_mode' ) ) {
461 $this->setVar( '_SafeMode', true );
462 $this->showMessage( 'config-safe-mode' );
466 /** Environment check for the XML module */
467 function envCheckXML() {
468 if ( !function_exists( "utf8_encode" ) ) {
469 $this->showMessage( 'config-xml-bad' );
472 $this->showMessage( 'config-xml-good' );
475 /** Environment check for the PCRE module */
476 function envCheckPCRE() {
477 if ( !function_exists( 'preg_match' ) ) {
478 $this->showMessage( 'config-pcre' );
483 /** Environment check for available memory */
484 function envCheckMemory() {
485 $limit = ini_get( 'memory_limit' );
486 if ( !$limit ||
$limit == -1 ) {
487 $this->showMessage( 'config-memory-none' );
490 $n = intval( $limit );
491 if( preg_match( '/^([0-9]+)[Mm]$/', trim( $limit ), $m ) ) {
492 $n = intval( $m[1] * (1024*1024) );
494 if( $n < $this->minMemorySize
*1024*1024 ) {
495 $newLimit = "{$this->minMemorySize}M";
496 if( false === ini_set( "memory_limit", $newLimit ) ) {
497 $this->showMessage( 'config-memory-bad', $limit );
499 $this->showMessage( 'config-memory-raised', $limit, $newLimit );
500 $this->setVar( '_RaiseMemory', true );
503 $this->showMessage( 'config-memory-ok', $limit );
507 /** Environment check for compiled object cache types */
508 function envCheckCache() {
510 foreach ( $this->objectCaches
as $name => $function ) {
511 if ( function_exists( $function ) ) {
512 $caches[$name] = true;
513 $this->showMessage( 'config-' . $name );
517 $this->showMessage( 'config-no-cache' );
519 $this->setVar( '_Caches', $caches );
522 /** Search for GNU diff3 */
523 function envCheckDiff3() {
524 $paths = array_merge(
531 explode( PATH_SEPARATOR
, getenv( "PATH" ) ) );
532 $names = array( "gdiff3", "diff3", "diff3.exe" );
534 $versionInfo = array( '$1 --version 2>&1', 'diff3 (GNU diffutils)' );
536 foreach ( $paths as $path ) {
537 $exe = $this->locateExecutable( $path, $names, $versionInfo );
538 if ($exe !== false) {
539 $this->setVar( 'wgDiff3', $exe );
545 $this->showMessage( 'config-diff3-good', $exe );
547 $this->setVar( 'wgDiff3', false );
548 $this->showMessage( 'config-diff3-bad' );
553 * Search a path for any of the given executable names. Returns the
554 * executable name if found. Also checks the version string returned
557 * @param $path String: path to search
558 * @param $names Array of executable names
559 * @param $versionInfo Boolean false or array with two members:
560 * 0 => Command to run for version check, with $1 for the path
561 * 1 => String to compare the output with
563 * If $versionInfo is not false, only executables with a version
564 * matching $versionInfo[1] will be returned.
566 function locateExecutable( $path, $names, $versionInfo = false ) {
567 if (!is_array($names))
568 $names = array($names);
570 foreach ($names as $name) {
571 $command = "$path/$name";
572 if ( @file_exists
( $command ) ) {
576 $file = str_replace( '$1', $command, $versionInfo[0] );
577 if ( strstr( wfShellExec( $file ), $versionInfo[1]) !== false )
584 /** Environment check for ImageMagick and GD */
585 function envCheckGraphics() {
586 $imcheck = array( "/usr/bin", "/opt/csw/bin", "/usr/local/bin", "/sw/bin", "/opt/local/bin" );
587 foreach( $imcheck as $dir ) {
588 $im = "$dir/convert";
589 if( @file_exists
( $im ) ) {
590 $this->showMessage( 'config-imagemagick', $im );
591 $this->setVar( 'wgImageMagickConvertCommand', $im );
595 if ( function_exists( 'imagejpeg' ) ) {
596 $this->showMessage( 'config-gd' );
599 $this->showMessage( 'no-scaling' );
602 /** Environment check for setting $IP and $wgScriptPath */
603 function envCheckPath() {
604 $IP = dirname( dirname( dirname( __FILE__
) ) );
605 $this->setVar( 'IP', $IP );
606 $this->showMessage( 'config-dir', $IP );
608 // PHP_SELF isn't available sometimes, such as when PHP is CGI but
609 // cgi.fix_pathinfo is disabled. In that case, fall back to SCRIPT_NAME
610 // to get the path to the current script... hopefully it's reliable. SIGH
611 if ( !empty( $_SERVER['PHP_SELF'] ) ) {
612 $path = $_SERVER['PHP_SELF'];
613 } elseif ( !empty( $_SERVER['SCRIPT_NAME'] ) ) {
614 $path = $_SERVER['SCRIPT_NAME'];
615 } elseif ( $this->getVar( 'wgScriptPath' ) ) {
616 // Some kind soul has set it for us already (e.g. debconf)
619 $this->showMessage( 'config-no-uri' );
622 $uri = preg_replace( '{^(.*)/config.*$}', '$1', $path );
623 $this->setVar( 'wgScriptPath', $uri );
624 $this->showMessage( 'config-uri', $uri );
627 /** Environment check for writable config/ directory */
628 function envCheckWriteableDir() {
629 $ipDir = $this->getVar( 'IP' );
630 $configDir = $ipDir . '/config';
631 if( !is_writeable( $configDir ) ) {
632 $webserverGroup = self
::maybeGetWebserverPrimaryGroup();
633 if ( $webserverGroup !== null ) {
634 $this->showMessage( 'config-dir-not-writable-group', $ipDir, $webserverGroup );
636 $this->showMessage( 'config-dir-not-writable-nogroup', $ipDir, $webserverGroup );
642 /** Environment check for setting the preferred PHP file extension */
643 function envCheckExtension() {
644 // FIXME: detect this properly
645 if ( defined( 'MW_INSTALL_PHP5_EXT' ) ) {
650 $this->setVar( 'wgScriptExtension', ".$ext" );
651 $this->showMessage( 'config-file-extension', $ext );
654 function envCheckShellLocale() {
655 # Give up now if we're in safe mode or open_basedir
656 # It's theoretically possible but tricky to work with
657 if ( wfIniGetBool( "safe_mode" ) ||
ini_get( 'open_basedir' ) ||
!function_exists( 'exec' ) ) {
661 $os = php_uname( 's' );
662 $supported = array( 'Linux', 'SunOS', 'HP-UX' ); # Tested these
663 if ( !in_array( $os, $supported ) ) {
667 # Get a list of available locales
668 $lines = $ret = false;
669 exec( '/usr/bin/locale -a', $lines, $ret );
674 $lines = wfArrayMap( 'trim', $lines );
675 $candidatesByLocale = array();
676 $candidatesByLang = array();
677 foreach ( $lines as $line ) {
678 if ( $line === '' ) {
681 if ( !preg_match( '/^([a-zA-Z]+)(_[a-zA-Z]+|)\.(utf8|UTF-8)(@[a-zA-Z_]*|)$/i', $line, $m ) ) {
684 list( $all, $lang, $territory, $charset, $modifier ) = $m;
685 $candidatesByLocale[$m[0]] = $m;
686 $candidatesByLang[$lang][] = $m;
689 # Try the current value of LANG
690 if ( isset( $candidatesByLocale[ getenv( 'LANG' ) ] ) ) {
691 $this->setVar( 'wgShellLocale', getenv( 'LANG' ) );
692 $this->showMessage( 'config-shell-locale', getenv( 'LANG' ) );
696 # Try the most common ones
697 $commonLocales = array( 'en_US.UTF-8', 'en_US.utf8', 'de_DE.UTF-8', 'de_DE.utf8' );
698 foreach ( $commonLocales as $commonLocale ) {
699 if ( isset( $candidatesByLocale[$commonLocale] ) ) {
700 $this->setVar( 'wgShellLocale', $commonLocale );
701 $this->showMessage( 'config-shell-locale', $commonLocale );
706 # Is there an available locale in the Wiki's language?
707 $wikiLang = $this->getVar( 'wgLanguageCode' );
708 if ( isset( $candidatesByLang[$wikiLang] ) ) {
709 $m = reset( $candidatesByLang[$wikiLang] );
710 $this->setVar( 'wgShellLocale', $m[0] );
711 $this->showMessage( 'config-shell-locale', $m[0] );
715 # Are there any at all?
716 if ( count( $candidatesByLocale ) ) {
717 $m = reset( $candidatesByLocale );
718 $this->setVar( 'wgShellLocale', $m[0] );
719 $this->showMessage( 'config-shell-locale', $m[0] );
727 function envCheckUploadsDirectory() {
728 global $IP, $wgServer;
729 $dir = $IP . '/images/';
730 $url = $wgServer . $this->getVar( 'wgScriptPath' ) . '/images/';
731 $safe = !$this->dirIsExecutable( $dir, $url );
733 $this->showMessage( 'config-uploads-safe' );
735 $this->showMessage( 'config-uploads-not-safe', $dir );
740 * Checks if scripts located in the given directory can be executed via the given URL
742 function dirIsExecutable( $dir, $url ) {
743 $scriptTypes = array(
745 "<?php echo 'ex' . 'ec';",
746 "#!/var/env php5\n<?php echo 'ex' . 'ec';",
749 // it would be good to check other popular languages here, but it'll be slow
751 wfSuppressWarnings();
752 foreach ( $scriptTypes as $ext => $contents ) {
753 foreach ( $contents as $source ) {
754 $file = 'exectest.' . $ext;
755 if ( !file_put_contents( $dir . $file, $source ) ) {
758 $text = Http
::get( $url . $file );
759 unlink( $dir . $file );
760 if ( $text == 'exec' ) {
771 * Convert wikitext $text to HTML.
773 * This is potentially error prone since many parser features require a complete
774 * installed MW database. The solution is to just not use those features when you
775 * write your messages. This appears to work well enough. Basic formatting and
776 * external links work just fine.
778 * But in case a translator decides to throw in a #ifexist or internal link or
779 * whatever, this function is guarded to catch attempted DB access and to present
780 * some fallback text.
782 * @param $text String
783 * @param $lineStart Boolean
786 function parse( $text, $lineStart = false ) {
789 $out = $wgParser->parse( $text, $this->parserTitle
, $this->parserOptions
, $lineStart );
790 $html = $out->getText();
791 } catch ( InstallerDBAccessError
$e ) {
792 $html = '<!--DB access attempted during parse--> ' . htmlspecialchars( $text );
793 if ( !empty( $this->debug
) ) {
794 $html .= "<!--\n" . $e->getTraceAsString() . "\n-->";
801 * Extension tag hook for a documentation link
803 function docLink( $linkText, $attribs, $parser ) {
804 $url = $this->getDocUrl( $attribs['href'] );
805 return '<a href="' . htmlspecialchars( $url ) . '">' .
806 htmlspecialchars( $linkText ) .
811 * Overridden by WebInstaller to provide lastPage parameters
813 protected function getDocUrl( $page ) {
814 return "{$_SERVER['PHP_SELF']}?page=" . urlencode( $attribs['href'] );
817 public function findExtensions() {
818 if( $this->getVar( 'IP' ) === null ) {
822 $dir = $this->getVar( 'IP' ) . '/extensions';
823 $dh = opendir( $dir );
824 while ( ( $file = readdir( $dh ) ) !== false ) {
825 if( file_exists( "$dir/$file/$file.php" ) ) {
829 $this->setVar( '_Extensions', $exts );
833 public function getInstallSteps() {
834 if( $this->getVar( '_UpgradeDone' ) ) {
835 $this->installSteps
= array( 'localsettings' );
837 if( count( $this->getVar( '_Extensions' ) ) ) {
838 array_unshift( $this->installSteps
, 'extensions' );
840 return $this->installSteps
;
843 public function installExtensions() {
844 global $wgHooks, $wgAutoloadClasses;
845 $exts = $this->getVar( '_Extensions' );
846 $path = $this->getVar( 'IP' ) . '/extensions';
847 foreach( $exts as $e ) {
848 require( "$path/$e/$e.php" );
850 return Status
::newGood();
853 public function installDatabase() {
854 $installer = $this->getDBInstaller( $this->getVar( 'wgDBtype' ) );
855 $status = $installer->setupDatabase();
859 public function installTables() {
860 $installer = $this->getDBInstaller();
861 $status = $installer->createTables();
862 if( $status->isGood() ) {
863 LBFactory
::enableBackend();
868 public function installInterwiki() {
869 $installer = $this->getDBInstaller();
870 return $installer->populateInterwikiTable();
873 public function installSecretKey() {
874 $file = wfIsWindows() ?
null : @fopen
( "/dev/urandom", "r" );
876 $secretKey = bin2hex( fread( $file, 32 ) );
880 for ( $i=0; $i<8; $i++
) {
881 $secretKey .= dechex(mt_rand(0, 0x7fffffff));
883 $this->output
->addWarningMsg( 'config-insecure-secretkey' );
885 $this->setVar( 'wgSecretKey', $secretKey );
886 return Status
::newGood();
889 public function installSysop() {
890 $name = $this->getVar( '_AdminName' );
891 $user = User
::newFromName( $name );
893 // we should've validated this earlier anyway!
894 return Status
::newFatal( 'config-admin-error-user', $name );
896 if ( $user->idForName() == 0 ) {
897 $user->addToDatabase();
899 $user->setPassword( $this->getVar( '_AdminPassword' ) );
900 } catch( PasswordError
$pwe ) {
901 return Status
::newFatal( 'config-admin-error-password', $name, $pwe->getMessage() );
903 $user->saveSettings();
904 $user->addGroup( 'sysop' );
905 $user->addGroup( 'bureaucrat' );
907 return Status
::newGood();
910 public function installLocalsettings() {
911 $localSettings = new LocalSettingsGenerator( $this );
912 $ok = $localSettings->writeLocalSettings();
914 # TODO: Make writeLocalSettings() itself not warn, but instead return
915 # a Status object to us to pass along.
917 return Status
::newGood();
919 return Status
::newFatal();
924 * On POSIX systems return the primary group of the webserver we're running under.
925 * On other systems just returns null.
927 * This is used to advice the user that he should chgrp his config/data/images directory as the
928 * webserver user before he can install.
930 * Public because SqliteInstaller needs it, and doesn't subclass Installer.
934 public static function maybeGetWebserverPrimaryGroup() {
935 if ( ! function_exists('posix_getegid') ||
! function_exists('posix_getpwuid') ) {
936 # I don't know this, this isn't UNIX
940 # posix_getegid() *not* getmygid() because we want the group of the webserver,
941 # not whoever owns the current script
942 $gid = posix_getegid();
943 $getpwuid = posix_getpwuid( $gid );
944 $group = $getpwuid["name"];