hotfix update custom config
This commit is contained in:
parent
911f4757d3
commit
a128de0bc6
|
|
@ -11,13 +11,23 @@ class Custom extends Plugin
|
||||||
$this->config = $remote_config["custom"];
|
$this->config = $remote_config["custom"];
|
||||||
$this->saveConfig();
|
$this->saveConfig();
|
||||||
|
|
||||||
$path = dirname(__DIR__) . "/networks/custom.json";
|
$this->updateConfigFile();
|
||||||
file_put_contents($path, json_encode($this->config));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue