Ver Fonte

Fix upgrade from 1.9.x

Julio Montoya há 10 anos atrás
pai
commit
ff029b5ec6

+ 4 - 1
main/install/index.php

@@ -180,7 +180,10 @@ if ($installType == 'update' && in_array($my_old_version, $update_from_version_8
     // This is the main configuration file of the system before the upgrade.
     // Old configuration file.
     // Don't change to include_once
-    include api_get_path(SYS_CODE_PATH) . 'inc/conf/configuration.php';
+    $oldConfigPath = api_get_path(SYS_CODE_PATH) . 'inc/conf/configuration.php';
+    if (file_exists($oldConfigPath)) {
+        include $oldConfigPath;
+    }
 }
 
 if (!isset($_GET['running'])) {

+ 7 - 4
main/install/update-configuration.inc.php

@@ -11,16 +11,19 @@
 if (defined('SYSTEM_INSTALLATION')) {
 
     Log::notice("Starting " . basename(__FILE__));
+    $perm = api_get_permissions_for_new_files();
 
     $oldConfFile = api_get_path(SYS_CODE_PATH) . 'inc/conf/configuration.php';
+    $newConfFile = api_get_path(CONFIGURATION_PATH) . 'configuration.php';
 
     if (file_exists($oldConfFile)) {
-        rename($oldConfFile, api_get_path(CONFIGURATION_PATH) . 'configuration.php');
+        rename($oldConfFile, $newConfFile);
+        chmod($newConfFile, $perm);
     }
 
-    // Edit the configuration file
-    $file = file(api_get_path(CONFIGURATION_PATH) . 'configuration.php');
-    $fh = fopen(api_get_path(CONFIGURATION_PATH) . 'configuration.php', 'w');
+    // Edit the configuration file.
+    $file = file($newConfFile);
+    $fh = fopen($newConfFile, 'w');
 
     $found_version_old = false;
     $found_stable_old = false;

+ 6 - 6
main/install/update-files-1.9.0-1.10.0.inc.php

@@ -164,12 +164,12 @@ if (defined('SYSTEM_INSTALLATION')) {
     // Move dirs into new structures.
 
     $movePathList = [
-        api_get_path(SYS_CODE_PATH).'upload/users/groups/' => api_get_path(SYS_UPLOAD_PATH),
-        api_get_path(SYS_CODE_PATH).'upload/users/' => api_get_path(SYS_UPLOAD_PATH),
-        api_get_path(SYS_CODE_PATH).'upload/badges/' => api_get_path(SYS_UPLOAD_PATH),
-        api_get_path(SYS_PATH).'courses/' => api_get_path(SYS_APP_PATH),
-        api_get_path(SYS_PATH).'searchdb/' => api_get_path(SYS_UPLOAD_PATH).'plugins/xapian',
-        api_get_path(SYS_PATH).'home/' => api_get_path(SYS_APP_PATH)
+        api_get_path(SYS_CODE_PATH).'upload/users/groups' => api_get_path(SYS_UPLOAD_PATH),
+        api_get_path(SYS_CODE_PATH).'upload/users' => api_get_path(SYS_UPLOAD_PATH),
+        api_get_path(SYS_CODE_PATH).'upload/badges' => api_get_path(SYS_UPLOAD_PATH),
+        api_get_path(SYS_PATH).'courses' => api_get_path(SYS_APP_PATH),
+        api_get_path(SYS_PATH).'searchdb' => api_get_path(SYS_UPLOAD_PATH).'plugins/xapian',
+        api_get_path(SYS_PATH).'home' => api_get_path(SYS_APP_PATH)
     ];
 
     foreach ($movePathList as $origin => $destination) {