1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* |
4
|
|
|
* Advanced BBCode Box |
5
|
|
|
* |
6
|
|
|
* @copyright (c) 2015 Matt Friedman |
7
|
|
|
* @license GNU General Public License, version 2 (GPL-2.0) |
8
|
|
|
* |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace vse\abbc3; |
12
|
|
|
|
13
|
|
|
use phpbb\filesystem\exception\filesystem_exception; |
|
|
|
|
14
|
|
|
|
15
|
|
|
class ext extends \phpbb\extension\base |
|
|
|
|
16
|
|
|
{ |
17
|
|
|
const MOVE_UP = 'move_up'; |
18
|
|
|
const MOVE_DOWN = 'move_down'; |
19
|
|
|
const MOVE_DRAG = 'move_drag'; |
20
|
|
|
const PHPBB_MIN_VERSION = '3.2.2'; // Require 3.2.2 due to TextFormatter and BBCode changes |
21
|
|
|
const PHPBB_LEGACY_MAX = '3.3.10'; // Max version of phpBB to use legacy settings |
22
|
|
|
const ABBC3_BBCODE_FONTS = ['ABBC3_FONT_SAFE' => ['Arial', 'Arial Black', 'Comic Sans MS', 'Courier New', 'Georgia', 'Impact', 'Tahoma', 'Times New Roman', 'Trebuchet MS', 'Verdana']]; |
23
|
|
|
|
24
|
|
|
/** |
25
|
3 |
|
* {@inheritdoc} |
26
|
|
|
*/ |
27
|
3 |
|
public function is_enableable() |
28
|
3 |
|
{ |
29
|
3 |
|
$config = $this->container->get('config'); |
30
|
|
|
return $this->version_check($config['version']) && $this->version_check(PHPBB_VERSION); |
|
|
|
|
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* {@inheritdoc} |
35
|
|
|
*/ |
36
|
|
|
public function enable_step($old_state) |
37
|
|
|
{ |
38
|
|
|
if ($old_state === false) |
39
|
|
|
{ |
40
|
|
|
$filesystem = $this->container->get('filesystem'); |
41
|
|
|
$root_path = $this->container->getParameter('core.root_path'); |
42
|
|
|
|
43
|
|
|
try // Make an ABBC3 icon dir in phpBB's images dir |
44
|
|
|
{ |
45
|
|
|
if (!$filesystem->exists($root_path . 'images/abbc3/icons')) |
46
|
|
|
{ |
47
|
|
|
$filesystem->mkdir($root_path . 'images/abbc3/icons'); |
48
|
|
|
} |
49
|
|
|
} |
50
|
|
|
catch (filesystem_exception $e) |
51
|
|
|
{ |
52
|
|
|
$user = $this->container->get('user'); |
53
|
|
|
$this->container->get('log')->add('critical', $user->data['user_id'], $user->ip, 'LOG_ABBC3_ENABLE_FAIL', false, [$e->get_filename()]); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
return 'abbc3-step'; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
return parent::enable_step($old_state); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Enable version check |
64
|
|
|
* |
65
|
|
|
* @param string|int $version The version to check |
66
|
|
|
* @return bool |
67
|
|
|
*/ |
68
|
|
|
protected function version_check($version) |
69
|
|
|
{ |
70
|
|
|
return phpbb_version_compare($version, self::PHPBB_MIN_VERSION, '>='); |
|
|
|
|
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
|
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