aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2011-04-18 14:05:21 +0200
committerRobin Appelman <icewind1991@gmail.com>2011-04-18 14:12:53 +0200
commita977ba31ce2dfa5b29151fd34166178a9ac1f6bd (patch)
treea88790318a1762db57cafc97bb1874b7219ef529 /lib
parent1c300bb49b1139f25bd0b66f2a2cd36c49c013b5 (diff)
downloadnextcloud-server-a977ba31ce2dfa5b29151fd34166178a9ac1f6bd.tar.gz
nextcloud-server-a977ba31ce2dfa5b29151fd34166178a9ac1f6bd.zip
create .htaccess files during installation for apache users
Diffstat (limited to 'lib')
-rw-r--r--lib/installer.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/installer.php b/lib/installer.php
index 965642e8476..1222a22e71c 100644
--- a/lib/installer.php
+++ b/lib/installer.php
@@ -97,6 +97,9 @@ class OC_INSTALLER{
OC_GROUP::createGroup('admin');
OC_GROUP::addToGroup($username,'admin');
+ //create htaccess files for apache hosts
+ self::createHtaccess();//TODO detect if apache is used
+
//and we are done
OC_CONFIG::setValue('installed',true);
}
@@ -125,6 +128,19 @@ class OC_INSTALLER{
$query="CREATE USER '$name'@'%' IDENTIFIED BY '$password'";
$result = mysql_query($query,$connection);
}
+
+ /**
+ * create .htaccess files for apache hosts
+ */
+ private static function createHtaccess(){
+ global $SERVERROOT;
+ global $WEBROOT;
+ $content="ErrorDocument 404 /$WEBROOT/templates/404.php\n";
+ file_put_contents($SERVERROOT.'/.htaccess',$content);
+
+ $content="deny from all";
+ file_put_contents(OC_CONFIG::getValue('datadirectory',$SERVERROOT.'/data').'/.htaccess',$content);
+ }
}
?> \ No newline at end of file