Explorar o código

Delete courses folder after migration if folder is empty.

Julio %!s(int64=9) %!d(string=hai) anos
pai
achega
c8bc145b1b
Modificáronse 1 ficheiros con 9 adicións e 0 borrados
  1. 9 0
      main/install/update-files-1.9.0-1.10.0.inc.php

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

@@ -197,6 +197,15 @@ if (defined('SYSTEM_INSTALLATION')) {
     // Remove archive
     @rrmdir(api_get_path(SYS_PATH).'archive');
 
+    // Remove old "courses" folder if empty
+    $dirs = $finder->directories()->in(api_get_path(SYS_PATH).'courses');
+    $files = $finder->directories()->in(api_get_path(SYS_PATH).'courses');
+    $dirCount = $dirs->count();
+    $fileCount = $dirs->count();
+    if ($fileCount == 0 && $dirCount == 0) {
+        @rrmdir(api_get_path(SYS_PATH).'courses');
+    }
+
 } else {
     echo 'You are not allowed here !'. __FILE__;
 }