Skip to content

Commit b68f762

Browse files
authored
Revert "[BUGFIX] Add plugin-enabled check condition to CustomObjectPermissions…" (#366)
* Revert "[BUGFIX] Add plugin-enabled check condition to CustomObjectPermission…" This reverts commit 8a155c8. * Fixing Error: This request has been automatically failed because it uses a deprecated version of `actions/upload-artifact: v3` * Resolving "Error: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run" error
1 parent 8a155c8 commit b68f762

File tree

4 files changed

+8
-34
lines changed

4 files changed

+8
-34
lines changed

.github/workflows/tests.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,11 @@ jobs:
139139
# verbose: true
140140

141141
- name: Upload logs as artifacts
142-
uses: actions/upload-artifact@v3
142+
uses: actions/upload-artifact@v4
143143
with:
144-
name: mautic-logs
144+
name: mautic-logs-${{ matrix.php-versions }}-${{ github.run_id }}
145145
path: var/logs/
146+
if-no-files-found: warn
147+
compression-level: 6
148+
overwrite: false
149+
include-hidden-files: false

Config/config.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,6 @@
10421042
'class' => ConfigProvider::class,
10431043
'arguments' => [
10441044
'mautic.helper.core_parameters',
1045-
'database_connection',
10461045
],
10471046
],
10481047
'custom_field.type.provider' => [

Provider/ConfigProvider.php

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,13 @@
44

55
namespace MauticPlugin\CustomObjectsBundle\Provider;
66

7-
use Doctrine\DBAL\Connection;
8-
use Doctrine\DBAL\Exception;
97
use Mautic\CoreBundle\Helper\CoreParametersHelper;
10-
use MauticPlugin\CustomObjectsBundle\Entity\CustomObject;
118

129
class ConfigProvider
1310
{
1411
/**
1512
* @var string
1613
*/
17-
public const CONFIG_PLUGIN_NAME = 'CustomObjectsBundle';
1814
public const CONFIG_PARAM_ENABLED = 'custom_objects_enabled';
1915
public const CONFIG_PARAM_ITEM_VALUE_TO_CONTACT_RELATION_LIMIT = 'custom_object_item_value_to_contact_relation_limit';
2016

@@ -25,38 +21,17 @@ class ConfigProvider
2521
*/
2622
private $coreParametersHelper;
2723

28-
/**
29-
* @var Connection
30-
*/
31-
private $connection;
32-
33-
public function __construct(CoreParametersHelper $coreParametersHelper, Connection $connection)
24+
public function __construct(CoreParametersHelper $coreParametersHelper)
3425
{
3526
$this->coreParametersHelper = $coreParametersHelper;
36-
$this->connection = $connection;
3727
}
3828

3929
/**
4030
* Returns true if the Custom Objects plugin is enabled.
4131
*/
4232
public function pluginIsEnabled(): bool
4333
{
44-
$pluginEnabled = (bool) $this->coreParametersHelper->get(self::CONFIG_PARAM_ENABLED, true);
45-
if (!$pluginEnabled) {
46-
return false;
47-
}
48-
49-
try {
50-
$pluginWasInstalledBefore = $this->connection
51-
->executeQuery('SELECT id FROM plugins WHERE bundle=:pluginName', ['pluginName' => self::CONFIG_PLUGIN_NAME])
52-
->rowCount();
53-
$customObjectsTableExists = $this->connection
54-
->executeQuery('SHOW TABLES LIKE :tableName', ['tableName' => CustomObject::TABLE_NAME])
55-
->rowCount();
56-
return $pluginWasInstalledBefore && $customObjectsTableExists;
57-
} catch (Exception $e) {
58-
return false;
59-
}
34+
return (bool) $this->coreParametersHelper->get(self::CONFIG_PARAM_ENABLED, true);
6035
}
6136

6237
public function isCustomObjectMergeFilterEnabled(): bool

Security/Permissions/CustomObjectPermissions.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ public function __construct(
5656
*/
5757
public function definePermissions(): void
5858
{
59-
if (!$this->isEnabled()) {
60-
return;
61-
}
62-
6359
$this->addExtendedPermissions(['custom_fields', self::NAME]);
6460

6561
$customObjects = $this->getCustomObjects();

0 commit comments

Comments
 (0)