1
0
mirror of https://github.com/flarum/core.git synced 2025-07-31 05:30:38 +02:00

Add BC layer for mail driver configuration

By commenting out the new methods on the `DriverInterface` and checking
for these methods' existence before calling them, old implementations in
extensions will not break right away.

This will be removed after beta.12 is released, giving extension authors
about two months time to update their extensions.
This commit is contained in:
Franz Liedke
2020-01-24 17:59:39 +01:00
parent 833ea4e06e
commit 2ca3188eff
3 changed files with 17 additions and 9 deletions

View File

@@ -41,11 +41,15 @@ class ShowMailSettingsController extends AbstractShowController
$actual = self::$container->make('mail.driver');
$validator = self::$container->make(Factory::class);
$errors = $configured->validate($settings, $validator);
if (method_exists($configured, 'validate')) {
$errors = $configured->validate($settings, $validator);
} else {
$errors = new \Illuminate\Support\MessageBag;
}
return [
'drivers' => $drivers,
'sending' => $actual->canSend(),
'sending' => method_exists($actual, 'canSend') ? $actual->canSend() : true,
'errors' => $errors,
];
}