[!!!][FEATURE] Use the latest Bynder SDK#14
Open
bmoex wants to merge 5 commits intobeechit:masterfrom
Open
Conversation
Relies on permanent token now instead of API tokens
Is required to be compatible with upcoming TYPO3 releases
tkasper
suggested changes
May 17, 2022
Comment on lines
+50
to
+65
| $field_values = [ | ||
| 'pid' => 0, | ||
| 'tstamp' => $this->executionTime, | ||
| 'crdate' => $this->executionTime, | ||
| 'name' => 'Bynder', | ||
| 'description' => 'Automatically created during the installation of EXT:bynder', | ||
| 'driver' => BynderDriver::KEY, | ||
| 'configuration' => '', | ||
| 'is_online' => 1, | ||
| 'is_browsable' => 1, | ||
| 'is_public' => 1, | ||
| 'is_writable' => 0, | ||
| 'is_default' => 0, | ||
| // We use the processed file folder of the default storage as fallback | ||
| 'processingfolder' => '1:/_processed_/', | ||
| ]; |
There was a problem hiding this comment.
You can pass this directory to the insert without instantiating a variable.
Comment on lines
+72
to
+79
| $field_values = [ | ||
| 'pid' => 0, | ||
| 'tstamp' => $this->executionTime, | ||
| 'title' => 'Bynder', | ||
| 'description' => 'Automatically created during the installation of EXT:bynder', | ||
| 'path' => '', | ||
| 'base' => $storageUid, | ||
| ]; |
| /** | ||
| * @param ProcessedFile $processedFile | ||
| * @return bool | ||
| * @param \BeechIt\Bynder\Service\BynderService $bynderService |
There was a problem hiding this comment.
Suggested change
| * @param \BeechIt\Bynder\Service\BynderService $bynderService | |
| * @param BynderService $bynderService |
Shouldn't it be sufficient as you have the use statement above?
Comment on lines
+21
to
+25
| if ($resourceObject->getProperty('bynder_url')) { | ||
| $publicUrl = $resourceObject->getProperty('bynder_url'); | ||
| } else { | ||
| $publicUrl = ConfigurationUtility::getUnavailableImage($relativeToCurrentScript); | ||
| } |
There was a problem hiding this comment.
What about this?
Suggested change
| if ($resourceObject->getProperty('bynder_url')) { | |
| $publicUrl = $resourceObject->getProperty('bynder_url'); | |
| } else { | |
| $publicUrl = ConfigurationUtility::getUnavailableImage($relativeToCurrentScript); | |
| } | |
| $publicUrl = $resourceObject->getProperty('bynder_url') ?: ConfigurationUtility::getUnavailableImage($relativeToCurrentScript); |
| try { | ||
| $downloadLocation = $this->getAssetBankManager()->getMediaDownloadLocation($identifier)->wait(); | ||
| readfile($downloadLocation['s3_file'], 0); | ||
| readfile($downloadLocation['s3_file'], false); |
There was a problem hiding this comment.
You can speed up everything if you add the global namespace to the native php functions.
Suggested change
| readfile($downloadLocation['s3_file'], false); | |
| \readfile($downloadLocation['s3_file'], false); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NOTE: This changes the authentication from user specific tokens to permanent tokens which can be created in http://yourbynder.domain.com/pysettings/permanent-tokens/
As the SDK finds the old solution obsolete, they want you to use this or the OAuth apps credentials.
Check: https://github.com/Bynder/bynder-php-sdk/blob/master/sample/sample.php
In this PR:
Todo after this: