summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2012-10-29 22:03:18 +0100
committerLukas Reschke <lukas@statuscode.ch>2012-10-29 22:03:18 +0100
commit6903475841d4687246d9206ae72ed192948f4db8 (patch)
treef044a8c1f0406a6f8193c7bd5af92a4bafde2075
parentac784baef689ca5c0f22c8acdce8e13f6d918101 (diff)
downloadnextcloud-server-6903475841d4687246d9206ae72ed192948f4db8.tar.gz
nextcloud-server-6903475841d4687246d9206ae72ed192948f4db8.zip
Generate .htaccess when upgrading from old versions
When upgrading from old ownCloud versions like 2.x the .htaccess is not generated - which exposes the data to the internet. This fix will generate a .htaccess when upgrading. (And no one exists) Fixes #127
-rw-r--r--lib/base.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/base.php b/lib/base.php
index d7d5eef3256..18118a93b64 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -221,6 +221,12 @@ class OC{
$installedVersion=OC_Config::getValue('version', '0.0.0');
$currentVersion=implode('.', OC_Util::getVersion());
if (version_compare($currentVersion, $installedVersion, '>')) {
+ // Check if the .htaccess is existing - this is needed for upgrades from really old ownCloud versions
+ if (isset($_SERVER['SERVER_SOFTWARE']) && strstr($_SERVER['SERVER_SOFTWARE'], 'Apache')) {
+ if(!OC_Util::ishtaccessworking()) {
+ OC_Setup::createHtaccess();
+ }
+ }
OC_Log::write('core', 'starting upgrade from '.$installedVersion.' to '.$currentVersion, OC_Log::DEBUG);
$result=OC_DB::updateDbFromStructure(OC::$SERVERROOT.'/db_structure.xml');
if(!$result) {