Fix thumbnail generation command
All checks were successful
timw4mail/HummingBirdAnimeClient/develop This commit looks good

This commit is contained in:
Timothy Warren 2019-05-08 13:19:03 -04:00
parent 74ab8bd8b9
commit 76b23c7646
2 changed files with 16 additions and 16 deletions

View File

@ -82,7 +82,7 @@ class BaseCommand extends Command {
$configArray = array_replace_recursive($baseConfig, $config, $overrideConfig);
$di = function ($configArray) use ($APP_DIR) {
$di = static function ($configArray) use ($APP_DIR) {
$container = new Container();
// -------------------------------------------------------------------------
@ -100,24 +100,24 @@ class BaseCommand extends Command {
$container->setLogger($kitsu_request_logger, 'kitsu-request');
// Create Config Object
$container->set('config', function() use ($configArray) {
$container->set('config', static function() use ($configArray) {
return new Config($configArray);
});
// Create Cache Object
$container->set('cache', function($container) {
$container->set('cache', static function($container) {
$logger = $container->getLogger();
$config = $container->get('config')->get('cache');
return new Pool($config, $logger);
});
// Create Aura Router Object
$container->set('aura-router', function() {
$container->set('aura-router', static function() {
return new RouterContainer;
});
// Create Request/Response Objects
$container->set('request', function() {
$container->set('request', static function() {
return ServerRequestFactory::fromGlobals(
$_SERVER,
$_GET,
@ -126,17 +126,17 @@ class BaseCommand extends Command {
$_FILES
);
});
$container->set('response', function() {
$container->set('response', static function() {
return new Response;
});
// Create session Object
$container->set('session', function() {
$container->set('session', static function() {
return (new SessionFactory())->newInstance($_COOKIE);
});
// Models
$container->set('kitsu-model', function($container) {
$container->set('kitsu-model', static function($container) {
$requestBuilder = new KitsuRequestBuilder();
$requestBuilder->setLogger($container->getLogger('kitsu-request'));
@ -152,7 +152,7 @@ class BaseCommand extends Command {
$model->setCache($cache);
return $model;
});
$container->set('anilist-model', function ($container) {
$container->set('anilist-model', static function ($container) {
$requestBuilder = new Anilist\AnilistRequestBuilder();
$requestBuilder->setLogger($container->getLogger('anilist-request'));
@ -166,21 +166,21 @@ class BaseCommand extends Command {
return $model;
});
$container->set('settings-model', function($container) {
$container->set('settings-model', static function($container) {
$model = new Model\Settings($container->get('config'));
$model->setContainer($container);
return $model;
});
$container->set('auth', function($container) {
$container->set('auth', static function($container) {
return new Kitsu\Auth($container);
});
$container->set('url-generator', function($container) {
$container->set('url-generator', static function($container) {
return new UrlGenerator($container);
});
$container->set('util', function($container) {
$container->set('util', static function($container) {
return new Util($container);
});

View File

@ -17,7 +17,7 @@
namespace Aviat\AnimeClient\Command;
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
@ -40,7 +40,7 @@ final class UpdateThumbnails extends ClearThumbnails {
$this->setContainer($this->setupContainer());
$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');
// Clear the existing thunbnails
@ -53,7 +53,7 @@ final class UpdateThumbnails extends ClearThumbnails {
{
foreach ($typeIds as $id)
{
$this->controller->images($type, "{$id}.jpg", FALSE);
$this->controller->cache($type, "{$id}.jpg", FALSE);
}
$this->echoBox("Finished regenerating {$type} thumbnails");