Skip to content

Commit

Permalink
removed old code
Browse files Browse the repository at this point in the history
  • Loading branch information
mirko-pagliai committed Mar 13, 2023
1 parent d83424f commit 7784bad
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"require": {
"php": ">=7.4",
"ext-fileinfo": "*",
"cakephp/cakephp": "^4.0",
"cakephp/cakephp": "^4.4",
"intervention/image": "^2.4",
"mirko-pagliai/me-tools": "~2.23.1",
"mirko-pagliai/php-thumber": "~1.5.3"
Expand Down
9 changes: 2 additions & 7 deletions src/Middleware/ThumbnailMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
namespace Thumber\Cake\Middleware;

use Cake\Core\Configure;
use Cake\Http\Response;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
Expand All @@ -41,16 +40,12 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
/** @var \Cake\Http\ServerRequest $request */
$file = Filesystem::instance()->concatenate(THUMBER_TARGET, base64_decode($request->getParam('basename')));
if (!is_readable($file)) {
throw new ThumbNotFoundException(__d('thumber', 'File `{0}` doesn\'t exist', $file));
throw new ThumbNotFoundException(__d('thumber', "File `{0}` doesn't exist", $file));
}

$response = new Response();
$response = $response->withModified(filemtime($file) ?: 0);
/**
* @todo to be removed in a later version
*/
$method = version_compare(Configure::version(), '4.4', '>=') ? 'isNotModified' : 'checkNotModified';
if ($response->$method($request)) {
if ($response->isNotModified($request)) {
return $response->withNotModified();
}

Expand Down
7 changes: 0 additions & 7 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,4 @@
define('THUMBER_TARGET', Configure::read('Thumber.target', TMP . 'thumbs'));
$_SERVER['PHP_SELF'] = '/';

/**
* @todo to be removed in a later version
*/
if (!class_exists('Cake\Console\TestSuite\StubConsoleOutput')) {
class_alias('Cake\TestSuite\Stub\ConsoleOutput', 'Cake\Console\TestSuite\StubConsoleOutput');
}

echo 'Running tests for "' . getenv('THUMBER_DRIVER') . '" driver ' . PHP_EOL;

0 comments on commit 7784bad

Please sign in to comment.