]> source.dussan.org Git - nextcloud-server.git/commitdiff
Generate .htaccess when upgrading from old versions
authorLukas Reschke <lukas@statuscode.ch>
Mon, 29 Oct 2012 21:03:18 +0000 (22:03 +0100)
committerLukas Reschke <lukas@statuscode.ch>
Mon, 29 Oct 2012 21:03:18 +0000 (22:03 +0100)
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

lib/base.php

index d7d5eef32564e04c1ad4a92ff113bd1640382826..18118a93b6439f8780611a894bfbb50bcaa3026b 100644 (file)
@@ -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) {