From cd197294b2e3318ee35cd9fea00355bdbed8e1cf Mon Sep 17 00:00:00 2001 From: River Tarnell Date: Fri, 1 Jul 2005 09:25:31 +0000 Subject: [PATCH] diff3 cleanups, from callek --- config/index.php | 71 ++++++++++++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 29 deletions(-) diff --git a/config/index.php b/config/index.php index 6c0a99acec..bfabc7ac67 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 "
  • PHP is linked with old MySQL client libraries. If you are + print "
  • PHP is linked with old MySQL client libraries. If you are using a MySQL 4.1 server and have problems connecting to the database, see http://dev.mysql.com/doc/mysql/en/old-client.html for help.
  • \n"; @@ -578,7 +570,7 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) { if( $wgDatabase->tableExists( "cur" ) || $wgDatabase->tableExists( "revision" ) ) { print "
  • There are already MediaWiki tables in this database. Checking if updates are needed...
  • \n"; - + # Create user if required if ( $conf->Root ) { $conn = Database::newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 ); @@ -630,7 +622,7 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) { $u->addGroup( "sysop" ); $u->addGroup( "bureaucrat" ); - + print "
  • Created sysop account " . htmlspecialchars( $conf->SysopName ) . ".
  • \n"; } else { @@ -652,7 +644,7 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) { ) ); $revid = $revision->insertOn( $wgDatabase ); $article->updateRevisionOn( $wgDatabase, $revision ); - + print "
  • ";
     			initialiseMessages();
     			print "
  • \n"; @@ -682,7 +674,7 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) { } else { fclose( $f ); die("

    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 ) ) {