Repository navigation
Expand file tree
/
Copy pathModule.php
More file actions
91 lines (80 loc) · 2.08 KB
/
Copy pathModule.php
File metadata and controls
91 lines (80 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
/**
* Email Log
* @link https://www.cuzy.app
* @license https://www.cuzy.app/cuzy-license
* @author [Marc FARRE](https://marc.fun)
*/
namespace humhub\modules\emailLog;
use humhub\modules\emailLog\models\Configuration;
use humhub\modules\emailLog\notifications\EmailSendingFailed;
use Yii;
use yii\helpers\Url;
use yii\web\NotFoundHttpException;
/**
*
* @property-read string $configUrl
* @property-read Configuration $configuration
* @property-read string[] $notifications
*/
class Module extends \humhub\components\Module
{
/**
* @var string defines the icon
*/
public $icon = 'envelope';
private ?Configuration $_configuration = null;
/**
* @throws NotFoundHttpException
*/
public static function getInstance(): static
{
/** @var ?static $module */
$module = Yii::$app->getModule('email-log');
if (!$module?->isEnabled) {
throw new NotFoundHttpException('Email Log module not enabled');
}
return $module;
}
public function getConfiguration(): Configuration
{
if ($this->_configuration === null) {
$this->_configuration = new Configuration(['settingsManager' => $this->settings]);
$this->_configuration->loadBySettings();
}
return $this->_configuration;
}
/**
* @inheritdoc
*/
public function getConfigUrl()
{
return Url::to(['/email-log/config']);
}
/**
* @inerhitdoc
*/
public function getName()
{
return Yii::t('EmailLogModule.base', 'Email Log');
}
/**
* @inerhitdoc
*/
public function getDescription()
{
return Yii::t('EmailLogModule.base', 'Logs all emails sent by HumHub (recipient, subject, content, status and error), with a searchable administration list, failure alerts and auto-purge.');
}
/**
* @inheridoc
*/
public function getNotifications()
{
if (Yii::$app->user->isAdmin()) {
return [
EmailSendingFailed::class,
];
}
return [];
}
}