Fix thumbnail generation command
All checks were successful
timw4mail/HummingBirdAnimeClient/develop This commit looks good
All checks were successful
timw4mail/HummingBirdAnimeClient/develop This commit looks good
This commit is contained in:
parent
74ab8bd8b9
commit
76b23c7646
@ -82,7 +82,7 @@ class BaseCommand extends Command {
|
|||||||
|
|
||||||
$configArray = array_replace_recursive($baseConfig, $config, $overrideConfig);
|
$configArray = array_replace_recursive($baseConfig, $config, $overrideConfig);
|
||||||
|
|
||||||
$di = function ($configArray) use ($APP_DIR) {
|
$di = static function ($configArray) use ($APP_DIR) {
|
||||||
$container = new Container();
|
$container = new Container();
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
@ -100,24 +100,24 @@ class BaseCommand extends Command {
|
|||||||
$container->setLogger($kitsu_request_logger, 'kitsu-request');
|
$container->setLogger($kitsu_request_logger, 'kitsu-request');
|
||||||
|
|
||||||
// Create Config Object
|
// Create Config Object
|
||||||
$container->set('config', function() use ($configArray) {
|
$container->set('config', static function() use ($configArray) {
|
||||||
return new Config($configArray);
|
return new Config($configArray);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create Cache Object
|
// Create Cache Object
|
||||||
$container->set('cache', function($container) {
|
$container->set('cache', static function($container) {
|
||||||
$logger = $container->getLogger();
|
$logger = $container->getLogger();
|
||||||
$config = $container->get('config')->get('cache');
|
$config = $container->get('config')->get('cache');
|
||||||
return new Pool($config, $logger);
|
return new Pool($config, $logger);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create Aura Router Object
|
// Create Aura Router Object
|
||||||
$container->set('aura-router', function() {
|
$container->set('aura-router', static function() {
|
||||||
return new RouterContainer;
|
return new RouterContainer;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create Request/Response Objects
|
// Create Request/Response Objects
|
||||||
$container->set('request', function() {
|
$container->set('request', static function() {
|
||||||
return ServerRequestFactory::fromGlobals(
|
return ServerRequestFactory::fromGlobals(
|
||||||
$_SERVER,
|
$_SERVER,
|
||||||
$_GET,
|
$_GET,
|
||||||
@ -126,17 +126,17 @@ class BaseCommand extends Command {
|
|||||||
$_FILES
|
$_FILES
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
$container->set('response', function() {
|
$container->set('response', static function() {
|
||||||
return new Response;
|
return new Response;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create session Object
|
// Create session Object
|
||||||
$container->set('session', function() {
|
$container->set('session', static function() {
|
||||||
return (new SessionFactory())->newInstance($_COOKIE);
|
return (new SessionFactory())->newInstance($_COOKIE);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
$container->set('kitsu-model', function($container) {
|
$container->set('kitsu-model', static function($container) {
|
||||||
$requestBuilder = new KitsuRequestBuilder();
|
$requestBuilder = new KitsuRequestBuilder();
|
||||||
$requestBuilder->setLogger($container->getLogger('kitsu-request'));
|
$requestBuilder->setLogger($container->getLogger('kitsu-request'));
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ class BaseCommand extends Command {
|
|||||||
$model->setCache($cache);
|
$model->setCache($cache);
|
||||||
return $model;
|
return $model;
|
||||||
});
|
});
|
||||||
$container->set('anilist-model', function ($container) {
|
$container->set('anilist-model', static function ($container) {
|
||||||
$requestBuilder = new Anilist\AnilistRequestBuilder();
|
$requestBuilder = new Anilist\AnilistRequestBuilder();
|
||||||
$requestBuilder->setLogger($container->getLogger('anilist-request'));
|
$requestBuilder->setLogger($container->getLogger('anilist-request'));
|
||||||
|
|
||||||
@ -166,21 +166,21 @@ class BaseCommand extends Command {
|
|||||||
|
|
||||||
return $model;
|
return $model;
|
||||||
});
|
});
|
||||||
$container->set('settings-model', function($container) {
|
$container->set('settings-model', static function($container) {
|
||||||
$model = new Model\Settings($container->get('config'));
|
$model = new Model\Settings($container->get('config'));
|
||||||
$model->setContainer($container);
|
$model->setContainer($container);
|
||||||
return $model;
|
return $model;
|
||||||
});
|
});
|
||||||
|
|
||||||
$container->set('auth', function($container) {
|
$container->set('auth', static function($container) {
|
||||||
return new Kitsu\Auth($container);
|
return new Kitsu\Auth($container);
|
||||||
});
|
});
|
||||||
|
|
||||||
$container->set('url-generator', function($container) {
|
$container->set('url-generator', static function($container) {
|
||||||
return new UrlGenerator($container);
|
return new UrlGenerator($container);
|
||||||
});
|
});
|
||||||
|
|
||||||
$container->set('util', function($container) {
|
$container->set('util', static function($container) {
|
||||||
return new Util($container);
|
return new Util($container);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
namespace Aviat\AnimeClient\Command;
|
namespace Aviat\AnimeClient\Command;
|
||||||
|
|
||||||
use Aviat\AnimeClient\API\JsonAPI;
|
use Aviat\AnimeClient\API\JsonAPI;
|
||||||
use Aviat\AnimeClient\Controller\Index;
|
use Aviat\AnimeClient\Controller\Images;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears out image cache directories, then re-creates the image cache
|
* Clears out image cache directories, then re-creates the image cache
|
||||||
@ -40,7 +40,7 @@ final class UpdateThumbnails extends ClearThumbnails {
|
|||||||
$this->setContainer($this->setupContainer());
|
$this->setContainer($this->setupContainer());
|
||||||
$this->setCache($this->container->get('cache'));
|
$this->setCache($this->container->get('cache'));
|
||||||
|
|
||||||
$this->controller = new Index($this->container);
|
$this->controller = new Images($this->container);
|
||||||
$this->kitsuModel = $this->container->get('kitsu-model');
|
$this->kitsuModel = $this->container->get('kitsu-model');
|
||||||
|
|
||||||
// Clear the existing thunbnails
|
// Clear the existing thunbnails
|
||||||
@ -53,7 +53,7 @@ final class UpdateThumbnails extends ClearThumbnails {
|
|||||||
{
|
{
|
||||||
foreach ($typeIds as $id)
|
foreach ($typeIds as $id)
|
||||||
{
|
{
|
||||||
$this->controller->images($type, "{$id}.jpg", FALSE);
|
$this->controller->cache($type, "{$id}.jpg", FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->echoBox("Finished regenerating {$type} thumbnails");
|
$this->echoBox("Finished regenerating {$type} thumbnails");
|
||||||
|
Loading…
Reference in New Issue
Block a user