From 1fa4021da4a7fc2c555dc7778204ebfb0c5850ad Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Thu, 13 Aug 2015 21:45:54 -0500 Subject: [PATCH] Remove unused settings from database - refs #7792 --- .../Schema/V110/Version20150813200000.php | 91 +++++++++++++++++++ main/install/data.sql | 8 +- 2 files changed, 92 insertions(+), 7 deletions(-) create mode 100644 app/Migrations/Schema/V110/Version20150813200000.php diff --git a/app/Migrations/Schema/V110/Version20150813200000.php b/app/Migrations/Schema/V110/Version20150813200000.php new file mode 100644 index 0000000000..3cbf6c2d56 --- /dev/null +++ b/app/Migrations/Schema/V110/Version20150813200000.php @@ -0,0 +1,91 @@ +getEntityManager(); + + $deleteOptions = $entityManage->createQueryBuilder(); + $deleteSettings = $entityManage->createQueryBuilder(); + + $deleteOptions->delete('ChamiloCoreBundle:SettingsOptions', 'o') + ->andWhere( + $deleteOptions->expr()->in( + 'o.variable', + [ + 'math_mimetex', + 'enabled_asciisvg' + ] + ) + ); + $deleteOptions->getQuery()->execute(); + + $deleteSettings->delete('ChamiloCoreBundle:SettingsCurrent', 's') + ->andWhere( + $deleteSettings->expr()->in( + 's.variable', + [ + 'math_mimetex', + 'enabled_asciisvg' + ] + ) + ); + $deleteSettings->getQuery()->execute(); + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + $this->addSettingCurrent( + 'math_mimetex', + null, + 'radio', + 'Editor', + 'false', + 'MathMimetexTitle', + 'MathMimetexComment', + null, + null, + 1, + false, + true, + [ + 0 => ['value' => 'true', 'text' => 'Yes'], + 1 => ['value' => 'false', 'text' => 'No'] + ] + ); + $this->addSettingCurrent( + 'enabled_asciisvg', + null, + 'radio', + 'Editor', + 'false', + 'AsciiSvgTitle', + 'AsciiSvgComment', + null, + null, + 1, + false, + true, + [ + 0 => ['value' => 'true', 'text' => 'Yes'], + 1 => ['value' => 'false', 'text' => 'No'] + ] + ); + } +} diff --git a/main/install/data.sql b/main/install/data.sql index 09ff0ae6d5..671bf06fc5 100644 --- a/main/install/data.sql +++ b/main/install/data.sql @@ -169,9 +169,7 @@ VALUES ('show_glossary_in_extra_tools', NULL, 'radio', 'Course', 'none', 'ShowGlossaryInExtraToolsTitle', 'ShowGlossaryInExtraToolsComment', NULL, NULL,1), ('send_email_to_admin_when_create_course',NULL,'radio','Platform','false','SendEmailToAdminTitle','SendEmailToAdminComment',NULL,NULL, 1), ('go_to_course_after_login',NULL,'radio','Course','false','GoToCourseAfterLoginTitle','GoToCourseAfterLoginComment',NULL,NULL, 0), -('math_mimetex',NULL,'radio','Editor','false','MathMimetexTitle','MathMimetexComment',NULL,NULL, 0), ('math_asciimathML',NULL,'radio','Editor','false','MathASCIImathMLTitle','MathASCIImathMLComment',NULL,NULL, 0), -('enabled_asciisvg',NULL,'radio','Editor','false','AsciiSvgTitle','AsciiSvgComment',NULL,NULL, 0), ('include_asciimathml_script',NULL,'radio','Editor','false','IncludeAsciiMathMlTitle','IncludeAsciiMathMlComment',NULL,NULL, 0), ('youtube_for_students',NULL,'radio','Editor','true','YoutubeForStudentsTitle','YoutubeForStudentsComment',NULL,NULL, 0), ('block_copy_paste_for_students',NULL,'radio','Editor','false','BlockCopyPasteForStudentsTitle','BlockCopyPasteForStudentsComment',NULL,NULL, 0), @@ -477,12 +475,8 @@ VALUES ('send_email_to_admin_when_create_course','false','No'), ('go_to_course_after_login','true','Yes'), ('go_to_course_after_login','false','No'), -('math_mimetex','true','Yes'), -('math_mimetex','false','No'), ('math_asciimathML','true','Yes'), ('math_asciimathML','false','No'), -('enabled_asciisvg','true','Yes'), -('enabled_asciisvg','false','No'), ('include_asciimathml_script','true','Yes'), ('include_asciimathml_script','false','No'), ('youtube_for_students','true','Yes'), @@ -1816,4 +1810,4 @@ VALUES ('my_courses_view_by_session', 'true', 'Yes'), ('my_courses_view_by_session', 'false', 'No'); -UPDATE settings_current SET selected_value = '1.10.0.49' WHERE variable = 'chamilo_database_version'; +UPDATE settings_current SET selected_value = '1.10.0.50' WHERE variable = 'chamilo_database_version';