Fixed Bug in Windows in Webreader

This commit is contained in:
kremsy
2017-04-15 23:00:24 +02:00
parent 26b508311c
commit 32514fe740
7 changed files with 93 additions and 17 deletions

View File

@ -520,7 +520,9 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
Logger::log('Restarting ManiaControl... ' . $message);
// Start new instance
SystemUtil::restart();
if (!defined('PHP_UNIT_TEST')) {
SystemUtil::restart();
}
// Quit old instance
$this->quit('Quitting ManiaControl to restart.');
@ -587,7 +589,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
$this->getChat()->sendInformation('ManiaControl v' . self::VERSION . ' successfully started!');
$this->startTime = time();
// Main loop
while (!$this->requestQuitMessage) {
$this->loop();
@ -601,7 +603,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
}
// Shutdown
$this->quit($this->requestQuitMessage);
$this->quit($this->requestQuitMessage);
} catch (TransportException $exception) {
Logger::logError('Connection interrupted!');
$this->getErrorHandler()->handleException($exception);
@ -690,7 +692,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
$loopStart = microtime(true);
// Extend script timeout
if(!defined('PHP_UNIT_TEST')){
if (!defined('PHP_UNIT_TEST')) {
set_time_limit(self::SCRIPT_TIMEOUT);
}

View File

@ -204,6 +204,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis
$response = WebReader::getUrl($url);
$dataJson = $response->getContent();
$pluginData = json_decode($dataJson);
if (!$pluginData || empty($pluginData)) {
return false;
}

View File

@ -46,7 +46,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
/** @var UpdateData $coreUpdateData */
private $coreUpdateData = null;
/** @var PluginUpdateManager $pluginUpdateManager */
/** @var PluginUpdateManager $pluginUpdateManager */
private $pluginUpdateManager = null;
/**
@ -377,13 +377,16 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
return;
}
if(!defined('PHP_UNIT_TEST')){
//Don't overwrite the files while testing
if (!defined('PHP_UNIT_TEST')) {
$zip->extractTo(MANIACONTROL_PATH);
$zip->close();
unlink($updateFileName);
FileUtil::deleteTempFolder();
}
$zip->close();
unlink($updateFileName);
FileUtil::deleteTempFolder();
// Set the build date
$this->setBuildDate($updateData->releaseDate);

View File

@ -15,7 +15,6 @@ use ManiaControl\ManiaControl;
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
abstract class WebReader {
/**
* Load a URL via GET
*
@ -58,10 +57,12 @@ abstract class WebReader {
->set(CURLOPT_ENCODING, '')// accept encoding
->set(CURLOPT_USERAGENT, 'ManiaControl v' . ManiaControl::VERSION)// user-agent
->set(CURLOPT_RETURNTRANSFER, true)// return instead of output content
->set(CURLOPT_AUTOREFERER, true); // follow redirects
->set(CURLOPT_AUTOREFERER, true)// follow redirects
->set(CURLOPT_SSL_VERIFYPEER, false);
return $request;
}
/**
* Perform the given callback function with the response
*