update-files-1.8.8-1.9.0.inc.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Chamilo LMS
  5. *
  6. * Updates the Chamilo files from version 1.8.8 to version 1.9.0
  7. * This script operates only in the case of an update, and only to change the
  8. * active version number (and other things that might need a change) in the
  9. * current configuration file.
  10. * @package chamilo.install
  11. */
  12. if (defined('SYSTEM_INSTALLATION')) {
  13. // Edit the configuration file
  14. $file = file(api_get_path(CONFIGURATION_PATH).'configuration.php');
  15. $fh = fopen(api_get_path(CONFIGURATION_PATH).'configuration.php', 'w');
  16. $found_version_old = false;
  17. $found_stable_old = false;
  18. $found_version = false;
  19. $found_stable = false;
  20. $found_software_name = false;
  21. $found_software_url = false;
  22. foreach ($file as $line) {
  23. $ignore = false;
  24. if (stripos($line,'$userPasswordCrypted') !== false) {
  25. $line = '$_configuration[\'password_encryption\'] = \''.($userPasswordCrypted).'\';'."\r\n";
  26. } elseif (stripos($line, '?>') !== false) {
  27. $ignore = true;
  28. }
  29. if (!$ignore) {
  30. fwrite($fh, $line);
  31. }
  32. }
  33. if (!$found_version) {
  34. fwrite($fh, '$_configuration[\'system_version\'] = \''.$new_version.'\';'."\r\n");
  35. }
  36. if (!$found_stable) {
  37. fwrite($fh, '$_configuration[\'system_stable\'] = '.($new_version_stable?'true':'false').';'."\r\n");
  38. }
  39. if (!$found_software_name) {
  40. fwrite($fh, '$_configuration[\'software_name\'] = \''.$software_name.'\';'."\r\n");
  41. }
  42. if (!$found_software_url) {
  43. fwrite($fh, '$_configuration[\'software_url\'] = \''.$software_url.'\';'."\r\n");
  44. }
  45. $string = <<<EOP
  46. //============================================================================
  47. // Hosting settings - Allows you to set limits to the Chamilo portal when
  48. // hosting it for a third party. These settings can be overwritten by an
  49. // optionally-loaded extension file with only the settings (no comments).
  50. //============================================================================
  51. // Set a maximum number of users. Default (0) = no limit
  52. $_configuration['hosting_limit_users'] = 0;
  53. // Set a maximum number of teachers. Default (0) = no limit
  54. $_configuration['hosting_limit_teachers'] = 0;
  55. // Set a maximum number of courses. Default (0) = no limit
  56. $_configuration['hosting_limit_courses'] = 0;
  57. // Set a maximum number of sessions. Default (0) = no limit
  58. $_configuration['hosting_limit_sessions'] = 0;
  59. // Set a maximum disk space used, in MB (set to 1024 for 1GB, 5120 for 5GB).
  60. // Default (0) = no limit
  61. $_configuration['hosting_limit_disk_space'] = 0;
  62. EOP;
  63. fwrite($fh,$string);
  64. fwrite($fh, '?>');
  65. fclose($fh);
  66. } else {
  67. echo 'You are not allowed here !';
  68. }