-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathext.php
More file actions
65 lines (56 loc) · 1.73 KB
/
Copy pathext.php
File metadata and controls
65 lines (56 loc) · 1.73 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
<?php
/**
* bbGuild EQ2 Extension
*
* @package bbguildeq2 v2.0
* @copyright 2018 avathar.be
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*/
namespace avathar\bbguildeq2;
use phpbb\extension\base;
/**
* Class ext
*
* @package avathar\bbguildeq2
*/
class ext extends base
{
const BBGUILDEQ2_VERSION = '2.1.0';
const MIN_PHP_VERSION = '8.1.0';
const MIN_PHPBB_VERSION = '3.3.0';
const MIN_BBGUILD_VERSION = '2.1.0';
/**
* Check whether or not the extension can be enabled.
* Requires PHP 8.1+, phpBB 3.3+, and bbGuild core extension to be enabled.
*
* @return bool|array True if enableable, or an array of error messages otherwise
*/
public function is_enableable()
{
$errors = [];
$language = $this->container->get('language');
$language->add_lang('info_ext', 'avathar/bbguildeq2');
if (version_compare(PHP_VERSION, self::MIN_PHP_VERSION, '<'))
{
$errors[] = $language->lang('BBGUILDEQ2_PHP_VERSION_FAIL', self::MIN_PHP_VERSION, PHP_VERSION);
}
if (phpbb_version_compare(PHPBB_VERSION, self::MIN_PHPBB_VERSION, '<'))
{
$errors[] = $language->lang('BBGUILDEQ2_PHPBB_VERSION_FAIL', self::MIN_PHPBB_VERSION, PHPBB_VERSION);
}
$ext_manager = $this->container->get('ext.manager');
if (!$ext_manager->is_enabled('avathar/bbguild'))
{
$errors[] = $language->lang('BBGUILDEQ2_REQUIRES_BBGUILD');
}
else
{
$core_version = class_exists('\avathar\bbguild\ext') ? \avathar\bbguild\ext::BBGUILD_VERSION : '0';
if (phpbb_version_compare($core_version, self::MIN_BBGUILD_VERSION, '<'))
{
$errors[] = $language->lang('BBGUILDEQ2_REQUIRES_BBGUILD_VERSION', self::MIN_BBGUILD_VERSION, $core_version);
}
}
return empty($errors) ? true : $errors;
}
}