Skip to content

Commit 8f3a7a5

Browse files
committed
Fix delete course folder.
1 parent d8b0b70 commit 8f3a7a5

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

main/install/update-files-1.9.0-1.10.0.inc.php

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -164,21 +164,7 @@
164164
unlink(api_get_path(SYS_PATH).'courses/.htaccess');
165165
}
166166

167-
// Delete all "courses/ABC/index.php" files.
168-
169-
$finder = new Finder();
170-
$dirs = $finder->directories()->in(api_get_path(SYS_APP_PATH).'courses');
171-
$fs = new Filesystem();
172-
/** @var Symfony\Component\Finder\SplFileInfo $dir */
173-
foreach ($dirs as $dir) {
174-
$indexFile = $dir->getPath().'/index.php';
175-
if ($fs->exists($indexFile)) {
176-
$fs->remove($indexFile);
177-
}
178-
}
179-
180167
// Move dirs into new structures.
181-
182168
$movePathList = [
183169
api_get_path(SYS_CODE_PATH).'upload/users/groups' => api_get_path(SYS_UPLOAD_PATH),
184170
api_get_path(SYS_CODE_PATH).'upload/users' => api_get_path(SYS_UPLOAD_PATH),
@@ -194,6 +180,23 @@
194180
}
195181
}
196182

183+
184+
// Delete all "courses/ABC/index.php" files.
185+
$courseDir = api_get_path(SYS_APP_PATH).'courses';
186+
$finder = new Finder();
187+
188+
if (is_dir($courseDir)) {
189+
$dirs = $finder->directories()->in(api_get_path(SYS_APP_PATH).'courses');
190+
$fs = new Filesystem();
191+
/** @var Symfony\Component\Finder\SplFileInfo $dir */
192+
foreach ($dirs as $dir) {
193+
$indexFile = $dir->getPath().'/index.php';
194+
if ($fs->exists($indexFile)) {
195+
$fs->remove($indexFile);
196+
}
197+
}
198+
}
199+
197200
// Remove archive
198201
@rrmdir(api_get_path(SYS_PATH).'archive');
199202

0 commit comments

Comments
 (0)