From a128de0bc6b4dcbc5ebdcfa8c868d203bdd5dfca Mon Sep 17 00:00:00 2001 From: kirillius Date: Thu, 5 Jun 2025 14:01:48 +0300 Subject: [PATCH] hotfix update custom config --- plugins/custom/Custom.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/plugins/custom/Custom.php b/plugins/custom/Custom.php index cccdd98..a6e2bec 100755 --- a/plugins/custom/Custom.php +++ b/plugins/custom/Custom.php @@ -11,13 +11,23 @@ class Custom extends Plugin $this->config = $remote_config["custom"]; $this->saveConfig(); - $path = dirname(__DIR__) . "/networks/custom.json"; - file_put_contents($path, json_encode($this->config)); + $this->updateConfigFile(); } - protected function checkConfig(): void + private function updateConfigFile() { - parent::checkConfig(); + $path = dirname(__DIR__) . "/networks/custom.json"; + $current_config = @file_get_contents($path); + $new_config = json_encode($this->config); + if($current_config !== $new_config) { + file_put_contents($path, $new_config); + } + } + + public function onInit(PluginContext $context): void + { + parent::onInit($context); + $this->updateConfigFile(); }