diff --git a/config/index.php b/config/index.php index 6c0a99acec3..bfabc7ac674 100644 --- a/config/index.php +++ b/config/index.php @@ -142,7 +142,7 @@ if( file_exists( "../LocalSettings.php" ) ) { if( file_exists( "./LocalSettings.php" ) ) { writeSuccessMessage(); - + dieout( '' ); } @@ -312,19 +312,11 @@ $conf->diff3 = false; $diff3locations = array("/usr/bin", "/opt/csw/bin", "/usr/gnu/bin", "/usr/sfw/bin") + explode(":", getenv("PATH")); $diff3names = array("gdiff3", "diff3"); -function check_location($loc) { - global $diff3names; - - foreach ($diff3names as $name) { - if (file_exists("$loc/$name") && (strstr(`$loc/$name --version 2>&1`, "diff3 (GNU diffutils)") !== false)) - return "$loc/$name"; - } - return false; -} - +$diff3versioninfo = array('$1 --version 2>&1', 'diff3 (GNU diffutils)'); foreach ($diff3locations as $loc) { - if (($ok = check_location($loc)) !== false) { - $conf->diff3 = $ok; + $exe = locate_executable($loc, $diff3names, $diff3versioninfo); + if ($exe !== false) { + $conf->diff3 = $exe; break; } } @@ -474,7 +466,7 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) { $wgTitle = Title::newFromText( "Installation script" ); $mysqlOldClient = version_compare( mysql_get_client_info(), "4.1.0", "lt" ); if( $mysqlOldClient ) { - print "
"; initialiseMessages(); print "
An error occured while writing the config/LocalSettings.php file. Check user rights and disk space then try again.
\n"); - + } } while( false ); @@ -807,14 +799,14 @@ if( count( $errs ) ) {If you need to share one database between multiple wikis, or MediaWiki and another web application, you may choose to add a prefix to all the table names to avoid conflicts.
- +Avoid exotic characters; something like mw_ is good.
If you are in a shared hosting environment, do not just move LocalSettings.php -remotely. LocalSettings.php is currently owned by the user your webserver is running under, +
If you are in a shared hosting environment, do not just move LocalSettings.php +remotely. LocalSettings.php is currently owned by the user your webserver is running under, which means that anyone on the same server can read your database password! Downloading it and uploading it again will hopefully change the ownership to a user ID specific to you.
EOT; @@ -1020,7 +1012,7 @@ function writeLocalSettings( $conf ) { $ugly = ($conf->prettyURLs ? "# " : ""); $rights = ($conf->RightsUrl) ? "" : "# "; $hashedUploads = $conf->safeMode ? '' : '# '; - + switch ( $conf->Shm ) { case 'memcached': $cacheType = 'CACHE_MEMCACHED'; @@ -1154,9 +1146,9 @@ if ( \$wgCommandLineMode ) { {$magic}\$wgUseImageMagick = true; {$magic}\$wgImageMagickConvertCommand = \"{$convert}\"; -## If you want to use image uploads under safe mode, -## create the directories images/archive, images/thumb and -## images/temp, and make them all writable. Then uncomment +## If you want to use image uploads under safe mode, +## create the directories images/archive, images/thumb and +## images/temp, and make them all writable. Then uncomment ## this, if it's not already uncommented: {$hashedUploads}\$wgHashedUploadDirectory = false; @@ -1281,6 +1273,27 @@ function getLanguageList() { return $codes; } +#Check for location of an executable +# @param string $loc single location to check +# @param array $names filenames to check for. +# @param mixed $versioninfo array of details to use when checking version, use false for no version checking +function locate_executable($loc, $names, $versioninfo = false) { + if (!is_array($names)) + $names = array($names); + + foreach ($names as $name) { + if (file_exists("$loc/$name")) { + if (!$versioninfo) + return "$loc/$name"; + + $file = str_replace('$1', "$loc/$name", $versioninfo[0]); + if (strstr(`$file`, $versioninfo[1]) !== false) + return "$loc/$name"; + } + } + return false; +} + # Test a memcached server function testMemcachedServer( $server ) { $hostport = explode(":", $server);