|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* |
|
4
|
|
|
* VigLink extension for the phpBB Forum Software package. |
|
5
|
|
|
* |
|
6
|
|
|
* @copyright (c) 2014 phpBB Limited <https://www.phpbb.com> |
|
7
|
|
|
* @license GNU General Public License, version 2 (GPL-2.0) |
|
8
|
|
|
* |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace phpbb\viglink; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Extension class for custom enable/disable/purge actions |
|
15
|
|
|
*/ |
|
16
|
|
|
class ext extends \phpbb\extension\base |
|
17
|
|
|
{ |
|
18
|
|
|
/** |
|
19
|
|
|
* Check whether the extension can be enabled. |
|
20
|
|
|
* The current phpBB version should meet or exceed |
|
21
|
|
|
* the minimum version required by this extension: |
|
22
|
|
|
* |
|
23
|
|
|
* Requires phpBB 3.2.0-b1 or greater |
|
24
|
|
|
* |
|
25
|
|
|
* @return bool |
|
26
|
|
|
*/ |
|
27
|
|
|
public function is_enableable() |
|
28
|
|
|
{ |
|
29
|
|
|
return phpbb_version_compare(PHPBB_VERSION, '3.2.0-b1', '>='); |
|
|
|
|
|
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Check phpBB's VigLink switches and set them during install |
|
34
|
|
|
* |
|
35
|
|
|
* @param mixed $old_state The return value of the previous call |
|
36
|
|
|
* of this method, or false on the first call |
|
37
|
|
|
* |
|
38
|
|
|
* @return mixed Returns false after last step, otherwise |
|
39
|
|
|
* temporary state which is passed as an |
|
40
|
|
|
* argument to the next step |
|
41
|
|
|
*/ |
|
42
|
|
|
public function enable_step($old_state) |
|
43
|
|
|
{ |
|
44
|
|
|
if ($old_state === false) |
|
45
|
|
|
{ |
|
46
|
|
|
$viglink_helper = new \phpbb\viglink\acp\viglink_helper( |
|
47
|
|
|
$this->container->get('cache.driver'), |
|
|
|
|
|
|
48
|
|
|
$this->container->get('config'), |
|
|
|
|
|
|
49
|
|
|
$this->container->get('file_downloader'), |
|
|
|
|
|
|
50
|
|
|
$this->container->get('language'), |
|
|
|
|
|
|
51
|
|
|
$this->container->get('log'), |
|
|
|
|
|
|
52
|
|
|
$this->container->get('user') |
|
|
|
|
|
|
53
|
|
|
); |
|
54
|
|
|
|
|
55
|
|
|
try |
|
56
|
|
|
{ |
|
57
|
|
|
$viglink_helper->set_viglink_services(); |
|
58
|
|
|
} |
|
59
|
|
|
catch (\RuntimeException $e) |
|
60
|
|
|
{ |
|
61
|
|
|
$viglink_helper->log_viglink_error($e->getMessage()); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
return 'viglink'; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
return parent::enable_step($old_state); |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|