From 9f405a2ce6022388dfa00f1d912615acd37cda85 Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Thu, 29 May 2025 03:05:00 +0200 Subject: [PATCH 1/2] Update version to 6.1.0 --- Documentation/ChangeLog/Index.rst | 15 +++++++++++++++ composer.json | 2 +- ext_emconf.php | 4 ++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Documentation/ChangeLog/Index.rst b/Documentation/ChangeLog/Index.rst index ec4cc2a..f02447f 100644 --- a/Documentation/ChangeLog/Index.rst +++ b/Documentation/ChangeLog/Index.rst @@ -4,6 +4,21 @@ ChangeLog ========= +Version 6.1.0 +============= + +* Add feature to prevent counting files of sub-folders +* Repair creating new file +* Prevent class properties where possible (stateless) +* Use "new" if class has state +* Prevent additional API calls where possible + +Version 6.0.0 +============= + +* Add TYPO3 compatibility +* Remove support for older TYPO3 versions + Version 5.0.2 ============= diff --git a/composer.json b/composer.json index c01e76b..72780d5 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "source": "https://github.com/froemken/dropbox" }, "require": { - "typo3/cms-core": "^13.4.3", + "typo3/cms-core": "^13.4.12", "spatie/dropbox-api": "1.23.0" }, "require-dev": { diff --git a/ext_emconf.php b/ext_emconf.php index 60de9a2..aeff02d 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -8,10 +8,10 @@ 'author_email' => 'froemken@gmail.com', 'state' => 'stable', 'clearCacheOnLoad' => true, - 'version' => '6.0.0', + 'version' => '6.1.0', 'constraints' => [ 'depends' => [ - 'typo3' => '13.4.3-13.4.99', + 'typo3' => '13.4.12-13.4.99', ], 'conflicts' => [ ], From 8988a87a79e58534a049f98e24d5a88026c76274 Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Thu, 29 May 2025 03:10:09 +0200 Subject: [PATCH 2/2] Apply CGL --- Classes/Driver/DropboxDriver.php | 2 +- Classes/Extractor/ImageExtractor.php | 1 - .../Private/PHP/spatie/dropbox-api/src/Client.php | 13 ++++++------- .../dropbox-api/src/Exceptions/BadRequest.php | 3 +-- .../dropbox-api/src/InMemoryTokenProvider.php | 4 +--- .../spatie/dropbox-api/src/UploadSessionCursor.php | 3 +-- 6 files changed, 10 insertions(+), 16 deletions(-) diff --git a/Classes/Driver/DropboxDriver.php b/Classes/Driver/DropboxDriver.php index 466b065..5242e72 100644 --- a/Classes/Driver/DropboxDriver.php +++ b/Classes/Driver/DropboxDriver.php @@ -666,7 +666,7 @@ protected function canonicalizeAndCheckFolderIdentifier($folderIdentifier): stri return rtrim($this->canonicalizeAndCheckFileIdentifier($folderIdentifier), '/') . '/'; } - public function getPathInfo(string $folderIdentifier, string $fileIdentifier = null): PathInfoInterface + public function getPathInfo(string $folderIdentifier, ?string $fileIdentifier = null): PathInfoInterface { if ($fileIdentifier !== null) { $fileIdentifier = $fileIdentifier === '/' ? '/' : rtrim($fileIdentifier, '/'); diff --git a/Classes/Extractor/ImageExtractor.php b/Classes/Extractor/ImageExtractor.php index 05fa37f..ccf3a9a 100644 --- a/Classes/Extractor/ImageExtractor.php +++ b/Classes/Extractor/ImageExtractor.php @@ -13,7 +13,6 @@ use StefanFroemken\Dropbox\Client\DropboxClient; use StefanFroemken\Dropbox\Client\DropboxClientFactory; -use TYPO3\CMS\Core\Resource\AbstractFile; use TYPO3\CMS\Core\Resource\File; use TYPO3\CMS\Core\Resource\FileType; use TYPO3\CMS\Core\Resource\Index\ExtractorInterface; diff --git a/Resources/Private/PHP/spatie/dropbox-api/src/Client.php b/Resources/Private/PHP/spatie/dropbox-api/src/Client.php index a6748ff..bb88822 100644 --- a/Resources/Private/PHP/spatie/dropbox-api/src/Client.php +++ b/Resources/Private/PHP/spatie/dropbox-api/src/Client.php @@ -2,7 +2,6 @@ namespace Spatie\Dropbox; -use Exception; use GrahamCampbell\GuzzleFactory\GuzzleFactory; use GuzzleHttp\Client as GuzzleClient; use GuzzleHttp\ClientInterface; @@ -300,7 +299,7 @@ public function getThumbnail(string $path, string $format = 'jpeg', string $size $response = $this->contentEndpointRequest('files/get_thumbnail', $arguments); - return (string) $response->getBody(); + return (string)$response->getBody(); } /** @@ -446,7 +445,7 @@ public function uploadChunked(string $path, mixed $contents, string $mode = 'add } /** - * @throws Exception + * @throws \Exception */ protected function uploadChunk(int $type, StreamInterface &$stream, int $chunkSize, ?UploadSessionCursor $cursor = null): UploadSessionCursor { @@ -469,7 +468,7 @@ protected function uploadChunk(int $type, StreamInterface &$stream, int $chunkSi return $this->uploadSessionAppend($chunkStream, $cursor); } - throw new Exception('Invalid type'); + throw new \Exception('Invalid type'); } catch (RequestException $exception) { if ($tries < $maximumTries) { // rewind @@ -578,7 +577,7 @@ protected function normalizePath(string $path): string $path = trim($path, '/'); - return ($path === '') ? '' : '/'.$path; + return ($path === '') ? '' : '/' . $path; } protected function getEndpointUrl(string $subdomain, string $endpoint): string @@ -652,7 +651,7 @@ public function rpcEndpointRequest(string $endpoint, ?array $parameters = null, return json_decode($response->getBody(), true) ?? []; } - protected function determineException(ClientException $exception): Exception + protected function determineException(ClientException $exception): \Exception { if (in_array($exception->getResponse()->getStatusCode(), [400, 409])) { return new BadRequest($exception->getResponse()); @@ -764,7 +763,7 @@ protected function getHeadersForBearerToken(string $token): array protected function getHeadersForCredentials(): array { return [ - 'Authorization' => 'Basic '.base64_encode("{$this->appKey}:{$this->appSecret}"), + 'Authorization' => 'Basic ' . base64_encode("{$this->appKey}:{$this->appSecret}"), ]; } } diff --git a/Resources/Private/PHP/spatie/dropbox-api/src/Exceptions/BadRequest.php b/Resources/Private/PHP/spatie/dropbox-api/src/Exceptions/BadRequest.php index 3449b6f..473eab4 100644 --- a/Resources/Private/PHP/spatie/dropbox-api/src/Exceptions/BadRequest.php +++ b/Resources/Private/PHP/spatie/dropbox-api/src/Exceptions/BadRequest.php @@ -2,10 +2,9 @@ namespace Spatie\Dropbox\Exceptions; -use Exception; use Psr\Http\Message\ResponseInterface; -class BadRequest extends Exception +class BadRequest extends \Exception { public ?string $dropboxCode = null; diff --git a/Resources/Private/PHP/spatie/dropbox-api/src/InMemoryTokenProvider.php b/Resources/Private/PHP/spatie/dropbox-api/src/InMemoryTokenProvider.php index 083b44a..e2fd92a 100644 --- a/Resources/Private/PHP/spatie/dropbox-api/src/InMemoryTokenProvider.php +++ b/Resources/Private/PHP/spatie/dropbox-api/src/InMemoryTokenProvider.php @@ -4,9 +4,7 @@ class InMemoryTokenProvider implements TokenProvider { - public function __construct(protected string $token) - { - } + public function __construct(protected string $token) {} public function getToken(): string { diff --git a/Resources/Private/PHP/spatie/dropbox-api/src/UploadSessionCursor.php b/Resources/Private/PHP/spatie/dropbox-api/src/UploadSessionCursor.php index e2c4946..a768e5b 100644 --- a/Resources/Private/PHP/spatie/dropbox-api/src/UploadSessionCursor.php +++ b/Resources/Private/PHP/spatie/dropbox-api/src/UploadSessionCursor.php @@ -13,6 +13,5 @@ public function __construct( * The amount of data that has been uploaded so far. We use this to make sure upload data isn't lost or duplicated in the event of a network error. */ public int $offset = 0, - ) { - } + ) {} }