hotfix update custom config

This commit is contained in:
kirillius 2025-06-05 14:01:48 +03:00
parent 911f4757d3
commit a128de0bc6
1 changed files with 14 additions and 4 deletions

View File

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