mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-01 11:39:41 +08:00
Fix #18955: Check yiisoft/yii2-swiftmailer before using as default mailer in yii\base\Application
This commit is contained in:
@ -24,6 +24,7 @@ Yii Framework 2 Change Log
|
||||
- Enh #18904: Improve Captcha client-side validation (hexkir)
|
||||
- Bug #18913: Add filename validation for `MessageSource::getMessageFilePath()` (uaoleg)
|
||||
- Bug #18909: Fix bug with binding default action parameters for controllers (bizley)
|
||||
- Bug #18955: Check `yiisoft/yii2-swiftmailer` before using as default mailer in `yii\base\Application` (WinterSilence)
|
||||
|
||||
|
||||
2.0.43 August 09, 2021
|
||||
|
||||
@ -589,6 +589,7 @@ abstract class Application extends Module
|
||||
/**
|
||||
* Returns the mailer component.
|
||||
* @return \yii\mail\MailerInterface the mailer application component.
|
||||
* @throws InvalidConfigException If this component is not configured.
|
||||
*/
|
||||
public function getMailer()
|
||||
{
|
||||
@ -597,8 +598,7 @@ abstract class Application extends Module
|
||||
|
||||
/**
|
||||
* Returns the auth manager for this application.
|
||||
* @return \yii\rbac\ManagerInterface the auth manager application component.
|
||||
* Null is returned if auth manager is not configured.
|
||||
* @return \yii\rbac\ManagerInterface|null the auth manager application component or null if it's not configured.
|
||||
*/
|
||||
public function getAuthManager()
|
||||
{
|
||||
@ -625,20 +625,25 @@ abstract class Application extends Module
|
||||
|
||||
/**
|
||||
* Returns the configuration of core application components.
|
||||
* @return array
|
||||
* @see set()
|
||||
*/
|
||||
public function coreComponents()
|
||||
{
|
||||
return [
|
||||
$components = [
|
||||
'log' => ['class' => 'yii\log\Dispatcher'],
|
||||
'view' => ['class' => 'yii\web\View'],
|
||||
'formatter' => ['class' => 'yii\i18n\Formatter'],
|
||||
'i18n' => ['class' => 'yii\i18n\I18N'],
|
||||
'mailer' => ['class' => 'yii\swiftmailer\Mailer'],
|
||||
'urlManager' => ['class' => 'yii\web\UrlManager'],
|
||||
'assetManager' => ['class' => 'yii\web\AssetManager'],
|
||||
'security' => ['class' => 'yii\base\Security'],
|
||||
];
|
||||
if (class_exists('yii\swiftmailer\Mailer')) {
|
||||
$components['mailer'] = ['class' => 'yii\swiftmailer\Mailer'];
|
||||
}
|
||||
|
||||
return $components;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user