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