Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
4e669a5
Apply patch for double prefix
davidwindell Jul 14, 2021
a39eba2
Fix missing DIRECTORY_SEPARATOR
davidwindell Jul 14, 2021
9326a9b
Merge remote-tracking branch 'upstream/master' into outeredge
davidwindell Jul 23, 2021
e0e0fd2
Add get.php support
davidwindell Dec 7, 2021
8e7d429
Improve factory definition to match core
davidwindell Dec 7, 2021
afdb58c
Add product image sync plugin
davidwindell Dec 8, 2021
a7ac6ea
Fix ltrim issue
davidwindell Dec 9, 2021
82f5e57
Add enabled/disabled check
davidwindell Dec 10, 2021
5d1f661
Skip uploading /tmp files
davidwindell Dec 10, 2021
b135583
Skip sync if storage is not enabled
davidwindell Dec 15, 2021
2f07b50
Add fallback_url for missing images
davidwindell Jan 24, 2022
e992333
Update StorageObjectManagement.php
davidwindell Jan 26, 2022
b2f04ca
Improve object exists check
davidwindell Jan 26, 2022
25a7c57
Further support for loading product images
davidwindell Mar 21, 2022
4dea96d
Fix double prefix issue
davidwindell Mar 21, 2022
0256e98
Support downloading cached product images
davidwindell Mar 22, 2022
add5e50
Remove duplicate code
davidwindell Mar 22, 2022
21bf162
Fix typo
davidwindell Mar 22, 2022
f963ee4
Change plugin to before not after
davidwindell Mar 22, 2022
71b0c1e
Category images and some KISS
davidwindell Mar 24, 2022
aef75c3
Add Category plugin
davidwindell Mar 24, 2022
53444ed
Bump dependency versions
davidwindell May 23, 2022
836662d
Remove dependency on ModuleComponents (for PHP8)
davidwindell May 23, 2022
7d1f6ee
Update composer.json
davidwindell May 23, 2022
ccae2ca
Remove references to Console
davidwindell May 23, 2022
c00b265
Add missing component file
davidwindell May 24, 2022
4eb350c
Update composer.json
davidwindell May 27, 2022
186febf
Add image fallback listener
davidwindell May 30, 2022
bccf5bb
Always run ImageCatcher when GCS is enabled
davidwindell Jun 28, 2022
daf465e
Support fallback for multiple stores
davidwindell Jun 28, 2022
fd75b45
Add multi-store fallback to all requests
davidwindell Jun 29, 2022
b6d453e
Support store code fallback in admin
davidwindell Jun 29, 2022
c273c37
Update image-catcher.phtml
bensinca Jun 29, 2022
aea60a7
Use const not var
davidwindell Jun 29, 2022
2792bfd
Fix bug when event instance has element with no `picture` parent.
bensinca Oct 12, 2022
106eb9a
Add image catcher to Magento product gallery page
davidwindell Oct 13, 2022
00d1e53
Check if file exists before trying to download
davidwindell Nov 16, 2022
c0339f1
Remove console.log
davidwindell Nov 29, 2022
960bbd5
Wait until dom loaded to fire callback
davidwindell Dec 7, 2022
a6286c5
Cache gcs (#2)
broopdias Jul 19, 2023
8c348b6
Correctly handle null responses
davidwindell Jul 19, 2023
cb3427f
Fix for getObject on null
davidwindell Jul 19, 2023
ed08f03
Change PSR version dependencies
davidwindell Apr 18, 2024
e1ac081
Update image-catcher.phtml (#3)
davidwindell May 1, 2024
25bfe81
Update cache.xml
davidwindell May 22, 2024
3ac558b
Remove TTL on GCS cache
davidwindell May 22, 2024
46357a6
Prevent JS errors when no tagName
davidwindell Jul 4, 2024
d82e238
Image fallback queue
broopdias Sep 12, 2024
42f65f5
Image fallback queue
broopdias Sep 12, 2024
c308787
Image fallback queue
broopdias Sep 12, 2024
1f946c9
Improve queue code
broopdias Sep 13, 2024
4886373
Fix data type of communication
broopdias Sep 18, 2024
cdd0c78
Add User Agent and tweak timeouts
davidwindell Sep 20, 2024
c7c8a3a
Minor performance improvement
davidwindell Sep 20, 2024
a538122
Cache earlier to avoid repeat requests
davidwindell Sep 20, 2024
910c7ba
More optimisation
davidwindell Sep 20, 2024
cc248ef
Doh, abandon consumer because we don't run them in dev
davidwindell Sep 20, 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
1 change: 0 additions & 1 deletion .gitignore

This file was deleted.

28 changes: 28 additions & 0 deletions Api/LocalizedScopeDeploymentConfigInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
/**
* LocalizedScopeDeploymentConfigInterface.php
*
* NOTICE OF LICENSE
*
* This source file is subject to the MIT license, which
* is bundled with this package in the file LICENSE.txt.
*
* It is also available on the Internet at the following URL:
* https://docs.auroraextensions.com/magento/extensions/2.x/modulecomponents/LICENSE.txt
*
* @package AuroraExtensions\ModuleComponents\Api
* @copyright Copyright (C) 2021 Aurora Extensions <support@auroraextensions.com>
* @license MIT
*/
declare(strict_types=1);

namespace AuroraExtensions\GoogleCloudStorage\Api;

interface LocalizedScopeDeploymentConfigInterface
{
/**
* @param string|null $path
* @return mixed
*/
public function get(?string $path);
}
5 changes: 5 additions & 0 deletions Api/StorageObjectManagementInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,9 @@ public function deleteObject(string $path): bool;
* @return \AuroraExtensions\GoogleCloudStorage\Api\StorageObjectManagementInterface
*/
public function deleteAllObjects(array $options): StorageObjectManagementInterface;

/**
* @return bool
*/
public function isEnabled(): bool;
}
2 changes: 0 additions & 2 deletions Api/StorageTypeMetadataInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

namespace AuroraExtensions\GoogleCloudStorage\Api;

use Google\Cloud\Storage\StorageClient;

interface StorageTypeMetadataInterface
{
/** @constant int STORAGE_MEDIA_GCS */
Expand Down
59 changes: 59 additions & 0 deletions Block/ImageCatcher.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

namespace AuroraExtensions\GoogleCloudStorage\Block;

use AuroraExtensions\GoogleCloudStorage\Model\File\Storage;
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\UrlInterface;
use Magento\Framework\View\Element\Template;
use Magento\Framework\View\Element\Template\Context;
use Magento\Store\Model\StoreManagerInterface;

class ImageCatcher extends Template
{
/**
* Store manager
*
* @var StoreManagerInterface
*/
protected $storeManager;

/**
* @param Context $context
* @param Config $mediaConfig
* @param Storage $storage
* @param array $data
*/
public function __construct(
Context $context,
StoreManagerInterface $storeManager,
Storage $storage,
array $data = []
) {
parent::__construct($context, $data);

$this->storeManager = $storeManager;
$this->storage = $storage;
}

public function getMediaUrl()
{
return $this->storeManager->getStore()->getBaseUrl(UrlInterface::URL_TYPE_MEDIA);
}

public function getBaseMediaUrl()
{
$baseUrl = parse_url($this->storeManager->getStore()->getBaseUrl(UrlInterface::URL_TYPE_WEB));
return $baseUrl['scheme'] . '://' . $baseUrl['host'] . '/' . DirectoryList::MEDIA . DIRECTORY_SEPARATOR;
}

public function isEnabled()
{
return $this->storage->checkBucketUsage();
}

public function getStoreCode()
{
return $this->storeManager->getStore()->getCode();
}
}
121 changes: 0 additions & 121 deletions Console/Command/SynchronizeCommand.php

This file was deleted.

84 changes: 84 additions & 0 deletions Exception/ExceptionFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?php
/**
* ExceptionFactory.php
*
* NOTICE OF LICENSE
*
* This source file is subject to the MIT license, which
* is bundled with this package in the file LICENSE.txt.
*
* It is also available on the Internet at the following URL:
* https://docs.auroraextensions.com/magento/extensions/2.x/modulecomponents/LICENSE.txt
*
* @package AuroraExtensions\ModuleComponents\Exception
* @copyright Copyright (C) 2021 Aurora Extensions <support@auroraextensions.com>
* @license MIT
*/
declare(strict_types=1);

namespace AuroraExtensions\GoogleCloudStorage\Exception;

use Exception;
use Throwable;
use Magento\Framework\{
ObjectManagerInterface,
Phrase
};

use function is_subclass_of;
use function __;

class ExceptionFactory
{
/** @constant string ERROR_DEFAULT_MSG */
private const ERROR_DEFAULT_MSG = 'An error occurred. Unable to process the request.';

/** @constant string ERROR_INVALID_TYPE */
private const ERROR_INVALID_TYPE = 'Invalid exception class type %1 was given.';

/** @var ObjectManagerInterface $objectManager */
private $objectManager;

/**
* @param ObjectManagerInterface $objectManager
* @return void
*/
public function __construct(ObjectManagerInterface $objectManager)
{
$this->objectManager = $objectManager;
}

/**
* @param string|null $type
* @param Phrase|null $message
* @return Throwable
* @throws Exception
*/
public function create(
string $type = Exception::class,
Phrase $message = null
) {
/** @var array $arguments */
$arguments = [];

/* Set default message, as required. */
$message = $message ?? __(static::ERROR_DEFAULT_MSG);

if (!is_subclass_of($type, Throwable::class)) {
throw new Exception(
__(
static::ERROR_INVALID_TYPE,
$type
)->__toString()
);
}

if ($type !== Exception::class) {
$arguments['phrase'] = $message;
} else {
$arguments['message'] = $message->__toString();
}

return $this->objectManager->create($type, $arguments);
}
}
Loading