Selaa lähdekoodia

Delete courses folder after migration if folder is empty.

Julio 9 vuotta sitten
vanhempi
commit
c8bc145b1b
1 muutettua tiedostoa jossa 9 lisäystä ja 0 poistoa
  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__;
 }