diff --git a/src/CoreBundle/DataFixtures/SettingsCurrentFixtures.php b/src/CoreBundle/DataFixtures/SettingsCurrentFixtures.php index 8a6dbba4c63..77721ac925f 100644 --- a/src/CoreBundle/DataFixtures/SettingsCurrentFixtures.php +++ b/src/CoreBundle/DataFixtures/SettingsCurrentFixtures.php @@ -1154,13 +1154,13 @@ public static function getExistingSettings(): array ], [ 'name' => 'mailer_from_email', - 'title' => "Mail: 'From' address", - 'comment' => "The e-mail address from which e-mails will be sent when the platform sends an e-mail, also used as 'reply-to' header. We recommend using a 'no-reply' e-mail address here, to avoid excessive filling of an e-mail box. The support e-mail address defined in the Platform section should be used to contact you, but replying to automatic notifications should not be encouraged.", + 'title' => 'Send all e-mails from this e-mail address', + 'comment' => 'Sets the default email address used in the "from" field of emails.', ], [ 'name' => 'mailer_from_name', - 'title' => "Mail: 'From' name", - 'comment' => 'The name that appears as the sender (next to the From e-mail address) when the platform sends an e-mail.', + 'title' => 'Send all e-mails as originating from this (organizational) name', + 'comment' => 'Sets the default display name used for sending platform emails. e.g. "Support team".', ], [ 'name' => 'mailer_mails_charset', @@ -3084,16 +3084,6 @@ public static function getNewConfigurationSettings(): array ], ], 'mail' => [ - [ - 'name' => 'mailer_from_name', - 'title' => 'Send all e-mails from this e-mail address', - 'comment' => 'Sets the default email address used in the "from" field of emails.', - ], - [ - 'name' => 'mailer_from_email', - 'title' => 'Send all e-mails as originating from this (organizational) name', - 'comment' => 'Sets the default display name used for sending platform emails. e.g. "Support team".', - ], [ 'name' => 'allow_email_editor_for_anonymous', 'title' => 'E-mail editor for anonymous', diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20250918152000.php b/src/CoreBundle/Migrations/Schema/V200/Version20250918152000.php new file mode 100644 index 00000000000..f7087a4b42a --- /dev/null +++ b/src/CoreBundle/Migrations/Schema/V200/Version20250918152000.php @@ -0,0 +1,85 @@ + 'mailer_from_email', + 'title' => 'Send all e-mails from this e-mail address', + 'comment' => 'Sets the default email address used in the "from" field of emails.', + 'category' => 'mail', + 'default' => '', + ], + [ + 'variable' => 'mailer_from_name', + 'title' => 'Send all e-mails as originating from this (organizational) name', + 'comment' => 'Sets the default display name used for sending platform emails. e.g. "Support team".', + 'category' => 'mail', + 'default' => '', + ], + ]; + + foreach ($pairs as $p) { + $exists = (int) $this->connection->fetchOne( + "SELECT COUNT(*) FROM settings + WHERE variable = ? AND subkey IS NULL AND access_url = 1", + [$p['variable']] + ); + + if ($exists === 0) { + $this->connection->executeStatement( + "INSERT INTO settings + (variable, subkey, type, category, selected_value, title, comment, + access_url_changeable, access_url_locked, access_url) + VALUES + (?, NULL, NULL, ?, ?, ?, ?, 1, 0, 1)", + [$p['variable'], $p['category'], $p['default'], $p['title'], $p['comment']] + ); + $this->write(sprintf("Inserted missing setting: %s", $p['variable'])); + } else { + $this->connection->executeStatement( + "UPDATE settings + SET title = ?, comment = ?, category = ? + WHERE variable = ? AND subkey IS NULL AND access_url = 1", + [$p['title'], $p['comment'], $p['category'], $p['variable']] + ); + $this->write(sprintf("Updated setting metadata: %s", $p['variable'])); + } + } + } + + public function down(Schema $schema): void + { + $this->connection->executeStatement( + "UPDATE settings + SET title = 'Send all e-mails as originating from this (organizational) name', + comment = 'Sets the default display name used for sending platform emails. e.g. \"Support team\".' + WHERE variable = 'mailer_from_email' + AND subkey IS NULL AND access_url = 1" + ); + + $this->connection->executeStatement( + "UPDATE settings + SET title = 'Send all e-mails from this e-mail address', + comment = 'Sets the default email address used in the \"from\" field of emails.' + WHERE variable = 'mailer_from_name' + AND subkey IS NULL AND access_url = 1" + ); + } +}