Explorar o código

Remove all index.php files inside the old courses directory.

Julio Montoya %!s(int64=10) %!d(string=hai) anos
pai
achega
41952c22d2
Modificáronse 1 ficheiros con 16 adicións e 0 borrados
  1. 16 0
      main/install/update-files-1.9.0-1.10.0.inc.php

+ 16 - 0
main/install/update-files-1.9.0-1.10.0.inc.php

@@ -1,6 +1,9 @@
 <?php
 /* For licensing terms, see /license.txt */
 
+use Symfony\Component\Filesystem\Filesystem;
+use Symfony\Component\Finder\Finder;
+
 /**
  * Chamilo LMS
  *
@@ -161,6 +164,19 @@ 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 = [