diff --git a/app/Libraries/Plugins/BasePlugin.php b/app/Libraries/Plugins/BasePlugin.php index b2c7a6308..dd143bbaf 100644 --- a/app/Libraries/Plugins/BasePlugin.php +++ b/app/Libraries/Plugins/BasePlugin.php @@ -25,13 +25,13 @@ abstract class BasePlugin implements PluginInterface public function isEnabled(): bool { - $enabled = $this->configModel->get("{$this->getPluginId()}_enabled"); + $enabled = $this->configModel->getValue("{$this->getPluginId()}_enabled"); return $enabled === '1' || $enabled === 'true'; } protected function getSetting(string $key, mixed $default = null): mixed { - $value = $this->configModel->get("{$this->getPluginId()}_{$key}"); + $value = $this->configModel->getValue("{$this->getPluginId()}_{$key}"); return $value ?? $default; } @@ -41,7 +41,7 @@ abstract class BasePlugin implements PluginInterface ? json_encode($value) : (string)$value; - return $this->configModel->set("{$this->getPluginId()}_{$key}", $stringValue); + return $this->configModel->setValue("{$this->getPluginId()}_{$key}", $stringValue); } public function getSettings(): array diff --git a/app/Libraries/Plugins/PluginManager.php b/app/Libraries/Plugins/PluginManager.php index bb00a9cf4..734b32c68 100644 --- a/app/Libraries/Plugins/PluginManager.php +++ b/app/Libraries/Plugins/PluginManager.php @@ -95,7 +95,7 @@ class PluginManager public function isPluginEnabled(string $pluginId): bool { - $enabled = $this->configModel->get($this->getEnabledKey($pluginId)); + $enabled = $this->configModel->getValue($this->getEnabledKey($pluginId)); return $enabled === '1' || $enabled === 'true'; } @@ -112,10 +112,10 @@ class PluginManager log_message('error', "Failed to install plugin: {$pluginId}"); return false; } - $this->configModel->set($this->getInstalledKey($pluginId), '1'); + $this->configModel->setValue($this->getInstalledKey($pluginId), '1'); } - $this->configModel->set($this->getEnabledKey($pluginId), '1'); + $this->configModel->setValue($this->getEnabledKey($pluginId), '1'); log_message('info', "Plugin enabled: {$pluginId}"); return true; @@ -128,7 +128,7 @@ class PluginManager return false; } - $this->configModel->set($this->getEnabledKey($pluginId), '0'); + $this->configModel->setValue($this->getEnabledKey($pluginId), '0'); log_message('info', "Plugin disabled: {$pluginId}"); return true; @@ -154,12 +154,12 @@ class PluginManager public function getSetting(string $pluginId, string $key, mixed $default = null): mixed { - return $this->configModel->get("{$pluginId}_{$key}") ?? $default; + return $this->configModel->getValue("{$pluginId}_{$key}") ?? $default; } public function setSetting(string $pluginId, string $key, mixed $value): bool { - return $this->configModel->set("{$pluginId}_{$key}", $value); + return $this->configModel->setValue("{$pluginId}_{$key}", $value); } private function getEnabledKey(string $pluginId): string diff --git a/app/Models/PluginConfig.php b/app/Models/PluginConfig.php index 34ff740f2..170a9c91a 100644 --- a/app/Models/PluginConfig.php +++ b/app/Models/PluginConfig.php @@ -23,7 +23,7 @@ class PluginConfig extends Model return ($builder->get()->getNumRows() === 1); } - public function get(string $key): ?string + public function getValue(string $key): ?string { $builder = $this->db->table('plugin_config'); $query = $builder->getWhere(['key' => $key], 1); @@ -35,7 +35,7 @@ class PluginConfig extends Model return null; } - public function set(string $key, string $value): bool + public function setValue(string $key, string $value): bool { $builder = $this->db->table('plugin_config'); @@ -84,7 +84,7 @@ class PluginConfig extends Model $this->db->transStart(); foreach ($data as $key => $value) { - $success &= $this->set($key, $value); + $success &= $this->setValue($key, $value); } $this->db->transComplete();