Merge remote-tracking branch 'origin/master' into develop

This commit is contained in:
Timothy Warren 2017-12-04 16:07:46 -05:00
commit ee57f72ca6
2 changed files with 22 additions and 14 deletions

View File

@ -18,7 +18,7 @@ namespace Aviat\EasyMin;
use function Amp\wait; use function Amp\wait;
use Amp\Artax\{Client, FormBody, Request}; use Amp\Artax\{Client, FormBody, Request};
use Aviat\Ion\Json; use Aviat\Ion\{Json, JsonException};
// Include Amp and Artax // Include Amp and Artax
require_once('../vendor/autoload.php'); require_once('../vendor/autoload.php');
@ -121,7 +121,7 @@ class JSMin {
$request = (new Request) $request = (new Request)
->setMethod('POST') ->setMethod('POST')
->setUri('http://closure-compiler.appspot.com/compile') ->setUri('https://closure-compiler.appspot.com/compile')
->setAllHeaders([ ->setAllHeaders([
'Accept' => 'application/json', 'Accept' => 'application/json',
'Accept-Encoding' => 'gzip', 'Accept-Encoding' => 'gzip',
@ -144,17 +144,25 @@ class JSMin {
*/ */
protected function checkMinifyErrors($options) protected function checkMinifyErrors($options)
{ {
$errorRes = $this->closureCall($options); try
$errorJson = $errorRes->getBody();
$errorObj = Json::decode($errorJson) ?: (object)[];
// Show error if exists
if ( ! empty($errorObj->errors) || ! empty($errorObj->serverErrors))
{ {
$errorJson = Json::encode($errorObj, JSON_PRETTY_PRINT); $errorRes = $this->closureCall($options);
header('Content-type: application/javascript'); $errorJson = $errorRes->getBody();
echo "console.error(${errorJson});"; $errorObj = Json::decode($errorJson) ?: (object)[];
// Show error if exists
if ( ! empty($errorObj->errors) || ! empty($errorObj->serverErrors))
{
$errorJson = Json::encode($errorObj, JSON_PRETTY_PRINT);
header('Content-type: application/javascript');
echo "console.error(${errorJson});";
die();
}
}
catch (JsonException $e)
{
print_r($e);
die(); die();
} }
} }

View File

@ -112,7 +112,7 @@ class SyncKitsuWithMal extends BaseCommand {
if ( ! empty($data['updateKitsu'])) if ( ! empty($data['updateKitsu']))
{ {
print_r($data['updateKitsu']); // print_r($data['updateKitsu']);
$count = count($data['updateKitsu']); $count = count($data['updateKitsu']);
$this->echoBox("Updating {$count} outdated Kitsu {$type} list items"); $this->echoBox("Updating {$count} outdated Kitsu {$type} list items");
$this->updateKitsuListItems($data['updateKitsu'], $type); $this->updateKitsuListItems($data['updateKitsu'], $type);
@ -244,6 +244,7 @@ class SyncKitsuWithMal extends BaseCommand {
foreach($data['data'] as $listItem) foreach($data['data'] as $listItem)
{ {
$id = $listItem['relationships'][$type]['data']['id']; $id = $listItem['relationships'][$type]['data']['id'];
$potentialMappings = $includes[$type][$id]['relationships']['mappings']; $potentialMappings = $includes[$type][$id]['relationships']['mappings'];
$malId = NULL; $malId = NULL;
@ -291,7 +292,6 @@ class SyncKitsuWithMal extends BaseCommand {
foreach($missingMalIds as $mid) foreach($missingMalIds as $mid)
{ {
// print_r($malList[$mid]);
$itemsToAddToKitsu[] = array_merge($malList[$mid]['data'], [ $itemsToAddToKitsu[] = array_merge($malList[$mid]['data'], [
'id' => $this->kitsuModel->getKitsuIdFromMALId($mid, $type), 'id' => $this->kitsuModel->getKitsuIdFromMALId($mid, $type),
'type' => $type 'type' => $type