phpbb-extensions /
mediaembed
| 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 |
||||
|
0 ignored issues
–
show
|
|||||
| 14 | { |
||||
| 15 | /** @var string Minimum requirements: phpBB 3.3.2 because using role_exists in migrations */ |
||||
| 16 | const PHPBB_MINIMUM = '3.3.2'; |
||||
| 17 | |||||
| 18 | /** @var string YAML file extension */ |
||||
| 19 | const YML = '.yml'; |
||||
| 20 | |||||
| 21 | /** |
||||
| 22 | * @var array An array of installation error messages |
||||
| 23 | */ |
||||
| 24 | protected $errors = []; |
||||
| 25 | |||||
| 26 | /** |
||||
| 27 | * {@inheritDoc} |
||||
| 28 | */ |
||||
| 29 | public function is_enableable() |
||||
| 30 | { |
||||
| 31 | return $this->check_phpbb_version() |
||||
| 32 | ->check_s9e_mediaembed() |
||||
| 33 | ->result(); |
||||
| 34 | } |
||||
| 35 | |||||
| 36 | /** |
||||
| 37 | * Check the installed phpBB version meets this |
||||
| 38 | * extension's requirements. |
||||
| 39 | * |
||||
| 40 | * @return \phpbb\mediaembed\ext |
||||
| 41 | */ |
||||
| 42 | protected function check_phpbb_version() |
||||
| 43 | { |
||||
| 44 | if (phpbb_version_compare(PHPBB_VERSION, self::PHPBB_MINIMUM, '<')) |
||||
|
0 ignored issues
–
show
The function
phpbb_version_compare was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 45 | { |
||||
| 46 | $this->errors[] = 'PHPBB_VERSION_ERROR'; |
||||
| 47 | } |
||||
| 48 | |||||
| 49 | return $this; |
||||
| 50 | } |
||||
| 51 | |||||
| 52 | /** |
||||
| 53 | * Check if s9e MediaEmbed extension for phpBB is installed |
||||
| 54 | * (it must NOT be to enable this extension). |
||||
| 55 | * |
||||
| 56 | * @return \phpbb\mediaembed\ext |
||||
| 57 | */ |
||||
| 58 | protected function check_s9e_mediaembed() |
||||
| 59 | { |
||||
| 60 | $ext_manager = $this->container->get('ext.manager'); |
||||
| 61 | |||||
| 62 | if ($ext_manager->is_enabled('s9e/mediaembed')) |
||||
| 63 | { |
||||
| 64 | $this->errors[] = 'S9E_MEDIAEMBED_ERROR'; |
||||
| 65 | } |
||||
| 66 | |||||
| 67 | return $this; |
||||
| 68 | } |
||||
| 69 | |||||
| 70 | /** |
||||
| 71 | * Return the is enableable result. Either true, or the best enable failed |
||||
| 72 | * response for the current phpBB environment: array of error messages |
||||
| 73 | * in phpBB 3.3 or newer, false otherwise. |
||||
| 74 | * |
||||
| 75 | * @return array|bool |
||||
| 76 | */ |
||||
| 77 | protected function result() |
||||
| 78 | { |
||||
| 79 | if (empty($this->errors)) |
||||
| 80 | { |
||||
| 81 | return true; |
||||
| 82 | } |
||||
| 83 | |||||
| 84 | if (phpbb_version_compare(PHPBB_VERSION, '3.3.0-b1', '>=')) |
||||
|
0 ignored issues
–
show
The function
phpbb_version_compare was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 85 | { |
||||
| 86 | $language = $this->container->get('language'); |
||||
| 87 | $language->add_lang('install', 'phpbb/mediaembed'); |
||||
| 88 | return array_map([$language, 'lang'], $this->errors); |
||||
| 89 | } |
||||
| 90 | |||||
| 91 | return false; |
||||
| 92 | } |
||||
| 93 | } |
||||
| 94 |
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