|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* |
|
4
|
|
|
* phpBB Media Embed PlugIn extension for the phpBB Forum Software package. |
|
5
|
|
|
* |
|
6
|
|
|
* @copyright (c) 2016 phpBB Limited <https://www.phpbb.com> |
|
7
|
|
|
* @license GNU General Public License, version 2 (GPL-2.0) |
|
8
|
|
|
* |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace phpbb\mediaembed; |
|
12
|
|
|
|
|
13
|
|
|
class ext extends \phpbb\extension\base |
|
|
|
|
|
|
14
|
|
|
{ |
|
15
|
|
|
/** |
|
16
|
|
|
* @var string Minimum requirements: |
|
17
|
|
|
* phpBB 3.3.2 because using role_exists in migrations |
|
18
|
|
|
* phpBB 3.3.2 because TextFormatter 2.7.5 supports clyp.it and codepen.com |
|
19
|
|
|
*/ |
|
20
|
|
|
public const PHPBB_MINIMUM = '3.3.2'; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @var string YAML file extension |
|
24
|
|
|
*/ |
|
25
|
|
|
public const YML = '.yml'; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @var array An array of installation error messages |
|
29
|
|
|
*/ |
|
30
|
|
|
protected $errors = []; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* {@inheritDoc} |
|
34
|
|
|
*/ |
|
35
|
|
|
public function is_enableable() |
|
36
|
|
|
{ |
|
37
|
|
|
return $this->check_phpbb_version() |
|
38
|
|
|
->check_s9e_mediaembed() |
|
39
|
|
|
->result(); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* Check the installed phpBB version meets this |
|
44
|
|
|
* extension's requirements. |
|
45
|
|
|
* |
|
46
|
|
|
* @return \phpbb\mediaembed\ext |
|
47
|
|
|
*/ |
|
48
|
|
|
protected function check_phpbb_version() |
|
49
|
|
|
{ |
|
50
|
|
|
if (phpbb_version_compare(PHPBB_VERSION, self::PHPBB_MINIMUM, '<')) |
|
|
|
|
|
|
51
|
|
|
{ |
|
52
|
|
|
$this->errors[] = 'PHPBB_VERSION_ERROR'; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
return $this; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* Check if s9e MediaEmbed extension for phpBB is installed |
|
60
|
|
|
* (it must NOT be to enable this extension). |
|
61
|
|
|
* |
|
62
|
|
|
* @return \phpbb\mediaembed\ext |
|
63
|
|
|
*/ |
|
64
|
|
|
protected function check_s9e_mediaembed() |
|
65
|
|
|
{ |
|
66
|
|
|
$ext_manager = $this->container->get('ext.manager'); |
|
67
|
|
|
|
|
68
|
|
|
if ($ext_manager->is_enabled('s9e/mediaembed')) |
|
69
|
|
|
{ |
|
70
|
|
|
$this->errors[] = 'S9E_MEDIAEMBED_ERROR'; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
return $this; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* Return the is enableable result. Either true, or the best enable failed |
|
78
|
|
|
* response for the current phpBB environment: array of error messages |
|
79
|
|
|
* in phpBB 3.3 or newer, false otherwise. |
|
80
|
|
|
* |
|
81
|
|
|
* @return array|bool |
|
82
|
|
|
*/ |
|
83
|
|
|
protected function result() |
|
84
|
|
|
{ |
|
85
|
|
|
if (empty($this->errors)) |
|
86
|
|
|
{ |
|
87
|
|
|
return true; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
if (phpbb_version_compare(PHPBB_VERSION, '3.3.0-b1', '>=')) |
|
|
|
|
|
|
91
|
|
|
{ |
|
92
|
|
|
$language = $this->container->get('language'); |
|
93
|
|
|
$language->add_lang('install', 'phpbb/mediaembed'); |
|
94
|
|
|
return array_map([$language, 'lang'], $this->errors); |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
return false; |
|
98
|
|
|
} |
|
99
|
|
|
} |
|
100
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths