Browse Source

Fix thumbnail generation command

develop
Timothy Warren 2 weeks ago
parent
commit
76b23c7646
2 changed files with 16 additions and 16 deletions
  1. 13
    13
      src/Command/BaseCommand.php
  2. 3
    3
      src/Command/UpdateThumbnails.php

+ 13
- 13
src/Command/BaseCommand.php View File

@@ -82,7 +82,7 @@ class BaseCommand extends Command {
82 82
 
83 83
 		$configArray = array_replace_recursive($baseConfig, $config, $overrideConfig);
84 84
 
85
-		$di = function ($configArray) use ($APP_DIR) {
85
+		$di = static function ($configArray) use ($APP_DIR) {
86 86
 			$container = new Container();
87 87
 
88 88
 			// -------------------------------------------------------------------------
@@ -100,24 +100,24 @@ class BaseCommand extends Command {
100 100
 			$container->setLogger($kitsu_request_logger, 'kitsu-request');
101 101
 
102 102
 			// Create Config Object
103
-			$container->set('config', function() use ($configArray) {
103
+			$container->set('config', static function() use ($configArray) {
104 104
 				return new Config($configArray);
105 105
 			});
106 106
 
107 107
 			// Create Cache Object
108
-			$container->set('cache', function($container) {
108
+			$container->set('cache', static function($container) {
109 109
 				$logger = $container->getLogger();
110 110
 				$config = $container->get('config')->get('cache');
111 111
 				return new Pool($config, $logger);
112 112
 			});
113 113
 
114 114
 			// Create Aura Router Object
115
-			$container->set('aura-router', function() {
115
+			$container->set('aura-router', static function() {
116 116
 				return new RouterContainer;
117 117
 			});
118 118
 
119 119
 			// Create Request/Response Objects
120
-			$container->set('request', function() {
120
+			$container->set('request', static function() {
121 121
 				return ServerRequestFactory::fromGlobals(
122 122
 					$_SERVER,
123 123
 					$_GET,
@@ -126,17 +126,17 @@ class BaseCommand extends Command {
126 126
 					$_FILES
127 127
 				);
128 128
 			});
129
-			$container->set('response', function() {
129
+			$container->set('response', static function() {
130 130
 				return new Response;
131 131
 			});
132 132
 
133 133
 			// Create session Object
134
-			$container->set('session', function() {
134
+			$container->set('session', static function() {
135 135
 				return (new SessionFactory())->newInstance($_COOKIE);
136 136
 			});
137 137
 
138 138
 			// Models
139
-			$container->set('kitsu-model', function($container) {
139
+			$container->set('kitsu-model', static function($container) {
140 140
 				$requestBuilder = new KitsuRequestBuilder();
141 141
 				$requestBuilder->setLogger($container->getLogger('kitsu-request'));
142 142
 
@@ -152,7 +152,7 @@ class BaseCommand extends Command {
152 152
 				$model->setCache($cache);
153 153
 				return $model;
154 154
 			});
155
-			$container->set('anilist-model', function ($container) {
155
+			$container->set('anilist-model', static function ($container) {
156 156
 				$requestBuilder = new Anilist\AnilistRequestBuilder();
157 157
 				$requestBuilder->setLogger($container->getLogger('anilist-request'));
158 158
 
@@ -166,21 +166,21 @@ class BaseCommand extends Command {
166 166
 
167 167
 				return $model;
168 168
 			});
169
-			$container->set('settings-model', function($container) {
169
+			$container->set('settings-model', static function($container) {
170 170
 				$model =  new Model\Settings($container->get('config'));
171 171
 				$model->setContainer($container);
172 172
 				return $model;
173 173
 			});
174 174
 
175
-			$container->set('auth', function($container) {
175
+			$container->set('auth', static function($container) {
176 176
 				return new Kitsu\Auth($container);
177 177
 			});
178 178
 
179
-			$container->set('url-generator', function($container) {
179
+			$container->set('url-generator', static function($container) {
180 180
 				return new UrlGenerator($container);
181 181
 			});
182 182
 
183
-			$container->set('util', function($container) {
183
+			$container->set('util', static function($container) {
184 184
 				return new Util($container);
185 185
 			});
186 186
 

+ 3
- 3
src/Command/UpdateThumbnails.php View File

@@ -17,7 +17,7 @@
17 17
 namespace Aviat\AnimeClient\Command;
18 18
 
19 19
 use Aviat\AnimeClient\API\JsonAPI;
20
-use Aviat\AnimeClient\Controller\Index;
20
+use Aviat\AnimeClient\Controller\Images;
21 21
 
22 22
 /**
23 23
  * Clears out image cache directories, then re-creates the image cache
@@ -40,7 +40,7 @@ final class UpdateThumbnails extends ClearThumbnails {
40 40
 		$this->setContainer($this->setupContainer());
41 41
 		$this->setCache($this->container->get('cache'));
42 42
 
43
-		$this->controller = new Index($this->container);
43
+		$this->controller = new Images($this->container);
44 44
 		$this->kitsuModel = $this->container->get('kitsu-model');
45 45
 
46 46
 		// Clear the existing thunbnails
@@ -53,7 +53,7 @@ final class UpdateThumbnails extends ClearThumbnails {
53 53
 		{
54 54
 			foreach ($typeIds as $id)
55 55
 			{
56
-				$this->controller->images($type, "{$id}.jpg", FALSE);
56
+				$this->controller->cache($type, "{$id}.jpg", FALSE);
57 57
 			}
58 58
 
59 59
 			$this->echoBox("Finished regenerating {$type} thumbnails");

Loading…
Cancel
Save