Skip to content

Conversation

@bmoex
Copy link
Collaborator

@bmoex bmoex commented May 2, 2022

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:

  • Updated the Bynder SDK to the latest stable version
  • Added extension version bump to 1.0.0-dev
  • Refactored old consumer/client credentials to permanent tokens
  • Relocated the configuration exceptions to the ConfigurationUtility
  • Fixed a bug in the filelist while watching the Bender file mount
  • Refactored the old signals to replaced by TYPO3 10+ event listeners.
  • Removed all OTF references as its deprecated by Bynder

Todo after this:

  • Reimplement Dynamic Asset Transformations (formally known as OTF) for Asset Processing

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_/',
];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

/**
* @param ProcessedFile $processedFile
* @return bool
* @param \BeechIt\Bynder\Service\BynderService $bynderService
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants