Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task/update cloudinary to version 2 #31

Open
wants to merge 99 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
1dd76dc
[TASK] Migrate to new query build api
fabarea Mar 1, 2023
f0e7bac
[TASK] Clean up some php comments
fabarea Mar 1, 2023
6ad6815
[FEATURE] Introduce cloudinary web hook handler
fabarea Mar 1, 2023
fb17629
fixup! [FEATURE] Introduce cloudinary web hook handler
fabarea Mar 7, 2023
a1493fc
[CLEANUP] Rework annotations
fabarea Mar 21, 2023
4419f36
[TASK] Fix type
fabarea Mar 21, 2023
88c2163
[FEATURE] Introduce cloudinary resource tagging and metadata
fabarea Mar 21, 2023
5723bb5
fixup! fixup! [FEATURE] Introduce cloudinary web hook handler
fabarea Mar 21, 2023
83ae9a8
[TASK] Remove legacy driver
fabarea Mar 28, 2023
6327699
[TASK] Rename fast driver to cloudinary driver
fabarea Mar 28, 2023
53dc7a6
[TASK] Update help message for cloudinary command query
fabarea Mar 28, 2023
1233fbe
[TASK] Remove unnecessary php docs
fabarea Mar 28, 2023
f5b1059
[TASK] Streamline ext_localconf
fabarea Mar 28, 2023
f22263b
fixup! [TASK] Update help message for cloudinary command query
fabarea Mar 28, 2023
3ff0b6b
[FEATURE] Introduce new typo3 command to interact with cloudinary api
fabarea Mar 28, 2023
f489f0f
[TASK] Update phpstan baseline
fabarea Mar 28, 2023
f217dca
[TASK] Composer update
fabarea Mar 28, 2023
f6c34e4
[FEATURE] Add cloudinary api query by file uid
fabarea Mar 28, 2023
343c2b6
[TASK] Better handle file rename in web hook
fabarea Mar 28, 2023
3102751
[TASK] Add phpstan command in make file
fabarea Mar 28, 2023
34cce06
[TASK] Fix CGL and introduce an event after clear cache pages
fabarea Mar 28, 2023
e2f1af9
[TASK] Improve code readability and enhance support for file renaming
fabarea Mar 30, 2023
4f5e48f
[TASK] Add example TypoScript configuration for Cloudinary WebHook
fabarea Mar 30, 2023
a74b55c
[CLEANUP] Remove unused import ExtensionManagementUtility
fabarea Mar 30, 2023
fd65b7b
[TASK] Change message to use simpler language
fabarea Mar 30, 2023
287ffe8
[TASK] Add message to response indicating which pages had their cache…
fabarea Mar 30, 2023
12f8e63
[TASK] Improve result key to be a boolean
fabarea Apr 3, 2023
403ab0f
[DOCS] Add configuration TCEFORM for interaction with Cloudinary
fabarea Apr 13, 2023
82926b0
[TASK] Indentation and return type
fabarea Apr 14, 2023
2c3bb79
[TASK] Improve console log message
fabarea Apr 14, 2023
2c94f4c
[BUGFIX] Make CloudinaryPathService nullable
fabarea May 5, 2023
1495898
[TASK] Change error message to warning message
fabarea May 5, 2023
3378ef9
fix: Only add extension for raw resources
dhuf May 5, 2023
1df0377
[REFACTOR] Better computing of cloudinary public id
fabarea May 8, 2023
58f8653
[TASK] Handle exception in fileExists method
fabarea May 8, 2023
4779723
[TASK] Add type hinting and nullable property for cloudinaryPathService
fabarea May 8, 2023
faa851a
[REFACTOR] Replace strpos with str_starts_with function for readabili…
fabarea May 8, 2023
45e8626
[ENHANCE] Option for command cloudinary:scan
fabarea May 8, 2023
2b3aebe
[REFACTOR] Streamline return types to methods that were missing them
fabarea May 8, 2023
0369655
[BUGFIX] Migrate signal slot to event dispatcher
fabarea May 9, 2023
02bf93d
[TASK] Change table name from tx_cloudinary_resource to tx_cloudinary…
fabarea May 9, 2023
1a97258
[TASK] Remove unused translation for Cloudinary resources in tt_conte…
fabarea May 9, 2023
004ec22
[CGL] Improve php return type
fabarea May 9, 2023
cf960ef
[REFACTOR] Move knownRawFormats to static property
fabarea May 9, 2023
23c3cc3
[BUGFIX] streamline computeCloudinaryPublicId method
fabarea May 9, 2023
463cd95
[BUGFIX] Improve fileExists method to return true for processed files
fabarea May 9, 2023
a13eea3
[CGL] phpstan
fabarea May 9, 2023
99f2264
[STYLE] Add return type declarations to initialize and configure meth…
fabarea May 9, 2023
1543f55
[FEATURE] Enable to recursively delete files from the command cloudin…
fabarea May 9, 2023
cdd25b6
[ENHANCE] Add help text to cloudinary:scan command
fabarea May 9, 2023
b9beafc
[REFACTOR] Remove redundant prefix from log messages in CloudinaryDri…
fabarea May 9, 2023
d8e29f8
[ENHANCE] Avoid creating empty processed folder
fabarea May 9, 2023
228eda5
[REFACTOR] Centralize getStorageObject() call
fabarea May 9, 2023
62b4d5b
[REFACTOR] Introduce MimeTypeUtility class to handle mime type guessing
fabarea May 10, 2023
d401f60
[TASK] Update cloudinary php package to version 2
fabarea Mar 30, 2023
35a4553
[TASK] Replace deprecated Cloudinary API calls with v2 ones
fabarea Mar 31, 2023
9f1cf30
[TASK] Update phpstan-baseline.neon
fabarea Mar 31, 2023
e70bab7
[DOCS] Remove obsolete processed file config
fabarea May 12, 2023
884e7dd
[STYLE] Reformat code for better readability
fabarea May 12, 2023
1eec90e
[REFACTOR] Simplify default orderings logic and use null coalescing o…
fabarea May 12, 2023
99de0d8
[REFACTOR] Simplify file extension handling in cleanFileName() method
fabarea May 12, 2023
123c2b3
[BUGFIX] Add fallback mechanism to get resource type from file extension
fabarea May 12, 2023
f06fd1d
[BUGFIX] Method getConfiguration and add support for array storage input
fabarea May 12, 2023
d5c000d
[BUGFIX] Acceptance tests
fabarea May 12, 2023
77dced3
[BUGFIX] Catch all exceptions instead of just UniqueConstraintViolati…
fabarea May 12, 2023
fb53a41
[ENHANCE] Add more descriptive help message for the command
fabarea May 12, 2023
c96448b
[STYLE] Add more spaces
fabarea May 12, 2023
9484249
[FEATURE] Add command to fix missing width and height of image
fabarea May 12, 2023
92c591a
[BUGFIX] Try again with different resource types if necessary with co…
fabarea May 17, 2023
74f9bea
[REFACTOR] Add support for type option to override resource type when…
fabarea May 17, 2023
062eea2
[BUGFIX] defaultOptions variable must be transmitted to cloudinary api
fabarea May 23, 2023
a41c584
[FEATURE] Support new "cname" option to deliver resource with private…
fabarea May 23, 2023
92cd1b6
[FEATURE] Add flag to force action without confirmation
fabarea Jun 18, 2023
e9bc1c7
[BUGFIX] Remove exception when no resources are find when deleting files
fabarea Jun 18, 2023
d568b1a
[FEATURE] Add command cloudinary:storage:list
fabarea Jul 14, 2023
70180be
[TASK] Update phpstan baseline
fabarea Jul 14, 2023
30604eb
[FEATURE] Improve storage list
fabarea Jul 14, 2023
daa48f2
[REFACTOR] Fix order of log statements in foreach loop
fabarea Jul 14, 2023
81deb5b
[REFACTOR] Code cleanup
dhuf Sep 11, 2023
ae6b6ee
[BUGFIX] FIx rename webhook failing to delete processed files (#32)
SomeBdyElse Sep 22, 2023
bfe4526
[BUGFIX] Fix endless loading spinner in TYPO3 backend (#33)
SomeBdyElse Sep 25, 2023
0ec6363
[FEATURE] Update outdated resources when a cloudinary asset gets repl…
SomeBdyElse Sep 25, 2023
fd2682d
[BUGFIX] Avoid type exception for missing images (#35)
SomeBdyElse Sep 27, 2023
45e3f80
[FEATURE] Load Cloudinary script onclick
dhuf Oct 5, 2023
846cbf1
[FEATURE] Filter % or %env for env vars
dhuf Nov 8, 2023
df696eb
[BUGFIX] Use identifier_hash in CloudinaryScanService (#38)
jrenggli Nov 21, 2023
3bd79c2
[FEATURE] JB-1236 Scale down images before transformations (#40)
SomeBdyElse Nov 29, 2023
7fd9ec0
[BUGFIX] JB-1203 Fix user defined crops
SomeBdyElse Dec 5, 2023
e957751
[TASK] JB-1250 Webhook: Speed up file lookups (#43)
SomeBdyElse Dec 12, 2023
4e1715c
feat: Refresh media library on irre elements (#44)
dhuf Feb 29, 2024
035280d
[BUGFIX] Fix Cloudinary unable to render large images
SomeBdyElse Mar 1, 2024
1ceb498
[BUGFIX] JB-1301 Fix processed files on clouds with cnames
SomeBdyElse Mar 1, 2024
c8a5e9f
[CLEANUP] Remove dead code
SomeBdyElse Mar 1, 2024
ab69ed7
[BUGFIX] Avoid exception if cloudinary is unable to render backend pr…
SomeBdyElse Mar 1, 2024
13a17a2
[BUGFIX] JB-1305 Update local file name on remote rename
SomeBdyElse Mar 1, 2024
f65a1c3
[TASK] Ensure trailing slashes in file identifier generation
SomeBdyElse Mar 1, 2024
ff440b9
[TASK] Limit cloudinary file processing to image related tasks (#46)
SomeBdyElse Mar 8, 2024
09848b7
[FEATURE] Render thumbnails for videos in the TYPO3 backend
SomeBdyElse Mar 7, 2024
c3cc208
[FEATURE] Offer image processing via cloudinary
SomeBdyElse Apr 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
.prettierrc
package.json
yarn.lock
composer.lock
/public/*
/vendor/*
54 changes: 25 additions & 29 deletions Classes/Backend/Form/Container/InlineCloudinaryControlContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,50 +12,28 @@
use TYPO3\CMS\Core\Resource\ResourceStorage;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\View\StandaloneView;
use Visol\Cloudinary\Driver\CloudinaryFastDriver;
use Visol\Cloudinary\Driver\CloudinaryDriver;
use Visol\Cloudinary\Services\ConfigurationService;

class InlineCloudinaryControlContainer extends InlineControlContainer
{

public function render() {

// We load here the cloudinary library
/** @var AssetCollector $assetCollector */
$assetCollector = GeneralUtility::makeInstance(AssetCollector::class);
$assetCollector->addJavaScript('media_library_cloudinary', 'https://media-library.cloudinary.com/global/all.js', []);

public function render()
{
/** @var PageRenderer $pageRenderer */
$pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Cloudinary/CloudinaryMediaLibrary');

return parent::render();
}

/**
* @param array $inlineConfiguration
* @return string
*/
protected function renderPossibleRecordsSelectorTypeGroupDB(array $inlineConfiguration)
protected function renderPossibleRecordsSelectorTypeGroupDB(array $inlineConfiguration): ?string
{
$typo3Buttons = parent::renderPossibleRecordsSelectorTypeGroupDB($inlineConfiguration);

// We could have multiple cloudinary buttons / storages
$cloudinaryButtons = $this->renderCloudinaryButtons($inlineConfiguration);

// Inject button before help-block
if (strpos($typo3Buttons, '</div><div class="help-block">') > 0) {
$typo3Buttons = str_replace(
'</div><div class="help-block">',
$cloudinaryButtons . '</div><div class="help-block">',
$typo3Buttons,
);
// Try to inject it into the form-control container
} elseif (preg_match('/<\/div><\/div>$/i', $typo3Buttons)) {
$typo3Buttons = preg_replace('/<\/div><\/div>$/i', $cloudinaryButtons . '</div></div>', $typo3Buttons);
} else {
$typo3Buttons .= $cloudinaryButtons;
}
$typo3Buttons = $this->appendButtons($typo3Buttons, $cloudinaryButtons);

return $typo3Buttons;
}
Expand All @@ -72,7 +50,7 @@ protected function renderCloudinaryButtons(array $inlineConfiguration): string
$view = $this->initializeStandaloneView('EXT:cloudinary/Resources/Private/Standalone/MediaLibrary/Show.html');
$view->assignMultiple([
'objectGroup' => $objectGroup,
'cloudinaryCredentials' => json_encode($this->computeCloudinaryCredentials($storages)),
'cloudinaryCredentials' => $this->computeCloudinaryCredentials($storages),
]);

return $view->render();
Expand Down Expand Up @@ -107,7 +85,7 @@ protected function getCloudinaryStorages(): array
$storageItems = $query
->select('*')
->from('sys_file_storage')
->where($query->expr()->eq('driver', $query->expr()->literal(CloudinaryFastDriver::DRIVER_TYPE)))
->where($query->expr()->eq('driver', $query->expr()->literal(CloudinaryDriver::DRIVER_TYPE)))
->execute()
->fetchAllAssociativeIndexed();

Expand Down Expand Up @@ -159,4 +137,22 @@ protected function computeCloudinaryCredentials(array $storages): array

return $cloudinaryCredentials;
}

protected function appendButtons(string $typo3Buttons, string $cloudinaryButtons): ?string
{
// Inject button before help-block
if (strpos($typo3Buttons, '</div><div class="help-block">') > 0) {
$typo3Buttons = str_replace(
'</div><div class="help-block">',
$cloudinaryButtons . '</div><div class="help-block">',
$typo3Buttons,
);
// Try to inject it into the form-control container
} elseif (preg_match('/<\/div><\/div>$/i', $typo3Buttons)) {
$typo3Buttons = preg_replace('/<\/div><\/div>$/i', $cloudinaryButtons . '</div></div>', $typo3Buttons);
} else {
$typo3Buttons .= $cloudinaryButtons;
}
return $typo3Buttons;
}
}
189 changes: 0 additions & 189 deletions Classes/Cache/CloudinaryTypo3Cache.php

This file was deleted.

4 changes: 3 additions & 1 deletion Classes/CloudinaryException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Visol\Cloudinary;

class CloudinaryException extends \Exception
use Exception;

class CloudinaryException extends Exception
{
}
3 changes: 2 additions & 1 deletion Classes/CloudinaryFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace Visol\Cloudinary;

use Exception;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Resource\Folder;
use TYPO3\CMS\Core\Resource\ResourceFactory;
Expand All @@ -18,7 +19,7 @@
/**
* Class CloudinaryFactory
*/
class CloudinaryFactory extends \Exception
class CloudinaryFactory extends Exception
{
/**
* @return ResourceStorage
Expand Down
Loading
Loading