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(); }