From 2a34b3f6059c4f99eddbe68434c81347277c33f6 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Tue, 13 Jan 2015 20:15:33 +0100 Subject: [PATCH] Fixes "Too many open files" This fixes issues with not closing resources given by PocketMine, causing a crash at a later stage. Users usually blame PocketMine for this, but it's entirely a plugin's fault. This code was found via GitHub search, please review your code for usage of: * `Plugin->getResource()` without `fclose()` calls later * Not needed `Plugin->getResource()` calls * `fopen()` calls without `fclose()` * `popen()` calls without `pclose()` --- src/clodyx/qrcraft/QRcraftPlugIn.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/clodyx/qrcraft/QRcraftPlugIn.php b/src/clodyx/qrcraft/QRcraftPlugIn.php index 2711119..5b4168d 100644 --- a/src/clodyx/qrcraft/QRcraftPlugIn.php +++ b/src/clodyx/qrcraft/QRcraftPlugIn.php @@ -45,10 +45,7 @@ class QRcraftPlugIn extends PluginBase implements CommandExecutor public function loadConfiguration() { - if (!file_exists($this->getDataFolder() . "config.yml")) { - @mkdir($this->getDataFolder()); - file_put_contents($this->getDataFolder() . "config.yml", $this->getResource("config.yml")); - } + $this->saveDefaultConfig(); } public function onDisable() @@ -83,4 +80,4 @@ class QRcraftPlugIn extends PluginBase implements CommandExecutor } -} \ No newline at end of file +}