PluginManager: Automatically create data directories for plugins (#2284)

This commit is contained in:
Dylan K. Taylor 2018-07-21 15:57:37 +01:00 committed by GitHub
parent 90bf94f8f7
commit 40c28f4d26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

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

View File

@ -181,6 +181,9 @@ class PluginManager{
$this->server->getLogger()->error("Projected dataFolder '" . $dataFolder . "' for " . $description->getName() . " exists and is not a directory");
return null;
}
if(!file_exists($dataFolder)){
mkdir($dataFolder, 0777, true);
}
$prefixed = $loader->getAccessProtocol() . $path;
$loader->loadPlugin($prefixed);