|
164 | 164 | unlink(api_get_path(SYS_PATH).'courses/.htaccess'); |
165 | 165 | } |
166 | 166 |
|
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 | | - |
180 | 167 | // Move dirs into new structures. |
181 | | - |
182 | 168 | $movePathList = [ |
183 | 169 | api_get_path(SYS_CODE_PATH).'upload/users/groups' => api_get_path(SYS_UPLOAD_PATH), |
184 | 170 | api_get_path(SYS_CODE_PATH).'upload/users' => api_get_path(SYS_UPLOAD_PATH), |
|
194 | 180 | } |
195 | 181 | } |
196 | 182 |
|
| 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 | + |
197 | 200 | // Remove archive |
198 | 201 | @rrmdir(api_get_path(SYS_PATH).'archive'); |
199 | 202 |
|
|
0 commit comments