From 3e97b1dd6f486878d2216e6ff72a8b554e6098d7 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 7 Mar 2004 01:31:08 +0000 Subject: [PATCH] Avoid failing on pre-4.3.2 due to lack of 'x' create-only option on fopen --- config/index.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/config/index.php b/config/index.php index cc22169f1e..a8e0ce3d10 100644 --- a/config/index.php +++ b/config/index.php @@ -424,7 +424,14 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) { /* Write out the config file now that all is well */ print "

Creating LocalSettings.php...

\n\n"; $localSettings = "<" . "?php\n$local\n?" . ">"; - $f = fopen( "LocalSettings.php", "xt" ); + + if( version_compare( phpversion(), "4.3.2" ) >= 0 ) { + $xt = "xt"; # Refuse to overwrite an existing file + } else { + $xt = "wt"; # 'x' is not available prior to PHP 4.3.2. We did check above, but race conditions blah blah + } + $f = fopen( "LocalSettings.php", $xt ); + if( $f == false ) { dieout( "Couldn't write out LocalSettings.php. Check that the directory permissions are correct and that there isn't already a file of that name here...

\n" . "

Here's the file that would have been written, try to paste it into place manually:

\n" . -- 2.20.1