phpbb-extensions /
ad-management
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * |
||
| 4 | * Advertisement management. An extension for the phpBB Forum Software package. |
||
| 5 | * |
||
| 6 | * @copyright (c) 2022 phpBB Limited <https://www.phpbb.com> |
||
| 7 | * @license GNU General Public License, version 2 (GPL-2.0) |
||
| 8 | * |
||
| 9 | */ |
||
| 10 | |||
| 11 | namespace phpbb\ads\migrations\v20x; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * Migration stage 4: Add Admin Permission |
||
| 15 | */ |
||
| 16 | class m4_admin_permission extends \phpbb\db\migration\container_aware_migration |
||
|
0 ignored issues
–
show
|
|||
| 17 | { |
||
| 18 | /** |
||
| 19 | * {@inheritdoc |
||
| 20 | */ |
||
| 21 | public function effectively_installed() |
||
| 22 | { |
||
| 23 | $sql = 'SELECT * FROM ' . $this->table_prefix . "acl_options |
||
| 24 | WHERE auth_option = 'a_phpbb_ads_m' OR auth_option = 'a_phpbb_ads_s'"; |
||
| 25 | $result = $this->db->sql_query_limit($sql, 1); |
||
| 26 | $row = $this->db->sql_fetchrow($result); |
||
| 27 | $this->db->sql_freeresult($result); |
||
| 28 | |||
| 29 | return $row !== false; |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * {@inheritDoc} |
||
| 34 | */ |
||
| 35 | public static function depends_on() |
||
| 36 | { |
||
| 37 | return [ |
||
| 38 | '\phpbb\ads\migrations\v10x\m1_initial_schema', |
||
| 39 | '\phpbb\ads\migrations\v10x\m2_acp_module', |
||
| 40 | '\phpbb\ads\migrations\v20x\m3_add_start_date', |
||
| 41 | ]; |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * {@inheritDoc} |
||
| 46 | */ |
||
| 47 | public function update_data() |
||
| 48 | { |
||
| 49 | return [ |
||
| 50 | // Add permission |
||
| 51 | ['permission.add', ['a_phpbb_ads_m', true]], |
||
| 52 | ['permission.add', ['a_phpbb_ads_s', true]], |
||
| 53 | |||
| 54 | // Set permissions |
||
| 55 | ['if', [ |
||
| 56 | ['permission.role_exists', ['ROLE_ADMIN_FULL']], |
||
| 57 | ['permission.permission_set', ['ROLE_ADMIN_FULL', 'a_phpbb_ads_m']], |
||
| 58 | ]], |
||
| 59 | ['if', [ |
||
| 60 | ['permission.role_exists', ['ROLE_ADMIN_FULL']], |
||
| 61 | ['permission.permission_set', ['ROLE_ADMIN_FULL', 'a_phpbb_ads_s']], |
||
| 62 | ]], |
||
| 63 | ['if', [ |
||
| 64 | ['permission.role_exists', ['ROLE_ADMIN_STANDARD']], |
||
| 65 | ['permission.permission_set', ['ROLE_ADMIN_STANDARD', 'a_phpbb_ads_m']], |
||
| 66 | ]], |
||
| 67 | ['if', [ |
||
| 68 | ['permission.role_exists', ['ROLE_ADMIN_STANDARD']], |
||
| 69 | ['permission.permission_set', ['ROLE_ADMIN_STANDARD', 'a_phpbb_ads_s']], |
||
| 70 | ]], |
||
| 71 | |||
| 72 | // Update module auth |
||
| 73 | ['custom', [[$this, 'update_acp_module_auth']]], |
||
| 74 | ]; |
||
| 75 | } |
||
| 76 | |||
| 77 | /** |
||
| 78 | * Update module auth manually, because "module.remove" tool causes problems when deleting extension. |
||
| 79 | */ |
||
| 80 | public function update_acp_module_auth() |
||
| 81 | { |
||
| 82 | $sql = 'UPDATE ' . $this->container->getParameter('tables.modules') . " |
||
| 83 | SET module_auth = 'ext_phpbb/ads && acl_a_phpbb_ads_m' |
||
| 84 | WHERE module_langname = 'ACP_MANAGE_ADS_TITLE'"; |
||
| 85 | $this->db->sql_query($sql); |
||
| 86 | |||
| 87 | $sql = 'UPDATE ' . $this->container->getParameter('tables.modules') . " |
||
| 88 | SET module_auth = 'ext_phpbb/ads && acl_a_phpbb_ads_s' |
||
| 89 | WHERE module_langname = 'ACP_ADS_SETTINGS_TITLE'"; |
||
| 90 | $this->db->sql_query($sql); |
||
| 91 | } |
||
| 92 | } |
||
| 93 |
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