-
Notifications
You must be signed in to change notification settings - Fork 10
/
ext.php
69 lines (63 loc) · 1.59 KB
/
ext.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
<?php
/**
*
* VigLink extension for the phpBB Forum Software package.
*
* @copyright (c) 2014 phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
*/
namespace phpbb\viglink;
/**
* Extension class for custom enable/disable/purge actions
*/
class ext extends \phpbb\extension\base
{
/**
* Check whether the extension can be enabled.
* The current phpBB version should meet or exceed
* the minimum version required by this extension:
*
* Requires phpBB 3.2.0-b1 or greater
*
* @return bool
*/
public function is_enableable()
{
return phpbb_version_compare(PHPBB_VERSION, '3.2.0-b1', '>=');
}
/**
* Check phpBB's VigLink switches and set them during install
*
* @param mixed $old_state The return value of the previous call
* of this method, or false on the first call
*
* @return mixed Returns false after last step, otherwise
* temporary state which is passed as an
* argument to the next step
*/
public function enable_step($old_state)
{
if ($old_state === false)
{
$viglink_helper = new \phpbb\viglink\acp\viglink_helper(
$this->container->get('cache.driver'),
$this->container->get('config'),
$this->container->get('file_downloader'),
$this->container->get('language'),
$this->container->get('log'),
$this->container->get('user')
);
try
{
$viglink_helper->set_viglink_services();
}
catch (\RuntimeException $e)
{
$viglink_helper->log_viglink_error($e->getMessage());
}
return 'viglink';
}
return parent::enable_step($old_state);
}
}