-
Notifications
You must be signed in to change notification settings - Fork 8
/
QueueManager.php
77 lines (65 loc) · 1.76 KB
/
QueueManager.php
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
<?php
/**
* Copyright (C) $user$, Inc - All Rights Reserved
*
* <other text>
* @file QueueManager.php
* @author ignatenkovnikita
* @date $date$
*/
/**
* Created by PhpStorm.
* User: ignatenkovnikita
* Web Site: http://IgnatenkovNikita.ru
*/
namespace ignatenkovnikita\queuemanager;
use Yii;
use yii\base\Application;
use yii\base\BootstrapInterface;
use yii\base\Event;
use yii\base\Module;
use yii\filters\AccessControl;
use yii\helpers\ArrayHelper;
use yii\queue\Queue;
class QueueManager extends Module implements BootstrapInterface
{
public $adminPermission = 'queuemanager-module';
public function behaviors()
{
return ArrayHelper::merge(
parent::behaviors(),
[
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => [$this->adminPermission]
]
]
]
]
);
}
public function init()
{
parent::init(); // TODO: Change the autogenerated stub
$this->registerTranslations();
}
public function registerTranslations()
{
Yii::$app->i18n->translations['queuemanager'] = [
'class' => 'yii\i18n\PhpMessageSource',
'sourceLanguage' => 'en-US',
'basePath' => '@vendor/ignatenkovnikita/yii2-queuemanager/messages',
];
}
public function bootstrap($app)
{
if ($app instanceof \yii\console\Application) {
$app->controllerMap[$this->id] = [
'class' => 'ignatenkovnikita\queuemanager\QueueController',
];
}
}
}