diff --git a/app/Migrations/Schema/V110/Version20150803171220.php b/app/Migrations/Schema/V110/Version20150803171220.php index 62cb0ba9d1..3ad80cca8e 100644 --- a/app/Migrations/Schema/V110/Version20150803171220.php +++ b/app/Migrations/Schema/V110/Version20150803171220.php @@ -21,8 +21,9 @@ class Version20150803171220 extends AbstractMigrationChamilo $this->addSql('UPDATE user SET username_canonical = username'); $this->addSql('ALTER TABLE user ADD confirmation_token VARCHAR(255) NULL'); $this->addSql('ALTER TABLE user ADD password_requested_at DATETIME DEFAULT NULL'); - - $schema->renameTable('track_e_exercices', 'track_e_exercises'); + $this->addSql('RENAME TABLE track_e_exercices TO track_e_exercises'); + // This drops the old table + // $schema->renameTable('track_e_exercices', 'track_e_exercises'); } /** 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 17191f807e..f647185bd3 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 @@ -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__; }