Skip to content

Commit

Permalink
TYPO3 v12.4 Compatibility
Browse files Browse the repository at this point in the history
* Drop support for TYPO3 10 + 11
* Thanks to @SSFGizmo
  • Loading branch information
Christoph Lehmann committed Aug 29, 2023
1 parent 31b100a commit 4df312f
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 25 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ on: [push, pull_request]
jobs:
build:

runs-on: ubuntu-18.04
runs-on: ubuntu-latest

strategy:
matrix:
env:
# See version matrix @ https://typo3.org/cms/roadmap
- { php: 7.4, typo3: 10.4 }
- { php: 8.1, typo3: 11.5 }
- { php: 8.2, typo3: 12.4 }

env: ${{ matrix.env }}

Expand All @@ -39,7 +38,7 @@ jobs:

- name: Install composer dependencies
run: |
composer require friendsoftypo3/phpstan-typo3:^0.8 typo3/cms-core:^$typo3 typo3/cms-reports:^$typo3
composer install
- name: Run PHPStan
run: ./.Build/bin/phpstan analyse
run: composer exec phpstan
7 changes: 5 additions & 2 deletions Classes/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Messaging\FlashMessageService;
use TYPO3\CMS\Core\Messaging\Renderer\BootstrapRenderer;
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;

Expand Down Expand Up @@ -51,13 +52,15 @@ public function testCommand(array $params): string
$fileIsUploaded,
true
);

/** @var FlashMessage $message */
$message = GeneralUtility::makeInstance(
FlashMessage::class,
implode(PHP_EOL, $this->service->getOutput()),
sprintf('%s: %s', $header, $this->service->getCommand()),
$returnValue ? FlashMessage::OK : FlashMessage::ERROR
$returnValue ? ContextualFeedbackSeverity::OK : ContextualFeedbackSeverity::ERROR
);

} catch (BinaryNotFoundException $e) {
/** @var FlashMessage $message */
$message = GeneralUtility::makeInstance(
Expand All @@ -68,7 +71,7 @@ public function testCommand(array $params): string
strtoupper($fileExtension),
$fileIsUploaded ? 'on Upload' : ''
),
FlashMessage::ERROR
ContextualFeedbackSeverity::ERROR
);
}

Expand Down
2 changes: 1 addition & 1 deletion Classes/EventListener/AfterFileProcessing.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public function __invoke(AfterFileProcessingEvent $event): void
{
if ($event->getProcessedFile()->isUpdated() && !$event->getProcessedFile()->usesOriginalFile()) {
$this->getService()->process(
Environment::getPublicPath() . '/' . ltrim($event->getProcessedFile()->getPublicUrl(true), '/'),
Environment::getPublicPath() . '/' . ltrim($event->getProcessedFile()->getPublicUrl(), '/'),
$event->getProcessedFile()->getExtension()
);
}
Expand Down
1 change: 0 additions & 1 deletion Classes/OptimizeImageService.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public function process(
): bool {
$this->reset();


if (!file_exists($file)) {
return false;
}
Expand Down
8 changes: 7 additions & 1 deletion Classes/StatusReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
namespace Lemming\Imageoptimizer;

use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity;
use TYPO3\CMS\Core\Utility\CommandUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Reports\Status;
use TYPO3\CMS\Reports\StatusProviderInterface;

class StatusReport implements StatusProviderInterface
{
public function getLabel(): string
{
return 'ImageOptimizer';
}

/**
* Determines if the needed binaries are found
*
Expand All @@ -30,7 +36,7 @@ public function getStatus(): array
'Binary ' . $binary,
$binaryFound ? 'Found' : OptimizeImageService::BINARY_NOT_FOUND,
$binaryUsed ? 'In use' : 'Not in use',
$binaryFound || $binaryUsed === false ? Status::OK : Status::ERROR
$binaryFound || $binaryUsed === false ? ContextualFeedbackSeverity::OK : ContextualFeedbackSeverity::ERROR
);
}
return $status;
Expand Down
8 changes: 8 additions & 0 deletions Configuration/Services.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
services:
_defaults:
autowire: true
autoconfigure: true
public: false
Lemming\Imageoptimizer\:
resource: '../Classes/*'
Lemming\Imageoptimizer\EventListener\BeforeFileAdded:
tags:
- name: event.listener
Expand All @@ -14,3 +20,5 @@ services:
- name: event.listener
identifier: 'ImageOptimizer'
event: TYPO3\CMS\Core\Resource\Event\AfterFileProcessingEvent
Lemming\Imageoptimizer\StatusReport:
autoconfigure: true
9 changes: 3 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"progressive"
],
"require": {
"typo3/cms-core": "^10.4 || ^11.5"
"typo3/cms-core": "^12.4"
},
"extra": {
"typo3/cms": {
Expand All @@ -36,9 +36,6 @@
}
},
"scripts": {
"run-tests":[
".Build/bin/phpstan analyse"
],
"lint-php": "find *.php Classes Configuration -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l",
"prepare-release": [
"rm -rf .github",
Expand All @@ -51,7 +48,7 @@
"typo3-ter/imageoptimizer": "self.version"
},
"require-dev": {
"friendsoftypo3/phpstan-typo3": "^0.8.1",
"typo3/cms-reports": "^10.4 || ^11.5"
"typo3/cms-reports": "^12.4",
"phpstan/phpstan": "^1.10"
}
}
4 changes: 2 additions & 2 deletions ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
'author' => 'Christoph Lehmann',
'author_email' => '[email protected]',
'state' => 'stable',
'version' => '3.1.1',
'version' => '4.0.0',
'constraints' => [
'depends' => [
'typo3' => '10.4.0-11.5.99',
'typo3' => '12.4.0-12.4.99',
],
],
];
6 changes: 0 additions & 6 deletions ext_localconf.php

This file was deleted.

1 change: 0 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ parameters:

paths:
- Classes
- ext_localconf.php

checkMissingIterableValueType: false

0 comments on commit 4df312f

Please sign in to comment.