Version20150803163400.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. namespace Application\Migrations\Schema\V110;
  4. use Application\Migrations\AbstractMigrationChamilo;
  5. use Doctrine\DBAL\Schema\Schema;
  6. /**
  7. * Class Version20150803163400
  8. *
  9. * @package Application\Migrations\Schema\V11010
  10. */
  11. class Version20150803163400 extends AbstractMigrationChamilo
  12. {
  13. /**
  14. * @param Schema $schema
  15. */
  16. public function up(Schema $schema)
  17. {
  18. $this->addSettingCurrent(
  19. 'cron_remind_course_expiration_activate',
  20. null,
  21. 'radio',
  22. 'Crons',
  23. 'false',
  24. 'CronRemindCourseExpirationActivateTitle',
  25. 'CronRemindCourseExpirationActivateComment',
  26. null,
  27. null,
  28. 1,
  29. true,
  30. false,
  31. [
  32. 0 => ['value' => 'true', 'text' => 'Yes'],
  33. 1 => ['value' => 'false', 'text' => 'No']
  34. ]
  35. );
  36. $this->addSettingCurrent(
  37. 'cron_remind_course_expiration_frequency',
  38. null,
  39. 'textfield',
  40. 'Crons',
  41. '2',
  42. 'CronRemindCourseExpirationFrecuenqyTitle',
  43. 'CronRemindCourseExpirationFrecuenqyComment',
  44. null,
  45. null,
  46. 1,
  47. true,
  48. false
  49. );
  50. $this->addSettingCurrent(
  51. 'cron_course_finished_activate',
  52. null,
  53. 'radio',
  54. 'Crons',
  55. 'false',
  56. 'CronCourseFinishedActivateTitle',
  57. 'CronCourseFinishedActivateComment',
  58. null,
  59. null,
  60. 1,
  61. true,
  62. false,
  63. [
  64. 0 => ['value' => 'true', 'text' => 'Yes'],
  65. 1 => ['value' => 'false', 'text' => 'No']
  66. ]
  67. );
  68. }
  69. /**
  70. * @param Schema $schema
  71. */
  72. public function down(Schema $schema)
  73. {
  74. $entityManage = $this->getEntityManager();
  75. $deleteOptions = $entityManage->createQueryBuilder();
  76. $deleteOptions->delete('ChamiloCoreBundle:SettingsOptions', 'o')
  77. ->andWhere(
  78. $deleteOptions->expr()->in(
  79. 'o.variable',
  80. [
  81. 'cron_remind_course_expiration_activate',
  82. 'cron_course_finished_activate'
  83. ]
  84. )
  85. );
  86. $deleteOptions->getQuery()->execute();
  87. $deleteSettings = $entityManage->createQueryBuilder();
  88. $deleteSettings->delete('ChamiloCoreBundle:SettingsCurrent', 's')
  89. ->andWhere(
  90. $deleteSettings->expr()->in(
  91. 's.variable',
  92. [
  93. 'cron_remind_course_expiration_activate',
  94. 'cron_remind_course_expiration_frequency',
  95. 'cron_course_finished_activate'
  96. ]
  97. )
  98. );
  99. $deleteSettings->getQuery()->execute();
  100. }
  101. }