PluginBase: fixed crashing on getConfig() when data dir doesn't exist

I considered making this instead save the default config instead of creating an empty config file, but that would be (albeit minor) a behavioural change which therefore belongs in 3.1.
This commit is contained in:
Dylan K. Taylor 2018-07-05 19:59:08 +01:00
parent 5dbb0d177e
commit 34e9e93210

View File

@ -256,6 +256,7 @@ abstract class PluginBase implements Plugin{
}
public function reloadConfig(){
@mkdir($this->dataFolder);
$this->config = new Config($this->configFile);
if(($configStream = $this->getResource("config.yml")) !== null){
$this->config->setDefaults(yaml_parse(Config::fixYAMLIndexes(stream_get_contents($configStream))));