|
|
|
|
@ -164,21 +164,7 @@ if (defined('SYSTEM_INSTALLATION')) { |
|
|
|
|
unlink(api_get_path(SYS_PATH).'courses/.htaccess'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Delete all "courses/ABC/index.php" files. |
|
|
|
|
|
|
|
|
|
$finder = new Finder(); |
|
|
|
|
$dirs = $finder->directories()->in(api_get_path(SYS_APP_PATH).'courses'); |
|
|
|
|
$fs = new Filesystem(); |
|
|
|
|
/** @var Symfony\Component\Finder\SplFileInfo $dir */ |
|
|
|
|
foreach ($dirs as $dir) { |
|
|
|
|
$indexFile = $dir->getPath().'/index.php'; |
|
|
|
|
if ($fs->exists($indexFile)) { |
|
|
|
|
$fs->remove($indexFile); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 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), |
|
|
|
|
@ -194,18 +180,40 @@ if (defined('SYSTEM_INSTALLATION')) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Remove archive |
|
|
|
|
@rrmdir(api_get_path(SYS_PATH).'archive'); |
|
|
|
|
|
|
|
|
|
// Delete all "courses/ABC/index.php" files. |
|
|
|
|
$finder = new Finder(); |
|
|
|
|
|
|
|
|
|
$courseDir = api_get_path(SYS_APP_PATH).'courses'; |
|
|
|
|
if (is_dir($courseDir)) { |
|
|
|
|
$dirs = $finder->directories()->in($courseDir); |
|
|
|
|
$fs = new Filesystem(); |
|
|
|
|
/** @var Symfony\Component\Finder\SplFileInfo $dir */ |
|
|
|
|
foreach ($dirs as $dir) { |
|
|
|
|
$indexFile = $dir->getPath().'/index.php'; |
|
|
|
|
if ($fs->exists($indexFile)) { |
|
|
|
|
$fs->remove($indexFile); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 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'); |
|
|
|
|
$originalCourseDir = api_get_path(SYS_PATH).'courses'; |
|
|
|
|
|
|
|
|
|
if (is_dir($originalCourseDir)) { |
|
|
|
|
$dirs = $finder->directories()->in($originalCourseDir); |
|
|
|
|
$files = $finder->directories()->in($originalCourseDir); |
|
|
|
|
$dirCount = $dirs->count(); |
|
|
|
|
$fileCount = $dirs->count(); |
|
|
|
|
if ($fileCount == 0 && $dirCount == 0) { |
|
|
|
|
@rrmdir(api_get_path(SYS_PATH).'courses'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remove archive |
|
|
|
|
@rrmdir(api_get_path(SYS_PATH).'archive'); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
echo 'You are not allowed here !'. __FILE__; |
|
|
|
|
} |
|
|
|
|
|