This repository has been archived by the owner on Feb 3, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathPlugin.php
64 lines (51 loc) · 1.48 KB
/
Plugin.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
<?php
namespace Kanboard\Plugin\Beanstalk;
use Kanboard\Core\Plugin\Base;
use Kanboard\Core\Translator;
use Pheanstalk\Pheanstalk;
use SimpleQueue\Adapter\BeanstalkQueueAdapter;
use SimpleQueue\Queue;
require_once __DIR__.'/vendor/autoload.php';
defined('QUEUE_NAME') or define('QUEUE_NAME', 'kanboard');
defined('BEANSTALKD_HOSTNAME') or define('BEANSTALKD_HOSTNAME', '127.0.0.1');
class Plugin extends Base
{
public function initialize()
{
$connection = new Pheanstalk(BEANSTALKD_HOSTNAME);
if ($connection->getConnection()->isServiceListening()) {
$queue = new Queue(new BeanstalkQueueAdapter($connection, QUEUE_NAME));
$this->queueManager->setQueue($queue);
} else {
$this->logger->error('Beanstalkd daemon is not reachable');
}
}
public function onStartup()
{
Translator::load($this->languageModel->getCurrentLanguage(), __DIR__.'/Locale');
}
public function getPluginName()
{
return 'Beanstalk';
}
public function getPluginDescription()
{
return t('Use Beanstalk to process background jobs');
}
public function getPluginAuthor()
{
return 'Frédéric Guillot';
}
public function getPluginVersion()
{
return '1.0.0';
}
public function getPluginHomepage()
{
return 'https://github.com/kanboard/plugin-beanstalk';
}
public function getCompatibleVersion()
{
return '>=1.0.39';
}
}