Skip to content

Commit 4d95a17

Browse files
committed
Merge branch '1.10.x' of https://github.com/chamilo/chamilo-lms into 1.10.0-rc
2 parents 103bdff + 7670bad commit 4d95a17

File tree

2 files changed

+33
-24
lines changed

2 files changed

+33
-24
lines changed

app/Migrations/Schema/V110/Version20150803171220.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ public function up(Schema $schema)
2121
$this->addSql('UPDATE user SET username_canonical = username');
2222
$this->addSql('ALTER TABLE user ADD confirmation_token VARCHAR(255) NULL');
2323
$this->addSql('ALTER TABLE user ADD password_requested_at DATETIME DEFAULT NULL');
24-
25-
$schema->renameTable('track_e_exercices', 'track_e_exercises');
24+
$this->addSql('RENAME TABLE track_e_exercices TO track_e_exercises');
25+
// This drops the old table
26+
// $schema->renameTable('track_e_exercices', 'track_e_exercises');
2627
}
2728

2829
/**

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

Lines changed: 30 additions & 22 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,18 +180,40 @@
194180
}
195181
}
196182

197-
// Remove archive
198-
@rrmdir(api_get_path(SYS_PATH).'archive');
183+
184+
// Delete all "courses/ABC/index.php" files.
185+
$finder = new Finder();
186+
187+
$courseDir = api_get_path(SYS_APP_PATH).'courses';
188+
if (is_dir($courseDir)) {
189+
$dirs = $finder->directories()->in($courseDir);
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+
}
199199

200200
// Remove old "courses" folder if empty
201-
$dirs = $finder->directories()->in(api_get_path(SYS_PATH).'courses');
202-
$files = $finder->directories()->in(api_get_path(SYS_PATH).'courses');
203-
$dirCount = $dirs->count();
204-
$fileCount = $dirs->count();
205-
if ($fileCount == 0 && $dirCount == 0) {
206-
@rrmdir(api_get_path(SYS_PATH).'courses');
201+
$originalCourseDir = api_get_path(SYS_PATH).'courses';
202+
203+
if (is_dir($originalCourseDir)) {
204+
$dirs = $finder->directories()->in($originalCourseDir);
205+
$files = $finder->directories()->in($originalCourseDir);
206+
$dirCount = $dirs->count();
207+
$fileCount = $dirs->count();
208+
if ($fileCount == 0 && $dirCount == 0) {
209+
@rrmdir(api_get_path(SYS_PATH).'courses');
210+
}
207211
}
208212

213+
214+
// Remove archive
215+
@rrmdir(api_get_path(SYS_PATH).'archive');
216+
209217
} else {
210218
echo 'You are not allowed here !'. __FILE__;
211219
}

0 commit comments

Comments
 (0)