update-files-1.10.0-1.11.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.10.0 to version 1.11.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. *
  11. * @package chamilo.install
  12. */
  13. error_log("Starting ".basename(__FILE__));
  14. global $debug;
  15. if (defined('SYSTEM_INSTALLATION')) {
  16. // Changes for 1.11.x
  17. // Delete directories and files that are not necessary anymore
  18. // The main/exercice path was moved to main/exercise, so the code from 1.11
  19. // should just create the new directory, and we should delete the previous
  20. // one to avoid the web server to use the old
  21. $exercisePath = api_get_path(SYS_CODE_PATH).'exercice';
  22. if (is_dir($exercisePath)) {
  23. @rrmdir($exercisePath);
  24. }
  25. // Same with main/newscorm, renamed main/lp
  26. $lpPath = api_get_path(SYS_CODE_PATH).'newscorm';
  27. if (is_dir($lpPath)) {
  28. @rrmdir($lpPath);
  29. }
  30. // The ticket plugin has been moved to core in 1.11
  31. $ticketPluginPath = api_get_path(SYS_PLUGIN_PATH).'ticket';
  32. if (is_dir($ticketPluginPath)) {
  33. @rrmdir($ticketPluginPath);
  34. }
  35. // The Skype plugin has been moved to core in 1.11
  36. $skypePluginPath = api_get_path(SYS_PLUGIN_PATH).'skype';
  37. if (is_dir($skypePluginPath)) {
  38. @rrmdir($skypePluginPath);
  39. }
  40. // Some entities have been removed in 1.11. Delete the corresponding files
  41. $entitiesToRemove = [
  42. api_get_path(SYS_PATH).'src/Chamilo/CoreBundle/Entity/Groups.php',
  43. api_get_path(SYS_PATH).'src/Chamilo/CoreBundle/Entity/GroupRelGroup.php',
  44. api_get_path(SYS_PATH).'src/Chamilo/CoreBundle/Entity/GroupRelTag.php',
  45. api_get_path(SYS_PATH).'src/Chamilo/CoreBundle/Entity/GroupRelUser.php',
  46. ];
  47. foreach ($entitiesToRemove as $entity) {
  48. if (file_exists($entity)) {
  49. $success = unlink($entity);
  50. if (!$success) {
  51. error_log('Could not delete '.$entity.', probably due to permissions. Please delete manually to avoid entities inconsistencies');
  52. }
  53. } else {
  54. error_log('Could not delete. It seems the file '.$entity.' does not exists.');
  55. }
  56. }
  57. $oldDefaultCertificatePath = api_get_path(SYS_CODE_PATH).'default_course_document/certificates/';
  58. if (is_dir($oldDefaultCertificatePath)) {
  59. @rrmdir($oldDefaultCertificatePath);
  60. }
  61. if ($debug) {
  62. error_log('Folders cleaned up');
  63. }
  64. } else {
  65. echo 'You are not allowed here !'.__FILE__;
  66. }