Browse Source

Delete courses folder after migration if folder is empty.

Julio 9 years ago
parent
commit
c8bc145b1b
1 changed files with 9 additions and 0 deletions
  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__;
 }