update-configuration.inc.php 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. *
  5. * Chamilo LMS
  6. *
  7. * Only updates the main/inc/conf/configuration.php file with the new version use only from 1.8.8.1 to 1.8.8.2 (with no DB changes)
  8. * @package chamilo.install
  9. */
  10. use Symfony\Component\Yaml\Dumper;
  11. if (defined('SYSTEM_INSTALLATION')) {
  12. $app['monolog']->addInfo("Starting " . basename(__FILE__));
  13. //Creating app/config/configuration.yml
  14. global $_configuration;
  15. $_configuration['system_version'] = $new_version;
  16. $_configuration['system_stable'] = $new_version_stable ? 'true' : 'false';
  17. $_configuration['software_name'] = isset($software_name) ? $software_name : 'chamilo';
  18. $_configuration['software_url'] = isset($software_url) ? $software_url : 'chamilo';
  19. $_configuration['password_encryption'] = isset($userPasswordCrypted) ? $userPasswordCrypted : $_configuration['password_encryption'];
  20. $dumper = new Dumper();
  21. //removing useless indexes before saving in the configuration file
  22. unset($_configuration['dokeos_version']);
  23. unset($_configuration['dokeos_stable']);
  24. unset($_configuration['code_append']);
  25. unset($_configuration['course_folder']);
  26. $yaml = $dumper->dump($_configuration, 2); //inline
  27. $newConfigurationFile = api_get_path(SYS_CONFIG_PATH).'configuration.yml';
  28. file_put_contents($newConfigurationFile, $yaml);
  29. //Moving files in app/config
  30. if (file_exists(api_get_path(CONFIGURATION_PATH).'mail.conf.php')) {
  31. copy(api_get_path(CONFIGURATION_PATH).'mail.conf.php', api_get_path(SYS_CONFIG_PATH).'mail.conf.php');
  32. unlink(api_get_path(CONFIGURATION_PATH).'mail.conf.php');
  33. }
  34. if (file_exists(api_get_path(CONFIGURATION_PATH).'auth.conf.php')) {
  35. copy(api_get_path(CONFIGURATION_PATH).'auth.conf.php', api_get_path(SYS_CONFIG_PATH).'auth.conf.php');
  36. unlink(api_get_path(CONFIGURATION_PATH).'auth.conf.php');
  37. }
  38. if (file_exists(api_get_path(CONFIGURATION_PATH).'events.conf.php')) {
  39. copy(api_get_path(CONFIGURATION_PATH).'events.conf.php', api_get_path(SYS_CONFIG_PATH).'events.conf.php');
  40. unlink(api_get_path(CONFIGURATION_PATH).'events.conf.php');
  41. }
  42. if (file_exists(api_get_path(CONFIGURATION_PATH).'mail.conf.php')) {
  43. copy(api_get_path(CONFIGURATION_PATH).'mail.conf.php', api_get_path(SYS_CONFIG_PATH).'mail.conf.php');
  44. unlink(api_get_path(CONFIGURATION_PATH).'mail.conf.php');
  45. }
  46. if (file_exists(api_get_path(CONFIGURATION_PATH).'portfolio.conf.php')) {
  47. copy(api_get_path(CONFIGURATION_PATH).'portfolio.conf.php', api_get_path(SYS_CONFIG_PATH).'portfolio.conf.php');
  48. unlink(api_get_path(CONFIGURATION_PATH).'portfolio.conf.php');
  49. }
  50. if (file_exists(api_get_path(CONFIGURATION_PATH).'profile.conf.php')) {
  51. copy(api_get_path(CONFIGURATION_PATH).'profile.conf.php', api_get_path(SYS_CONFIG_PATH).'profile.conf.php');
  52. unlink(api_get_path(CONFIGURATION_PATH).'profile.conf.php');
  53. }
  54. }