Migrations: adapting current_settings to settings in all migrations

pull/5639/head
NicoDucou 5 months ago
parent ef441c5b6e
commit d46da80405
  1. 40
      src/CoreBundle/Migrations/Schema/V200/Version20170627122900.php
  2. 8
      src/CoreBundle/Migrations/Schema/V200/Version20201215072917.php
  3. 2
      src/CoreBundle/Migrations/Schema/V200/Version20210205082253.php
  4. 14
      src/CoreBundle/Migrations/Schema/V200/Version20230216122900.php
  5. 6
      src/CoreBundle/Migrations/Schema/V200/Version20240122221400.php
  6. 14
      src/CoreBundle/Migrations/Schema/V200/Version20240404164500.php
  7. 6
      src/CoreBundle/Migrations/Schema/V200/Version20240414120300.php
  8. 90
      src/CoreBundle/Migrations/Schema/V200/Version20240423101010.php
  9. 6
      src/CoreBundle/Migrations/Schema/V200/Version20240506164100.php
  10. 2
      src/CoreBundle/Migrations/Schema/V200/Version20240507160300.php

@ -15,38 +15,38 @@ class Version20170627122900 extends AbstractMigrationChamilo
{
public function getDescription(): string
{
return 'settings_current changes';
return 'settings changes';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE settings_current CHANGE access_url access_url INT DEFAULT NULL');
$this->addSql("UPDATE settings_current SET selected_value = 'true' WHERE variable = 'decode_utf8'");
$this->addSql('ALTER TABLE settings CHANGE access_url access_url INT DEFAULT NULL');
$this->addSql("UPDATE settings SET selected_value = 'true' WHERE variable = 'decode_utf8'");
// Use .env APP_ENV setting to change server type
// $this->addSql("DELETE FROM settings_current WHERE variable = 'server_type'");
// $this->addSql("DELETE FROM settings WHERE variable = 'server_type'");
$table = $schema->getTable('settings_current');
$table = $schema->getTable('settings');
if (false === $table->hasForeignKey('FK_62F79C3B9436187B')) {
$this->addSql(
'ALTER TABLE settings_current ADD CONSTRAINT FK_62F79C3B9436187B FOREIGN KEY (access_url) REFERENCES access_url (id);'
'ALTER TABLE settings ADD CONSTRAINT FK_62F79C3B9436187B FOREIGN KEY (access_url) REFERENCES access_url (id);'
);
}
$this->addSql(
'ALTER TABLE settings_current CHANGE variable variable VARCHAR(190) NOT NULL, CHANGE subkey subkey VARCHAR(190) DEFAULT NULL, CHANGE selected_value selected_value LONGTEXT DEFAULT NULL;'
'ALTER TABLE settings CHANGE variable variable VARCHAR(190) NOT NULL, CHANGE subkey subkey VARCHAR(190) DEFAULT NULL, CHANGE selected_value selected_value LONGTEXT DEFAULT NULL;'
);
$this->addSql('ALTER TABLE settings_options CHANGE value value VARCHAR(190) DEFAULT NULL');
$result = $this->connection
->executeQuery(
"SELECT COUNT(1) FROM settings_current WHERE variable = 'exercise_invisible_in_session' AND category = 'Session'"
"SELECT COUNT(1) FROM settings WHERE variable = 'exercise_invisible_in_session' AND category = 'Session'"
)
;
$count = $result->fetchNumeric()[0];
if (empty($count)) {
$this->addSql(
"INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('exercise_invisible_in_session',NULL,'radio','Session','false','ExerciseInvisibleInSessionTitle','ExerciseInvisibleInSessionComment','',NULL, 1)"
"INSERT INTO settings (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('exercise_invisible_in_session',NULL,'radio','Session','false','ExerciseInvisibleInSessionTitle','ExerciseInvisibleInSessionComment','',NULL, 1)"
);
$this->addSql(
"INSERT INTO settings_options (variable, value, display_text) VALUES ('exercise_invisible_in_session','true','Yes')"
@ -57,13 +57,13 @@ class Version20170627122900 extends AbstractMigrationChamilo
}
$result = $this->connection->executeQuery(
"SELECT COUNT(1) FROM settings_current WHERE variable = 'configure_exercise_visibility_in_course' AND category = 'Session'"
"SELECT COUNT(1) FROM settings WHERE variable = 'configure_exercise_visibility_in_course' AND category = 'Session'"
);
$count = $result->fetchNumeric()[0];
if (empty($count)) {
$this->addSql(
"INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('configure_exercise_visibility_in_course',NULL,'radio','Session','false','ConfigureExerciseVisibilityInCourseTitle','ConfigureExerciseVisibilityInCourseComment','',NULL, 1)"
"INSERT INTO settings (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('configure_exercise_visibility_in_course',NULL,'radio','Session','false','ConfigureExerciseVisibilityInCourseTitle','ConfigureExerciseVisibilityInCourseComment','',NULL, 1)"
);
$this->addSql(
"INSERT INTO settings_options (variable, value, display_text) VALUES ('configure_exercise_visibility_in_course','true','Yes')"
@ -113,7 +113,7 @@ class Version20170627122900 extends AbstractMigrationChamilo
];
foreach ($settings as $oldSetting => $newSetting) {
$sql = "UPDATE settings_current SET variable = '{$newSetting}'
$sql = "UPDATE settings SET variable = '{$newSetting}'
WHERE variable = '{$oldSetting}'";
$this->addSql($sql);
}
@ -279,7 +279,7 @@ class Version20170627122900 extends AbstractMigrationChamilo
];
foreach ($settings as $variable => $category) {
$sql = "UPDATE settings_current SET category = '{$category}'
$sql = "UPDATE settings SET category = '{$category}'
WHERE variable = '{$variable}'";
$this->addSql($sql);
}
@ -290,12 +290,12 @@ class Version20170627122900 extends AbstractMigrationChamilo
];
foreach ($settings as $variable => $value) {
$sql = "UPDATE settings_current SET selected_value = '{$value}'
$sql = "UPDATE settings SET selected_value = '{$value}'
WHERE variable = '{$variable}'";
$this->addSql($sql);
}
$this->addSql("UPDATE settings_current SET selected_value = ''
$this->addSql("UPDATE settings SET selected_value = ''
WHERE variable = 'platform_language' AND selected_value IS NULL");
// Delete settings
@ -321,11 +321,11 @@ class Version20170627122900 extends AbstractMigrationChamilo
];
foreach ($settings as $setting) {
$sql = "DELETE FROM settings_current WHERE variable = '{$setting}'";
$sql = "DELETE FROM settings WHERE variable = '{$setting}'";
$this->addSql($sql);
}
$this->addSql('UPDATE settings_current SET category = LOWER(category)');
$this->addSql('UPDATE settings SET category = LOWER(category)');
// ticket configuration
$ticketProjectUserRoles = $this->getConfigurationValue('ticket_project_user_roles');
@ -340,20 +340,20 @@ class Version20170627122900 extends AbstractMigrationChamilo
$selectedValue = implode(PHP_EOL, $selectedValue);
$this->addSql(
"INSERT INTO settings_current (access_url, variable, category, selected_value, title, access_url_changeable, access_url_locked) VALUES (1, 'ticket_project_user_roles', 'Ticket', '$selectedValue', 'ticket_project_user_roles', 1, 1)"
"INSERT INTO settings (access_url, variable, category, selected_value, title, access_url_changeable, access_url_locked) VALUES (1, 'ticket_project_user_roles', 'Ticket', '$selectedValue', 'ticket_project_user_roles', 1, 1)"
);
}
// social configurations
if ($this->getConfigurationValue('social_enable_messages_feedback')) {
$this->addSql(
"INSERT INTO settings_current (access_url, variable, category, selected_value, title, access_url_changeable, access_url_locked) VALUES (1, 'social_enable_messages_feedback', 'Social', 'true', 'social_enable_messages_feedback', 1, 1)"
"INSERT INTO settings (access_url, variable, category, selected_value, title, access_url_changeable, access_url_locked) VALUES (1, 'social_enable_messages_feedback', 'Social', 'true', 'social_enable_messages_feedback', 1, 1)"
);
}
if ($this->getConfigurationValue('disable_dislike_option')) {
$this->addSql(
"INSERT INTO settings_current (access_url, variable, category, selected_value, title, access_url_changeable, access_url_locked) VALUES (1, 'disable_dislike_option', 'Social', 'true', 'disable_dislike_option', 1, 1)"
"INSERT INTO settings (access_url, variable, category, selected_value, title, access_url_changeable, access_url_locked) VALUES (1, 'disable_dislike_option', 'Social', 'true', 'disable_dislike_option', 1, 1)"
);
}
}

@ -18,17 +18,17 @@ class Version20201215072917 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$settingExists = $this->connection->fetchOne("SELECT COUNT(*) FROM settings_current WHERE variable = 'allow_careers_in_global_agenda'");
$settingExists = $this->connection->fetchOne("SELECT COUNT(*) FROM settings WHERE variable = 'allow_careers_in_global_agenda'");
$selectedValue = $this->getConfigurationSelectedValue();
if (0 == $settingExists) {
$this->addSql(
"INSERT INTO settings_current (access_url, variable, category, selected_value, title, access_url_changeable, access_url_locked) VALUES (1, 'allow_careers_in_global_agenda', 'agenda', '$selectedValue', 'Allow careers and promotions in global agenda', 1, 0)"
"INSERT INTO settings (access_url, variable, category, selected_value, title, access_url_changeable, access_url_locked) VALUES (1, 'allow_careers_in_global_agenda', 'agenda', '$selectedValue', 'Allow careers and promotions in global agenda', 1, 0)"
);
} else {
$this->addSql(
"UPDATE settings_current SET selected_value = '$selectedValue' WHERE variable = 'allow_careers_in_global_agenda'"
"UPDATE settings SET selected_value = '$selectedValue' WHERE variable = 'allow_careers_in_global_agenda'"
);
}
@ -65,7 +65,7 @@ class Version20201215072917 extends AbstractMigrationChamilo
public function down(Schema $schema): void
{
$this->addSql("DELETE FROM settings_current WHERE variable = 'allow_careers_in_global_agenda'");
$this->addSql("DELETE FROM settings WHERE variable = 'allow_careers_in_global_agenda'");
if ($schema->getTable('c_calendar_event')->hasColumn('career_id')) {
$this->addSql('ALTER TABLE c_calendar_event DROP FOREIGN KEY FK_C_CALENDAR_EVENT_CAREER');

@ -34,7 +34,7 @@ final class Version20210205082253 extends AbstractMigrationChamilo
$counter = 1;
$q = $this->entityManager->createQuery('SELECT u FROM Chamilo\CoreBundle\Entity\User u');
$sql = "SELECT * FROM settings_current WHERE variable = 'split_users_upload_directory' AND access_url = 1";
$sql = "SELECT * FROM settings WHERE variable = 'split_users_upload_directory' AND access_url = 1";
$result = $this->connection->executeQuery($sql);
$setting = $result->fetchAssociative();

@ -17,7 +17,7 @@ class Version20230216122900 extends AbstractMigrationChamilo
{
public function getDescription(): string
{
return 'Migrate configuration values to settings_current';
return 'Migrate configuration values to settings';
}
public function up(Schema $schema): void
@ -30,7 +30,7 @@ class Version20230216122900 extends AbstractMigrationChamilo
$category = strtolower($category);
$result = $this->connection
->executeQuery(
"SELECT COUNT(1) FROM settings_current WHERE variable = '$variable' AND category = '{$category}'"
"SELECT COUNT(1) FROM settings WHERE variable = '$variable' AND category = '{$category}'"
)
;
$count = $result->fetchNumeric()[0];
@ -43,11 +43,11 @@ class Version20230216122900 extends AbstractMigrationChamilo
}
if (empty($count)) {
$this->addSql(
"INSERT INTO settings_current (access_url, variable, category, selected_value, title, access_url_changeable, access_url_locked) VALUES (1, '{$variable}', '{$category}', '{$selectedValue}', '{$variable}', 1, 1)"
"INSERT INTO settings (access_url, variable, category, selected_value, title, access_url_changeable, access_url_locked) VALUES (1, '{$variable}', '{$category}', '{$selectedValue}', '{$variable}', 1, 1)"
);
} else {
$this->addSql(
"UPDATE settings_current SET selected_value = '{$selectedValue}', category = '{$category}' WHERE variable = '$variable' AND category = '{$category}'"
"UPDATE settings SET selected_value = '{$selectedValue}', category = '{$category}' WHERE variable = '$variable' AND category = '{$category}'"
);
}
}
@ -55,7 +55,7 @@ class Version20230216122900 extends AbstractMigrationChamilo
// Rename setting for hierarchical skill presentation.
$this->addSql(
"UPDATE settings_current SET variable = 'skills_hierarchical_view_in_user_tracking', title = 'skills_hierarchical_view_in_user_tracking' WHERE variable = 'table_of_hierarchical_skill_presentation'"
"UPDATE settings SET variable = 'skills_hierarchical_view_in_user_tracking', title = 'skills_hierarchical_view_in_user_tracking' WHERE variable = 'table_of_hierarchical_skill_presentation'"
);
// Insert extra fields required.
@ -248,13 +248,13 @@ class Version20230216122900 extends AbstractMigrationChamilo
$category = strtolower($category);
$result = $this->connection
->executeQuery(
"SELECT COUNT(1) FROM settings_current WHERE variable = '$variable' AND category = '$category'"
"SELECT COUNT(1) FROM settings WHERE variable = '$variable' AND category = '$category'"
)
;
$count = $result->fetchNumeric()[0];
if (!empty($count)) {
$this->addSql(
"DELETE FROM settings_current WHERE variable = '{$variable}' AND category = '$category'"
"DELETE FROM settings WHERE variable = '{$variable}' AND category = '$category'"
);
}
}

@ -58,10 +58,10 @@ final class Version20240122221400 extends AbstractMigrationChamilo
$this->connection->executeStatement($updateLanguageQuery, [$newIsoCode, $sublanguage['id']]);
error_log('Updated language table for id '.$sublanguage['id']);
// Check and update in settings_current
$updateSettingsQuery = "UPDATE settings_current SET selected_value = ? WHERE variable = 'platform_language' AND selected_value = ?";
// Check and update in settings
$updateSettingsQuery = "UPDATE settings SET selected_value = ? WHERE variable = 'platform_language' AND selected_value = ?";
$this->connection->executeStatement($updateSettingsQuery, [$newIsoCode, $sublanguage['english_name']]);
error_log('Updated settings_current for language '.$sublanguage['english_name']);
error_log('Updated settings for language '.$sublanguage['english_name']);
// Check and update in user table
$updateUserQuery = 'UPDATE user SET locale = ? WHERE locale = ?';

@ -13,22 +13,22 @@ final class Version20240404164500 extends AbstractMigrationChamilo
{
public function getDescription(): string
{
return 'Alter "title" and "comment" fields in settings_current table';
return 'Alter "title" and "comment" fields in settings table';
}
public function up(Schema $schema): void
{
if ($schema->hasTable('settings_current')) {
$this->addSql('ALTER TABLE settings_current MODIFY COLUMN title TEXT NOT NULL');
$this->addSql('ALTER TABLE settings_current MODIFY COLUMN comment TEXT');
if ($schema->hasTable('settings')) {
$this->addSql('ALTER TABLE settings MODIFY COLUMN title TEXT NOT NULL');
$this->addSql('ALTER TABLE settings MODIFY COLUMN comment TEXT');
}
}
public function down(Schema $schema): void
{
if ($schema->hasTable('settings_current')) {
$this->addSql('ALTER TABLE settings_current MODIFY COLUMN title VARCHAR(255) NOT NULL');
$this->addSql('ALTER TABLE settings_current MODIFY COLUMN comment VARCHAR(255)');
if ($schema->hasTable('settings')) {
$this->addSql('ALTER TABLE settings MODIFY COLUMN title VARCHAR(255) NOT NULL');
$this->addSql('ALTER TABLE settings MODIFY COLUMN comment VARCHAR(255)');
}
}
}

@ -14,7 +14,7 @@ class Version20240414120300 extends AbstractMigrationChamilo
{
public function getDescription(): string
{
return 'Update configuration title and comment values in settings_current';
return 'Update configuration title and comment values in settings';
}
public function up(Schema $schema): void
@ -29,13 +29,13 @@ class Version20240414120300 extends AbstractMigrationChamilo
foreach ($settingsToUpdate as $settingData) {
$variableExists = $this->connection->fetchOne(
'SELECT COUNT(*) FROM settings_current WHERE variable = ?',
'SELECT COUNT(*) FROM settings WHERE variable = ?',
[$settingData['name']]
);
if ($variableExists) {
$this->addSql(
'UPDATE settings_current SET title = :title, comment = :comment WHERE variable = :name',
'UPDATE settings SET title = :title, comment = :comment WHERE variable = :name',
[
'title' => $settingData['title'],
'comment' => $settingData['comment'],

@ -13,61 +13,61 @@ class Version20240423101010 extends AbstractMigrationChamilo
{
public function getDescription(): string
{
return 'Clean up settings_current table from settings if those were previously added (during development). Does not affect production environment migrating properly.';
return 'Clean up settings table from settings if those were previously added (during development). Does not affect production environment migrating properly.';
}
public function up(Schema $schema): void
{
if ($schema->hasTable('settings_current')) {
if ($schema->hasTable('settings')) {
// Adding author_id and setting the foreign key
$this->addSql('DELETE FROM settings_current WHERE variable = "announcements_hide_send_to_hrm_users"');
$this->addSql('DELETE FROM settings_current WHERE variable = "display_upcoming_events"');
$this->addSql('DELETE FROM settings_current WHERE variable = "hide_header_footer"');
$this->addSql('DELETE FROM settings_current WHERE variable = "homepage_view"');
$this->addSql('DELETE FROM settings_current WHERE variable = "show_tool_shortcuts"');
$this->addSql('DELETE FROM settings_current WHERE variable = "enable_wami_record"');
$this->addSql('DELETE FROM settings_current WHERE variable = "allow_personal_user_files"');
$this->addSql('DELETE FROM settings_current WHERE variable = "if_file_exists_option"');
$this->addSql('DELETE FROM settings_current WHERE variable = "math_mimetex"');
$this->addSql('DELETE FROM settings_current WHERE variable = "quiz_question_allow_inter_course_linking"');
$this->addSql('DELETE FROM settings_current WHERE variable = "gradebook_show_percentage_in_reports"');
$this->addSql('DELETE FROM settings_current WHERE variable = "gradebook_enable_best_score"');
$this->addSql('DELETE FROM settings_current WHERE variable = "fixed_encoding"');
$this->addSql('DELETE FROM settings_current WHERE variable = "hosting_total_size_limit"');
$this->addSql('DELETE FROM settings_current WHERE variable = "mail_template_system"');
$this->addSql('DELETE FROM settings_current WHERE variable = "cron_notification_mails"');
$this->addSql('DELETE FROM settings_current WHERE variable = "enable_message_tags"');
$this->addSql('DELETE FROM settings_current WHERE variable = "keep_old_images_after_delete"');
$this->addSql('DELETE FROM settings_current WHERE variable = "theme_fallback"');
$this->addSql('DELETE FROM settings_current WHERE variable = "sync_db_with_schema"');
$this->addSql('DELETE FROM settings_current WHERE variable = "allow_portfolio_tool"');
$this->addSql('DELETE FROM settings_current WHERE variable = "session_stored_in_db_as_backup"');
$this->addSql('DELETE FROM settings_current WHERE variable = "memcache_server"');
$this->addSql('DELETE FROM settings_current WHERE variable = "session_stored_after_n_times"');
$this->addSql('DELETE FROM settings_current WHERE variable = "default_template"');
$this->addSql('DELETE FROM settings_current WHERE variable = "aspell_bin"');
$this->addSql('DELETE FROM settings_current WHERE variable = "aspell_opts"');
$this->addSql('DELETE FROM settings_current WHERE variable = "aspell_temp_dir"');
$this->addSql('DELETE FROM settings_current WHERE variable = "plugin_settings"');
$this->addSql('DELETE FROM settings_current WHERE variable = "is_editable"');
$this->addSql('DELETE FROM settings_current WHERE variable = "number_of_upcoming_events"');
$this->addSql('DELETE FROM settings_current WHERE variable = "allow_browser_sniffer"');
$this->addSql('DELETE FROM settings_current WHERE variable = "session_tutor_reports_visibility"');
$this->addSql('DELETE FROM settings_current WHERE variable = "session_page_enabled"');
$this->addSql('DELETE FROM settings_current WHERE variable = "allow_session_status"');
$this->addSql('DELETE FROM settings_current WHERE variable = "allow_required_survey_questions"');
$this->addSql('DELETE FROM settings_current WHERE variable = "allow_survey_availability_datetime"');
$this->addSql('DELETE FROM settings_current WHERE variable = "survey_question_dependency"');
$this->addSql('DELETE FROM settings_current WHERE variable = "allow_mandatory_survey"');
$this->addSql('DELETE FROM settings_current WHERE variable = "allow_survey_tool_in_lp"');
$this->addSql('DELETE FROM settings_current WHERE variable = "decode_utf8"');
$this->addSql('DELETE FROM settings_current WHERE variable = "admin_chamilo_announcements_disable"');
$this->addSql('DELETE FROM settings WHERE variable = "announcements_hide_send_to_hrm_users"');
$this->addSql('DELETE FROM settings WHERE variable = "display_upcoming_events"');
$this->addSql('DELETE FROM settings WHERE variable = "hide_header_footer"');
$this->addSql('DELETE FROM settings WHERE variable = "homepage_view"');
$this->addSql('DELETE FROM settings WHERE variable = "show_tool_shortcuts"');
$this->addSql('DELETE FROM settings WHERE variable = "enable_wami_record"');
$this->addSql('DELETE FROM settings WHERE variable = "allow_personal_user_files"');
$this->addSql('DELETE FROM settings WHERE variable = "if_file_exists_option"');
$this->addSql('DELETE FROM settings WHERE variable = "math_mimetex"');
$this->addSql('DELETE FROM settings WHERE variable = "quiz_question_allow_inter_course_linking"');
$this->addSql('DELETE FROM settings WHERE variable = "gradebook_show_percentage_in_reports"');
$this->addSql('DELETE FROM settings WHERE variable = "gradebook_enable_best_score"');
$this->addSql('DELETE FROM settings WHERE variable = "fixed_encoding"');
$this->addSql('DELETE FROM settings WHERE variable = "hosting_total_size_limit"');
$this->addSql('DELETE FROM settings WHERE variable = "mail_template_system"');
$this->addSql('DELETE FROM settings WHERE variable = "cron_notification_mails"');
$this->addSql('DELETE FROM settings WHERE variable = "enable_message_tags"');
$this->addSql('DELETE FROM settings WHERE variable = "keep_old_images_after_delete"');
$this->addSql('DELETE FROM settings WHERE variable = "theme_fallback"');
$this->addSql('DELETE FROM settings WHERE variable = "sync_db_with_schema"');
$this->addSql('DELETE FROM settings WHERE variable = "allow_portfolio_tool"');
$this->addSql('DELETE FROM settings WHERE variable = "session_stored_in_db_as_backup"');
$this->addSql('DELETE FROM settings WHERE variable = "memcache_server"');
$this->addSql('DELETE FROM settings WHERE variable = "session_stored_after_n_times"');
$this->addSql('DELETE FROM settings WHERE variable = "default_template"');
$this->addSql('DELETE FROM settings WHERE variable = "aspell_bin"');
$this->addSql('DELETE FROM settings WHERE variable = "aspell_opts"');
$this->addSql('DELETE FROM settings WHERE variable = "aspell_temp_dir"');
$this->addSql('DELETE FROM settings WHERE variable = "plugin_settings"');
$this->addSql('DELETE FROM settings WHERE variable = "is_editable"');
$this->addSql('DELETE FROM settings WHERE variable = "number_of_upcoming_events"');
$this->addSql('DELETE FROM settings WHERE variable = "allow_browser_sniffer"');
$this->addSql('DELETE FROM settings WHERE variable = "session_tutor_reports_visibility"');
$this->addSql('DELETE FROM settings WHERE variable = "session_page_enabled"');
$this->addSql('DELETE FROM settings WHERE variable = "allow_session_status"');
$this->addSql('DELETE FROM settings WHERE variable = "allow_required_survey_questions"');
$this->addSql('DELETE FROM settings WHERE variable = "allow_survey_availability_datetime"');
$this->addSql('DELETE FROM settings WHERE variable = "survey_question_dependency"');
$this->addSql('DELETE FROM settings WHERE variable = "allow_mandatory_survey"');
$this->addSql('DELETE FROM settings WHERE variable = "allow_survey_tool_in_lp"');
$this->addSql('DELETE FROM settings WHERE variable = "decode_utf8"');
$this->addSql('DELETE FROM settings WHERE variable = "admin_chamilo_announcements_disable"');
}
}
public function down(Schema $schema): void
{
if ($schema->hasTable('settings_current')) {
if ($schema->hasTable('settings')) {
// There is no reversion because this is a clean-up of issues fixed later during development
}
}

@ -15,14 +15,14 @@ class Version20240506164100 extends AbstractMigrationChamilo
{
$selectedMailValue = $this->getMailConfigurationValueFromFile('SMTP_UNIQUE_SENDER') ? 'true' : 'false';
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url, access_url_changeable, access_url_locked) VALUES ('smtp_unique_sender', null, null, 'mail', '$selectedMailValue', 'smtp_unique_sender', null, '', null, 1, 1, 1)");
$this->addSql("INSERT INTO settings (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url, access_url_changeable, access_url_locked) VALUES ('smtp_unique_sender', null, null, 'mail', '$selectedMailValue', 'smtp_unique_sender', null, '', null, 1, 1, 1)");
$selectedMailValue = $this->getMailConfigurationValueFromFile('SMTP_FROM_EMAIL');
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url, access_url_changeable, access_url_locked) VALUES ('smtp_from_email', null, null, 'mail', '$selectedMailValue', 'smtp_from_email', null, '', null, 1, 1, 1)");
$this->addSql("INSERT INTO settings (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url, access_url_changeable, access_url_locked) VALUES ('smtp_from_email', null, null, 'mail', '$selectedMailValue', 'smtp_from_email', null, '', null, 1, 1, 1)");
$selectedMailValue = $this->getMailConfigurationValueFromFile('SMTP_FROM_NAME');
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url, access_url_changeable, access_url_locked) VALUES ('smtp_from_name', null, null, 'mail', '$selectedMailValue', 'smtp_from_name', null, '', null, 1, 1, 1)");
$this->addSql("INSERT INTO settings (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url, access_url_changeable, access_url_locked) VALUES ('smtp_from_name', null, null, 'mail', '$selectedMailValue', 'smtp_from_name', null, '', null, 1, 1, 1)");
}
}

@ -69,7 +69,7 @@ final class Version20240507160300 extends AbstractMigrationChamilo
private function fetchSplitSetting(): array
{
$sql = "SELECT * FROM settings_current WHERE variable = 'split_users_upload_directory' AND access_url = 1";
$sql = "SELECT * FROM settings WHERE variable = 'split_users_upload_directory' AND access_url = 1";
$result = $this->connection->executeQuery($sql);
return $result->fetchAssociative() ?? [];

Loading…
Cancel
Save