diff --git a/application/core/Files/AsynchronousFileReader.php b/application/core/Files/AsynchronousFileReader.php index ea8bbf2b..98e8f9b6 100644 --- a/application/core/Files/AsynchronousFileReader.php +++ b/application/core/Files/AsynchronousFileReader.php @@ -127,7 +127,6 @@ class AsynchronousFileReader { } $content = str_replace(array("\r", "\n"), '', $content); - if ($compression) { $content = gzencode($content); $header = array("Content-Type: " . $contentType, "Keep-Alive: 300", "Connection: Keep-Alive", "Content-Encoding: gzip"); diff --git a/application/core/ManiaControl.php b/application/core/ManiaControl.php index f529db92..f655a48b 100644 --- a/application/core/ManiaControl.php +++ b/application/core/ManiaControl.php @@ -5,6 +5,7 @@ namespace ManiaControl; use ManiaControl\Admin\ActionsMenu; use ManiaControl\Admin\AuthenticationManager; use ManiaControl\Callbacks\CallbackManager; +use ManiaControl\Callbacks\TimerListener; use ManiaControl\Callbacks\TimerManager; use ManiaControl\Commands\CommandListener; use ManiaControl\Commands\CommandManager; @@ -38,7 +39,7 @@ require_once __DIR__ . '/Libs/curl-easy/autoload.php'; * @copyright ManiaControl Copyright © 2014 ManiaControl Team * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 */ -class ManiaControl implements CommandListener { +class ManiaControl implements CommandListener, TimerListener { /** * Constants */ @@ -234,6 +235,9 @@ class ManiaControl implements CommandListener { $this->errorHandler->errorHandler($error['type'], $error['message'], $error['file'], $error['line']); } + //Disable Garbage Collector + gc_disable(); + $this->log('Quitting ManiaControl!'); exit(); } @@ -290,6 +294,10 @@ class ManiaControl implements CommandListener { // AfterInit callback $this->callbackManager->triggerCallback(CallbackManager::CB_AFTERINIT); + //Enable Garbage Collecting + gc_enable(); + $this->timerManager->registerTimerListening($this, 'collectGarbage', 1000 * 60); + // Announce ManiaControl $this->chat->sendInformation('ManiaControl v' . self::VERSION . ' successfully started!'); @@ -328,6 +336,13 @@ class ManiaControl implements CommandListener { $this->quit(); } + /** + * Collect Garbage + */ + public function collectGarbage() { + gc_collect_cycles(); + } + /** * Connect to ManiaPlanet server */