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
This commit is contained in:
Lukas Reschke 2012-10-29 22:03:18 +01:00
parent ac784baef6
commit 6903475841
1 changed files with 6 additions and 0 deletions

View 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) {