Skip to content

Commit

Permalink
Fix #365 - Fixed exp not starting if can't fetch title/game mappings …
Browse files Browse the repository at this point in the history
…for expansion api's.
  • Loading branch information
oliverde8 committed May 11, 2018
1 parent 66ced2f commit 9b54160
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG-2.0.0.md
@@ -1,3 +1,11 @@
# 2.0.0.0
## Fixes
* Fix #365 - Fixed exp not starting if can't fetch title/game mappings for expansion api's.

# 2.0.0.0-beta2 (2018-05-10)
## Fixes
* Fixed #360 : Live ranking widgets crashing.

# 2.0.0.0-beta1 (2018-05-10)
## Fixes
* Fixed #119 : Fixed all symfony commands requiring connection to the dedicated server.
Expand Down
Expand Up @@ -57,12 +57,12 @@ public function process(ContainerBuilder $container)
protected function fetchDataFromRemote(Filesystem $fileSytem, ContainerBuilder $container)
{
$curl = new Curl();
$curl->setUrl("https://mp-expansion.com/api/maniaplanet/games");
$curl->setUrl("https://mp-expansion.com/api/maniaplanet/toZto");
$curl->run();
if ($curl->getCurlInfo()['http_code'] == 200) {
$fileSytem->put(self::MAPPINGS_FILE, $curl->getResponse());
} else {
$container->get("logger")->warning("Can't fetch title mappings from expansion website.");
echo "Can't fetch title mappings from expansion website!\n";
}
}
}
Expand Up @@ -67,6 +67,8 @@ public function __construct(
*/
public function init(OutputInterface $console)
{
$this->checkPhpExtensions($console);

$this->console->init($console, $this->dispatcher);
$this->dispatcher->dispatch(self::EVENT_BEFORE_INIT, []);

Expand All @@ -77,6 +79,47 @@ public function init(OutputInterface $console)
return $this;
}

protected function checkPhpExtensions(OutputInterface $console)
{
$extensions = array(
'openssl' => 'extension=php_openssl.dll',
'curl' => 'extension=curl.dll',
);
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$extensions['com_dotnet'] = 'extension=php_com_dotnet.dll';
}

$status = true;
$showIni = false;
foreach ($extensions as $extension => $description) {
if (!extension_loaded($extension)) {
$console->writeln(
"<error>eXpansion needs PHP extension $extension to run. Enable it to run eXpansion => " . $description . "</error>"
);
$status = false;
$showIni = true;
}
}

$recommend = array(
'xmlrpc' => "It will have better performances !",
);
foreach ($recommend as $extension => $reason) {
if (!extension_loaded($extension)) {
$console->writeln(
"<error>eXpansion works better with PHP extension</error> <info>$extension</info>: " . $reason . ""
);
$showIni = true;
}
}

if ($showIni) {
$console->writeln('<info>[PHP] PHP is using fallowing ini file :</info> "'. php_ini_loaded_file() .'"');
sleep(5);
}
return $status;
}

/**
* Run eXpansion
*
Expand Down

0 comments on commit 9b54160

Please sign in to comment.