From c8bc145b1bbebe0e8c2fdfd56e17fcfeebbffe98 Mon Sep 17 00:00:00 2001 From: Julio Date: Mon, 12 Oct 2015 11:11:23 +0200 Subject: [PATCH] Delete courses folder after migration if folder is empty. --- main/install/update-files-1.9.0-1.10.0.inc.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main/install/update-files-1.9.0-1.10.0.inc.php b/main/install/update-files-1.9.0-1.10.0.inc.php index 065c68f627..17191f807e 100644 --- a/main/install/update-files-1.9.0-1.10.0.inc.php +++ b/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__; }