summaryrefslogtreecommitdiffstats
path: root/index.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2005-07-28 12:19:24 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2005-07-28 12:19:24 +0000
commit6aef1f41c5a0a8ae2e3ff9a9e60c0ca12702bb42 (patch)
treebf58798e5b46754ff3ee8be9bef99458e98bfc51 /index.php
parentbcd73bd794e2ab0f6a00b091c71e1a1a5fa5c1f4 (diff)
downloadwordpress-mu-6aef1f41c5a0a8ae2e3ff9a9e60c0ca12702bb42.tar.gz
wordpress-mu-6aef1f41c5a0a8ae2e3ff9a9e60c0ca12702bb42.tar.xz
wordpress-mu-6aef1f41c5a0a8ae2e3ff9a9e60c0ca12702bb42.zip
Change the permissions on .htaccess to 666 before writing to it.
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@85 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'index.php')
-rw-r--r--index.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/index.php b/index.php
index 3c8ed4a..2a5456f 100644
--- a/index.php
+++ b/index.php
@@ -140,12 +140,18 @@ function do_htaccess( $oldfilename, $newfilename, $realpath, $base, $url )
$htaccess = str_replace( "REALPATH", $realpath, $htaccess );
$htaccess = str_replace( "BASE", $base, $htaccess );
$htaccess = str_replace( "HOST", $url, $htaccess );
- $fp = fopen( $newfilename, "w" );
- if( $fp ) {
- fwrite( $fp, $htaccess );
- fclose( $fp );
+ if( touch( $newfilename ) ) {
+ chmod( $newfilename, 0666 );
+ $fp = fopen( $newfilename, "w" );
+ if( $fp ) {
+ fwrite( $fp, $htaccess );
+ fclose( $fp );
+ } else {
+ $err = "could not open $newfilename for writing";
+ }
+ chmod( $newfilename, 0644 );
} else {
- $err = "could not open $newfilename for writing";
+ $err = "could not open $newfilename for writing";
}
} else {
$err = "could not open $oldfilename for reading";