123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- <?php
- if (defined('SYSTEM_INSTALLATION')) {
-
- $file = file(api_get_path(CONFIGURATION_PATH) . 'configuration.php');
- $fh = fopen(api_get_path(CONFIGURATION_PATH) . 'configuration.php', 'w');
- $found_version = false;
- $found_stable = false;
- foreach ($file as $line) {
- $ignore = false;
- if (stripos($line, '$_configuration[\'dokeos_version\']') !== false) {
- $found_version = true;
- $line = '$_configuration[\'dokeos_version\'] = \'' . $new_version . '\';' . "\r\n";
- } elseif (stripos($line, '$_configuration[\'dokeos_stable\']') !== false) {
- $found_stable = true;
- $line = '$_configuration[\'dokeos_stable\'] = ' . ($new_version_stable ? 'true' : 'false') . ';' . "\r\n";
- } elseif (stripos($line, '$userPasswordCrypted') !== false) {
- $line = '$userPasswordCrypted = \'' . ($userPasswordCrypted) . '\';' . "\r\n";
- } elseif (stripos($line, '?>') !== false) {
-
- $ignore = true;
- }
- if (!$ignore) {
- fwrite($fh, $line);
- }
- }
- if (!$found_version) {
- fwrite($fh, '$_configuration[\'dokeos_version\'] = \'' . $new_version . '\';' . "\r\n");
- }
- if (!$found_stable) {
- fwrite($fh, '$_configuration[\'dokeos_stable\'] = ' . ($new_version_stable ? 'true' : 'false') . ';' . "\r\n");
- }
- fwrite($fh, '?>');
- fclose($fh);
- $sys_course_path = $pathForm . 'courses/';
-
-
-
-
- iDatabase::select_db($dbNameForm);
- $db_name = $dbNameForm;
- $sql = "SELECT * FROM $db_name.course";
- $app['monolog']->addInfo('Getting courses for files updates: ' . $sql);
- $result = iDatabase::query($sql);
- while ($courses_directories = iDatabase::fetch_array($result)) {
- $currentCourseRepositorySys = $sys_course_path . $courses_directories['directory'] . '/';
- $db_name = $courses_directories['db_name'];
- $origCRS = $updatePath . 'courses/' . $courses_directories['directory'];
- if (!is_dir($origCRS)) {
- $app['monolog']->addError('Directory ' . $origCRS . ' does not exist. Skipping.');
- continue;
- }
-
- $app['monolog']->addInfo('Renaming ' . $origCRS . ' to ' . $sys_course_path . $courses_directories['directory']);
- rename($origCRS, $sys_course_path . $courses_directories['directory']);
- $app['monolog']->addInfo('Creating dirs in ' . $currentCourseRepositorySys);
-
-
- if (!is_dir($currentCourseRepositorySys . "document/shared_folder")) {
- mkdir($currentCourseRepositorySys . "document/shared_folder", $perm);
- }
-
-
- if (!is_dir($currentCourseRepositorySys . "upload/forum/images")) {
- mkdir($currentCourseRepositorySys . "upload/forum/images", $perm);
- }
-
- if (!is_dir($currentCourseRepositorySys . "upload/learning_path")) {
- mkdir($currentCourseRepositorySys . "upload/learning_path", $perm);
- }
-
- if (!is_dir($currentCourseRepositorySys . "upload/learning_path/images")) {
- mkdir($currentCourseRepositorySys . "upload/learning_path/images", $perm);
- }
-
- if (!is_dir($currentCourseRepositorySys . "upload/calendar")) {
- mkdir($currentCourseRepositorySys . "upload/calendar", $perm);
- }
-
- if (!is_dir($currentCourseRepositorySys . "upload/calendar/images")) {
- mkdir($currentCourseRepositorySys . "upload/calendar/images", $perm);
- }
- }
- } else {
- echo 'You are not allowed here !' . __FILE__;
- }
|