|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* phpBB Gallery - ACP CleanUp Extension |
|
4
|
|
|
* |
|
5
|
|
|
* @package phpbbgallery/acpcleanup |
|
6
|
|
|
* @author Leinad4Mind |
|
7
|
|
|
* @copyright 2018- Leinad4Mind |
|
8
|
|
|
* @license GPL-2.0-only |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace phpbbgallery\acpcleanup; |
|
12
|
|
|
|
|
13
|
|
|
class ext extends \phpbb\extension\base |
|
|
|
|
|
|
14
|
|
|
{ |
|
15
|
|
|
/** |
|
16
|
|
|
* Check whether or not the extension can be enabled. |
|
17
|
|
|
* Checks dependencies and requirements. |
|
18
|
|
|
* |
|
19
|
|
|
* @return bool |
|
20
|
|
|
*/ |
|
21
|
|
|
public function is_enableable() |
|
22
|
|
|
{ |
|
23
|
|
|
$manager = $this->container->get('ext.manager'); |
|
24
|
|
|
$user = $this->container->get('user'); |
|
25
|
|
|
|
|
26
|
|
|
$core_ext = 'phpbbgallery/core'; |
|
27
|
|
|
|
|
28
|
|
|
// Check if core is installed (enabled or disabled) |
|
29
|
|
|
$is_enabled = $manager->is_enabled($core_ext); |
|
30
|
|
|
$is_disabled = $manager->is_disabled($core_ext); |
|
31
|
|
|
|
|
32
|
|
|
if (!$is_enabled && !$is_disabled) |
|
33
|
|
|
{ |
|
34
|
|
|
// Core not installed at all |
|
35
|
|
|
$user->add_lang_ext('phpbbgallery/acpcleanup', 'info_acp_gallery_cleanup'); |
|
36
|
|
|
trigger_error($user->lang('GALLERY_CORE_NOT_FOUND'), E_USER_WARNING); |
|
37
|
|
|
return false; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
if ($is_disabled) |
|
41
|
|
|
{ |
|
42
|
|
|
// Core installed but disabled — enable it automatically |
|
43
|
|
|
$manager->enable($core_ext); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
// If here, core is either enabled or just enabled now |
|
47
|
|
|
return true; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Perform additional tasks on extension enable |
|
52
|
|
|
* |
|
53
|
|
|
* @param mixed $old_state State returned by previous call of this method |
|
54
|
|
|
* @return mixed Returns false after last step, otherwise temporary state |
|
55
|
|
|
*/ |
|
56
|
|
|
public function enable_step($old_state) |
|
57
|
|
|
{ |
|
58
|
|
|
if (empty($old_state)) |
|
59
|
|
|
{ |
|
60
|
|
|
$this->container->get('user')->add_lang_ext('phpbbgallery/acpcleanup', 'info_acp_gallery_cleanup'); |
|
61
|
|
|
$this->container->get('template')->assign_var('L_EXTENSION_ENABLE_SUCCESS', $this->container->get('user')->lang['EXTENSION_ENABLE_SUCCESS']); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
return parent::enable_step($old_state); |
|
65
|
|
|
} |
|
66
|
|
|
} |
|
67
|
|
|
|
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