Version Notes
v1.2.0
Release Highlights:
* Foldered migration
Download this release
Release Info
Developer | Cloudinary |
Extension | Cloudinary_Cloudinary |
Version | 2.1.0 |
Comparing to | |
See all releases |
Code changes from version 2.0.0 to 2.1.0
- app/code/community/Cloudinary/Cloudinary/Block/Adminhtml/Manage.php +15 -4
- app/code/community/Cloudinary/Cloudinary/Helper/Cron.php +23 -0
- app/code/community/Cloudinary/Cloudinary/Model/Configuration.php +2 -2
- app/code/community/Cloudinary/Cloudinary/Model/Cron.php +2 -1
- app/code/community/Cloudinary/Cloudinary/Model/Image.php +33 -4
- app/code/community/Cloudinary/Cloudinary/Model/Migration.php +43 -1
- app/code/community/Cloudinary/Cloudinary/Model/Observer.php +5 -4
- app/code/community/Cloudinary/Cloudinary/Model/Resource/Cms/Synchronisation/Collection.php +1 -1
- app/code/community/Cloudinary/Cloudinary/controllers/Adminhtml/CloudinaryController.php +49 -4
- app/code/community/Cloudinary/Cloudinary/etc/config.xml +1 -1
- app/code/community/Cloudinary/Cloudinary/sql/cloudinary_setup/upgrade-2.0.0-2.1.0.php +33 -0
- app/design/adminhtml/default/default/layout/cloudinary/cloudinary.xml +9 -0
- app/design/adminhtml/default/default/template/cloudinary/manage.phtml +38 -0
- package.xml +7 -7
app/code/community/Cloudinary/Cloudinary/Block/Adminhtml/Manage.php
CHANGED
@@ -89,12 +89,23 @@ class Cloudinary_Cloudinary_Block_Adminhtml_Manage extends Mage_Adminhtml_Block_
|
|
89 |
if ($this->_migrationTask->hasStarted()) {
|
90 |
$startLabel = 'Stop Migration';
|
91 |
$startAction = 'stopMigration';
|
92 |
-
|
93 |
-
$startLabel = 'Start Migration';
|
94 |
-
$startAction = 'startMigration';
|
95 |
}
|
96 |
|
97 |
-
return $this->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
}
|
99 |
|
100 |
public function getClearErrorsButton()
|
89 |
if ($this->_migrationTask->hasStarted()) {
|
90 |
$startLabel = 'Stop Migration';
|
91 |
$startAction = 'stopMigration';
|
92 |
+
return $this->_makeButton($startLabel, $startAction, $this->allImagesSynced());
|
|
|
|
|
93 |
}
|
94 |
|
95 |
+
return $this->getLayout()
|
96 |
+
->createBlock('adminhtml/widget_button')
|
97 |
+
->setData(array(
|
98 |
+
'id' => 'cloudinary_migration_start',
|
99 |
+
'label' => $this->helper('adminhtml')->__('Start Migration'),
|
100 |
+
'disabled' => $this->allImagesSynced(),
|
101 |
+
'onclick' => 'openCloudinaryMigrationPopup();'
|
102 |
+
))
|
103 |
+
->toHtml();
|
104 |
+
}
|
105 |
+
|
106 |
+
public function getStartMigrationUrl()
|
107 |
+
{
|
108 |
+
return $this->getUrl('*/cloudinary/startMigration');
|
109 |
}
|
110 |
|
111 |
public function getClearErrorsButton()
|
app/code/community/Cloudinary/Cloudinary/Helper/Cron.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Cloudinary_Cloudinary_Helper_Cron extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @param Cloudinary_Cloudinary_Model_Migration $migration
|
7 |
+
* @param int $cronIntervalInSeconds
|
8 |
+
* @return bool
|
9 |
+
*/
|
10 |
+
public function validate(Cloudinary_Cloudinary_Model_Migration $migration, $cronIntervalInSeconds)
|
11 |
+
{
|
12 |
+
return !($this->isInitialising($migration) && ($migration->timeElapsed() > $cronIntervalInSeconds));
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @param Cloudinary_Cloudinary_Model_Migration $migration
|
17 |
+
* @return bool
|
18 |
+
*/
|
19 |
+
public function isInitialising(Cloudinary_Cloudinary_Model_Migration $migration)
|
20 |
+
{
|
21 |
+
return $migration->hasStarted() && !$migration->hasProgress();
|
22 |
+
}
|
23 |
+
}
|
app/code/community/Cloudinary/Cloudinary/Model/Configuration.php
CHANGED
@@ -194,7 +194,7 @@ class Cloudinary_Cloudinary_Model_Configuration implements ConfigurationInterfac
|
|
194 |
if (Mage::getStoreConfigFlag(self::CONFIG_DEFAULT_FETCH_FORMAT)) {
|
195 |
return FetchFormat::FETCH_FORMAT_AUTO;
|
196 |
}
|
197 |
-
return
|
198 |
}
|
199 |
|
200 |
private function getImageQuality()
|
@@ -206,4 +206,4 @@ class Cloudinary_Cloudinary_Model_Configuration implements ConfigurationInterfac
|
|
206 |
{
|
207 |
return Mage::getStoreConfig(self::CONFIG_DEFAULT_DPR);
|
208 |
}
|
209 |
-
}
|
194 |
if (Mage::getStoreConfigFlag(self::CONFIG_DEFAULT_FETCH_FORMAT)) {
|
195 |
return FetchFormat::FETCH_FORMAT_AUTO;
|
196 |
}
|
197 |
+
return '';
|
198 |
}
|
199 |
|
200 |
private function getImageQuality()
|
206 |
{
|
207 |
return Mage::getStoreConfig(self::CONFIG_DEFAULT_DPR);
|
208 |
}
|
209 |
+
}
|
app/code/community/Cloudinary/Cloudinary/Model/Cron.php
CHANGED
@@ -13,7 +13,8 @@ class Cloudinary_Cloudinary_Model_Cron extends Mage_Core_Model_Abstract
|
|
13 |
public function migrateImages()
|
14 |
{
|
15 |
$migrationTask = Mage::getModel('cloudinary_cloudinary/migration')
|
16 |
-
->load(Cloudinary_Cloudinary_Model_Migration::CLOUDINARY_MIGRATION_ID)
|
|
|
17 |
|
18 |
$batchUploader = new BatchUploader(
|
19 |
CloudinaryImageProvider::fromConfiguration(
|
13 |
public function migrateImages()
|
14 |
{
|
15 |
$migrationTask = Mage::getModel('cloudinary_cloudinary/migration')
|
16 |
+
->load(Cloudinary_Cloudinary_Model_Migration::CLOUDINARY_MIGRATION_ID)
|
17 |
+
->recordBatchProgress();
|
18 |
|
19 |
$batchUploader = new BatchUploader(
|
20 |
CloudinaryImageProvider::fromConfiguration(
|
app/code/community/Cloudinary/Cloudinary/Model/Image.php
CHANGED
@@ -4,18 +4,20 @@ use CloudinaryExtension\CloudinaryImageProvider;
|
|
4 |
use CloudinaryExtension\Image;
|
5 |
use Cloudinary_Cloudinary_Model_Exception_BadFilePathException as BadFilePathException;
|
6 |
|
7 |
-
|
8 |
class Cloudinary_Cloudinary_Model_Image extends Mage_Core_Model_Abstract
|
9 |
{
|
|
|
|
|
|
|
10 |
public function upload(array $imageDetails)
|
11 |
{
|
12 |
$configuration = Mage::getModel('cloudinary_cloudinary/configuration');
|
13 |
-
$
|
14 |
|
15 |
$fullPath = $this->_imageFullPathFromImageDetails($imageDetails);
|
16 |
$relativePath = $configuration->isFolderedMigration() ? $configuration->getMigratedPath($fullPath) : '';
|
17 |
|
18 |
-
$
|
19 |
|
20 |
Mage::getModel('cloudinary_cloudinary/synchronisation')
|
21 |
->setValueId($imageDetails['value_id'])
|
@@ -23,11 +25,22 @@ class Cloudinary_Cloudinary_Model_Image extends Mage_Core_Model_Abstract
|
|
23 |
->tagAsSynchronized();
|
24 |
}
|
25 |
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
27 |
{
|
28 |
return $this->_getMediaBasePath() . $this->_getImageDetailFromKey($imageDetails, 'file');
|
29 |
}
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
private function _getImageDetailFromKey(array $imageDetails, $key)
|
32 |
{
|
33 |
if (!array_key_exists($key, $imageDetails)) {
|
@@ -36,8 +49,24 @@ class Cloudinary_Cloudinary_Model_Image extends Mage_Core_Model_Abstract
|
|
36 |
return $imageDetails[$key];
|
37 |
}
|
38 |
|
|
|
|
|
|
|
39 |
private function _getMediaBasePath()
|
40 |
{
|
41 |
return Mage::getSingleton('catalog/product_media_config')->getBaseMediaPath();
|
42 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
4 |
use CloudinaryExtension\Image;
|
5 |
use Cloudinary_Cloudinary_Model_Exception_BadFilePathException as BadFilePathException;
|
6 |
|
|
|
7 |
class Cloudinary_Cloudinary_Model_Image extends Mage_Core_Model_Abstract
|
8 |
{
|
9 |
+
/**
|
10 |
+
* @param array $imageDetails
|
11 |
+
*/
|
12 |
public function upload(array $imageDetails)
|
13 |
{
|
14 |
$configuration = Mage::getModel('cloudinary_cloudinary/configuration');
|
15 |
+
$imageProvider = CloudinaryImageProvider::fromConfiguration($configuration);
|
16 |
|
17 |
$fullPath = $this->_imageFullPathFromImageDetails($imageDetails);
|
18 |
$relativePath = $configuration->isFolderedMigration() ? $configuration->getMigratedPath($fullPath) : '';
|
19 |
|
20 |
+
$imageProvider->upload(Image::fromPath($fullPath, $relativePath));
|
21 |
|
22 |
Mage::getModel('cloudinary_cloudinary/synchronisation')
|
23 |
->setValueId($imageDetails['value_id'])
|
25 |
->tagAsSynchronized();
|
26 |
}
|
27 |
|
28 |
+
/**
|
29 |
+
* @param array $imageDetails
|
30 |
+
* @return string
|
31 |
+
* @throws Cloudinary_Cloudinary_Model_Exception_BadFilePathException
|
32 |
+
*/
|
33 |
+
private function _imageFullPathFromImageDetails(array $imageDetails)
|
34 |
{
|
35 |
return $this->_getMediaBasePath() . $this->_getImageDetailFromKey($imageDetails, 'file');
|
36 |
}
|
37 |
|
38 |
+
/**
|
39 |
+
* @param array $imageDetails
|
40 |
+
* @param string $key
|
41 |
+
* @return string
|
42 |
+
* @throws Cloudinary_Cloudinary_Model_Exception_BadFilePathException
|
43 |
+
*/
|
44 |
private function _getImageDetailFromKey(array $imageDetails, $key)
|
45 |
{
|
46 |
if (!array_key_exists($key, $imageDetails)) {
|
49 |
return $imageDetails[$key];
|
50 |
}
|
51 |
|
52 |
+
/**
|
53 |
+
* @return string
|
54 |
+
*/
|
55 |
private function _getMediaBasePath()
|
56 |
{
|
57 |
return Mage::getSingleton('catalog/product_media_config')->getBaseMediaPath();
|
58 |
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* @param string $imagePath
|
62 |
+
* @return string
|
63 |
+
*/
|
64 |
+
public function getUrl($imagePath)
|
65 |
+
{
|
66 |
+
$imageProvider = CloudinaryImageProvider::fromConfiguration(
|
67 |
+
Mage::getModel('cloudinary_cloudinary/configuration')
|
68 |
+
);
|
69 |
+
|
70 |
+
return (string)$imageProvider->transformImage(Cloudinary_Cloudinary_Helper_Image::newApiImage($imagePath));
|
71 |
+
}
|
72 |
}
|
app/code/community/Cloudinary/Cloudinary/Model/Migration.php
CHANGED
@@ -11,11 +11,17 @@ class Cloudinary_Cloudinary_Model_Migration extends Mage_Core_Model_Abstract imp
|
|
11 |
$this->_init('cloudinary_cloudinary/migration');
|
12 |
}
|
13 |
|
|
|
|
|
|
|
14 |
public function hasStarted()
|
15 |
{
|
16 |
return (bool) $this->getStarted();
|
17 |
}
|
18 |
|
|
|
|
|
|
|
19 |
public function hasBeenStopped()
|
20 |
{
|
21 |
$this->load($this->getId());
|
@@ -32,6 +38,42 @@ class Cloudinary_Cloudinary_Model_Migration extends Mage_Core_Model_Abstract imp
|
|
32 |
public function start()
|
33 |
{
|
34 |
$this->setStarted(1);
|
|
|
|
|
35 |
$this->save();
|
36 |
}
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
$this->_init('cloudinary_cloudinary/migration');
|
12 |
}
|
13 |
|
14 |
+
/**
|
15 |
+
* @return bool
|
16 |
+
*/
|
17 |
public function hasStarted()
|
18 |
{
|
19 |
return (bool) $this->getStarted();
|
20 |
}
|
21 |
|
22 |
+
/**
|
23 |
+
* @return bool
|
24 |
+
*/
|
25 |
public function hasBeenStopped()
|
26 |
{
|
27 |
$this->load($this->getId());
|
38 |
public function start()
|
39 |
{
|
40 |
$this->setStarted(1);
|
41 |
+
$this->setStartedAt($this->_dateNow());
|
42 |
+
$this->setBatchCount(0);
|
43 |
$this->save();
|
44 |
}
|
45 |
+
|
46 |
+
public function recordBatchProgress()
|
47 |
+
{
|
48 |
+
if ($this->hasStarted()) {
|
49 |
+
$this->setBatchCount($this->getBatchCount() + 1)->save();
|
50 |
+
}
|
51 |
+
|
52 |
+
return $this;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* @return bool
|
57 |
+
*/
|
58 |
+
public function hasProgress()
|
59 |
+
{
|
60 |
+
return $this->getBatchCount() > 0;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* @return int
|
65 |
+
*/
|
66 |
+
public function timeElapsed()
|
67 |
+
{
|
68 |
+
$calendar = Mage::getModel('core/date');
|
69 |
+
return $calendar->timestamp($this->_dateNow()) - $calendar->timestamp($this->getStartedAt());
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* @return string
|
74 |
+
*/
|
75 |
+
private function _dateNow()
|
76 |
+
{
|
77 |
+
return Mage::getModel('core/date')->date('Y/m/d H:i:s');
|
78 |
+
}
|
79 |
+
}
|
app/code/community/Cloudinary/Cloudinary/Model/Observer.php
CHANGED
@@ -45,11 +45,12 @@ class Cloudinary_Cloudinary_Model_Observer extends Mage_Core_Model_Abstract
|
|
45 |
*/
|
46 |
public function deleteImagesFromCloudinary(EventObserver $event)
|
47 |
{
|
48 |
-
$
|
49 |
-
|
50 |
-
|
51 |
foreach ($this->getImagesToDelete($event->getProduct()) as $image) {
|
52 |
-
$
|
|
|
53 |
}
|
54 |
}
|
55 |
|
45 |
*/
|
46 |
public function deleteImagesFromCloudinary(EventObserver $event)
|
47 |
{
|
48 |
+
$configuration = Mage::getModel('cloudinary_cloudinary/configuration');
|
49 |
+
$imageProvider = CloudinaryImageProvider::fromConfiguration($configuration);
|
50 |
+
|
51 |
foreach ($this->getImagesToDelete($event->getProduct()) as $image) {
|
52 |
+
$migratedPath = $configuration->isFolderedMigration() ? $configuration->getMigratedPath($image['file']) : '';
|
53 |
+
$imageProvider->delete(Image::fromPath($image['file'], ltrim($migratedPath, '/')));
|
54 |
}
|
55 |
}
|
56 |
|
app/code/community/Cloudinary/Cloudinary/Model/Resource/Cms/Synchronisation/Collection.php
CHANGED
@@ -17,7 +17,7 @@ class Cloudinary_Cloudinary_Model_Resource_Cms_Synchronisation_Collection
|
|
17 |
{
|
18 |
$categoryImages = Mage::getBaseDir('media') . DS . 'catalog' . DS . 'category';
|
19 |
$this->addTargetDir($categoryImages);
|
20 |
-
$this->addTargetDir(Mage::
|
21 |
$this->setItemObjectClass('cloudinary_cloudinary/cms_synchronisation');
|
22 |
$this->setFilesFilter(
|
23 |
sprintf('#^[a-z0-9\.\-\_]+\.(?:%s)$#i', implode('|', $this->allowedImgExtensions))
|
17 |
{
|
18 |
$categoryImages = Mage::getBaseDir('media') . DS . 'catalog' . DS . 'category';
|
19 |
$this->addTargetDir($categoryImages);
|
20 |
+
$this->addTargetDir(Mage::getBaseDir('media').DS.Mage_Cms_Model_Wysiwyg_Config::IMAGE_DIRECTORY);
|
21 |
$this->setItemObjectClass('cloudinary_cloudinary/cms_synchronisation');
|
22 |
$this->setFilesFilter(
|
23 |
sprintf('#^[a-z0-9\.\-\_]+\.(?:%s)$#i', implode('|', $this->allowedImgExtensions))
|
app/code/community/Cloudinary/Cloudinary/controllers/Adminhtml/CloudinaryController.php
CHANGED
@@ -2,7 +2,10 @@
|
|
2 |
|
3 |
class Cloudinary_Cloudinary_Adminhtml_CloudinaryController extends Mage_Adminhtml_Controller_Action
|
4 |
{
|
|
|
|
|
5 |
private $_migrationTask;
|
|
|
6 |
/**
|
7 |
* @var Cloudinary_Cloudinary_Helper_Configuration
|
8 |
*/
|
@@ -18,19 +21,25 @@ class Cloudinary_Cloudinary_Adminhtml_CloudinaryController extends Mage_Adminhtm
|
|
18 |
|
19 |
public function indexAction()
|
20 |
{
|
|
|
|
|
21 |
$layout = $this->loadLayout();
|
22 |
|
23 |
if (!$this->_cloudinaryConfig->validateCredentials()) {
|
24 |
-
$
|
25 |
-
$this->_getSession()->addError(
|
26 |
-
"Please enter your Cloudinary Credentials $link to Activate Cloudinary"
|
27 |
-
);
|
28 |
}
|
29 |
|
30 |
if ($this->_migrationTask->hasStarted()) {
|
31 |
$layout->_addContent($this->_buildMetaRefreshBlock());
|
32 |
}
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
$this->renderLayout();
|
35 |
}
|
36 |
|
@@ -81,6 +90,19 @@ class Cloudinary_Cloudinary_Adminhtml_CloudinaryController extends Mage_Adminhtm
|
|
81 |
$this->_redirectToManageCloudinary();
|
82 |
}
|
83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
private function _redirectToManageCloudinary()
|
85 |
{
|
86 |
return $this->_redirect('*/cloudinary');
|
@@ -91,4 +113,27 @@ class Cloudinary_Cloudinary_Adminhtml_CloudinaryController extends Mage_Adminhtm
|
|
91 |
return $this->getLayout()->createBlock('core/text')->setText('<meta http-equiv="refresh" content="5">');
|
92 |
}
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
}
|
2 |
|
3 |
class Cloudinary_Cloudinary_Adminhtml_CloudinaryController extends Mage_Adminhtml_Controller_Action
|
4 |
{
|
5 |
+
const CRON_INTERVAL = 300;
|
6 |
+
|
7 |
private $_migrationTask;
|
8 |
+
|
9 |
/**
|
10 |
* @var Cloudinary_Cloudinary_Helper_Configuration
|
11 |
*/
|
21 |
|
22 |
public function indexAction()
|
23 |
{
|
24 |
+
$this->_displayMigrationMessages();
|
25 |
+
|
26 |
$layout = $this->loadLayout();
|
27 |
|
28 |
if (!$this->_cloudinaryConfig->validateCredentials()) {
|
29 |
+
$this->_displayValidationFailureMessage();
|
|
|
|
|
|
|
30 |
}
|
31 |
|
32 |
if ($this->_migrationTask->hasStarted()) {
|
33 |
$layout->_addContent($this->_buildMetaRefreshBlock());
|
34 |
}
|
35 |
|
36 |
+
$cronMigrationValid = Mage::helper('cloudinary_cloudinary/cron')
|
37 |
+
->validate($this->_migrationTask, self::CRON_INTERVAL);
|
38 |
+
|
39 |
+
if (!$cronMigrationValid) {
|
40 |
+
$this->_displayCronFailureMessage();
|
41 |
+
}
|
42 |
+
|
43 |
$this->renderLayout();
|
44 |
}
|
45 |
|
90 |
$this->_redirectToManageCloudinary();
|
91 |
}
|
92 |
|
93 |
+
private function _displayMigrationMessages()
|
94 |
+
{
|
95 |
+
if ($this->_migrationTask->hasStarted()) {
|
96 |
+
$cron = Mage::helper('cloudinary_cloudinary/cron');
|
97 |
+
|
98 |
+
if (!$cron->validate($this->_migrationTask, self::CRON_INTERVAL)) {
|
99 |
+
$this->_displayCronFailureMessage();
|
100 |
+
} else if ($cron->isInitialising($this->_migrationTask)) {
|
101 |
+
$this->_displayCronInitialisingMessage();
|
102 |
+
}
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
private function _redirectToManageCloudinary()
|
107 |
{
|
108 |
return $this->_redirect('*/cloudinary');
|
113 |
return $this->getLayout()->createBlock('core/text')->setText('<meta http-equiv="refresh" content="5">');
|
114 |
}
|
115 |
|
116 |
+
private function _displayCronInitialisingMessage()
|
117 |
+
{
|
118 |
+
$this->_getSession()->addNotice('Initializing migration, please wait.');
|
119 |
+
}
|
120 |
+
|
121 |
+
private function _displayCronFailureMessage()
|
122 |
+
{
|
123 |
+
$this->_getSession()->addError(
|
124 |
+
sprintf(
|
125 |
+
'%s You can find details how to enable cron <a href="%s" target="_blank">here</a>',
|
126 |
+
'Error: cron is not running, so no migration will occur.',
|
127 |
+
'https://support.cloudinary.com/hc/en-us/articles/203188781-Why-is-the-migration-process-stuck-on-zero-'
|
128 |
+
)
|
129 |
+
);
|
130 |
+
}
|
131 |
+
|
132 |
+
private function _displayValidationFailureMessage()
|
133 |
+
{
|
134 |
+
$link = '<a href="/admin/system_config/edit/section/cloudinary/">here</a>';
|
135 |
+
$this->_getSession()->addError(
|
136 |
+
"Please enter your Cloudinary Credentials $link to Activate Cloudinary"
|
137 |
+
);
|
138 |
+
}
|
139 |
}
|
app/code/community/Cloudinary/Cloudinary/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Cloudinary_Cloudinary>
|
5 |
-
<version>2.
|
6 |
</Cloudinary_Cloudinary>
|
7 |
</modules>
|
8 |
<global>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Cloudinary_Cloudinary>
|
5 |
+
<version>2.1.0</version>
|
6 |
</Cloudinary_Cloudinary>
|
7 |
</modules>
|
8 |
<global>
|
app/code/community/Cloudinary/Cloudinary/sql/cloudinary_setup/upgrade-2.0.0-2.1.0.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
4 |
+
$installer = $this;
|
5 |
+
|
6 |
+
$installer->startSetup();
|
7 |
+
|
8 |
+
$conn = $installer->getConnection();
|
9 |
+
$table = $installer->getTable('cloudinary_cloudinary/migration');
|
10 |
+
|
11 |
+
$conn->addColumn(
|
12 |
+
$table,
|
13 |
+
'started_at',
|
14 |
+
[
|
15 |
+
'type' => Varien_Db_Ddl_Table::TYPE_DATETIME,
|
16 |
+
'comment' => 'The time the migration started',
|
17 |
+
'nullable' => true,
|
18 |
+
'default' => '0000-00-00 00:00:00'
|
19 |
+
]
|
20 |
+
);
|
21 |
+
|
22 |
+
$conn->addColumn(
|
23 |
+
$table,
|
24 |
+
'batch_count',
|
25 |
+
[
|
26 |
+
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
27 |
+
'comment' => 'Batches run for current migration',
|
28 |
+
'nullable' => false,
|
29 |
+
'default' => 0
|
30 |
+
]
|
31 |
+
);
|
32 |
+
|
33 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/cloudinary/cloudinary.xml
CHANGED
@@ -4,5 +4,14 @@
|
|
4 |
<reference name="content">
|
5 |
<block type="cloudinary_cloudinary/adminhtml_manage" name="cloudinary_manage" template="cloudinary/manage.phtml"></block>
|
6 |
</reference>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
</adminhtml_cloudinary_index>
|
8 |
</layout>
|
4 |
<reference name="content">
|
5 |
<block type="cloudinary_cloudinary/adminhtml_manage" name="cloudinary_manage" template="cloudinary/manage.phtml"></block>
|
6 |
</reference>
|
7 |
+
<reference name="head">
|
8 |
+
<action method="addItem">
|
9 |
+
<type>js_css</type>
|
10 |
+
<name>prototype/windows/themes/default.css</name>
|
11 |
+
</action>
|
12 |
+
<action method="addCss">
|
13 |
+
<name>lib/prototype/windows/themes/magento.css</name>
|
14 |
+
</action>
|
15 |
+
</reference>
|
16 |
</adminhtml_cloudinary_index>
|
17 |
</layout>
|
app/design/adminhtml/default/default/template/cloudinary/manage.phtml
CHANGED
@@ -1,3 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<div class="content-header">
|
2 |
<table cellspacing="0"><tbody>
|
3 |
<tr>
|
1 |
+
<script type="text/javascript">
|
2 |
+
|
3 |
+
function openCloudinaryMigrationPopup() {
|
4 |
+
|
5 |
+
if ($('browser_window') && typeof(Windows) != 'undefined') {
|
6 |
+
Windows.focus('browser_window');
|
7 |
+
return;
|
8 |
+
}
|
9 |
+
|
10 |
+
var dialogWindow = Dialog.info(null, {
|
11 |
+
closable:true,
|
12 |
+
resizable:false,
|
13 |
+
draggable:true,
|
14 |
+
className:'magento',
|
15 |
+
windowClassName:'popup-window',
|
16 |
+
title:'Start image migration to Cloudinary',
|
17 |
+
width:400,
|
18 |
+
height:100,
|
19 |
+
zIndex:1000,
|
20 |
+
recenterAuto:true,
|
21 |
+
hideEffect:Element.hide,
|
22 |
+
showEffect:Element.show,
|
23 |
+
id:'browser_window'
|
24 |
+
});
|
25 |
+
|
26 |
+
dialogWindow.setHTMLContent('<p style="margin-top: 10px;">A cron job has to be configured for a successful migration. Are you sure you have configured a cron job?</p><div class="form-buttons" style="position: absolute; bottom: 10px; right: 10px;"><button title="No" type="button" class="scalable" onclick="closeCloudinaryMigrationPopup();" style="margin-right: 10px;"><span><span><span>No</span></span></span></button><button title="Yes - start migration" type="button" class="scalable" onclick="startCloudinaryMigration();"><span><span><span>Yes - start migration</span></span></span></button></div>');
|
27 |
+
}
|
28 |
+
|
29 |
+
function closeCloudinaryMigrationPopup() {
|
30 |
+
Windows.close('browser_window');
|
31 |
+
}
|
32 |
+
|
33 |
+
function startCloudinaryMigration() {
|
34 |
+
setLocation("<?php echo $this->getStartMigrationUrl(); ?>");
|
35 |
+
}
|
36 |
+
|
37 |
+
</script>
|
38 |
+
|
39 |
<div class="content-header">
|
40 |
<table cellspacing="0"><tbody>
|
41 |
<tr>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Cloudinary_Cloudinary</name>
|
4 |
-
<version>2.
|
5 |
<stability>stable</stability>
|
6 |
<license>MIT License (MITL)</license>
|
7 |
<channel>community</channel>
|
@@ -10,13 +10,13 @@
|
|
10 |
<description>Cloudinary supercharges your images! Upload images to the cloud, deliver optimized via a fast CDN, perform smart resizing and apply effects.</description>
|
11 |
<notes>v1.2.0
|
12 |

|
13 |
-
Release Highlights:
|
14 |

|
15 |
-
* Foldered migration</notes>
|
16 |
<authors><author><name>Cloudinary</name><user>cloudinary</user><email>accounts+magento@cloudinary.com</email></author></authors>
|
17 |
-
<date>2017-04-
|
18 |
-
<time>
|
19 |
-
<contents><target name="magecommunity"><dir name="Cloudinary"><dir name="Cloudinary"><dir name="Block"><dir name="Adminhtml"><dir name="Manage"><file name="Grid.php" hash="b6a05f6ba08c5ba0d08846a7b0a06776"/></dir><file name="Manage.php" hash="
|
20 |
<compatible/>
|
21 |
-
<dependencies><required><php><min>5.4.0</min><max>7.
|
22 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Cloudinary_Cloudinary</name>
|
4 |
+
<version>2.1.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>MIT License (MITL)</license>
|
7 |
<channel>community</channel>
|
10 |
<description>Cloudinary supercharges your images! Upload images to the cloud, deliver optimized via a fast CDN, perform smart resizing and apply effects.</description>
|
11 |
<notes>v1.2.0
|
12 |

|
13 |
+
Release Highlights:
|
14 |

|
15 |
+
* Foldered migration</notes>
|
16 |
<authors><author><name>Cloudinary</name><user>cloudinary</user><email>accounts+magento@cloudinary.com</email></author></authors>
|
17 |
+
<date>2017-04-07</date>
|
18 |
+
<time>10:22:05</time>
|
19 |
+
<contents><target name="magecommunity"><dir name="Cloudinary"><dir name="Cloudinary"><dir name="Block"><dir name="Adminhtml"><dir name="Manage"><file name="Grid.php" hash="b6a05f6ba08c5ba0d08846a7b0a06776"/></dir><file name="Manage.php" hash="9cd8997737c1191cff57dc8530daa26c"/><dir name="Page"><file name="Menu.php" hash="891d6a4c075ba03c9a20658076c86ad0"/></dir><dir name="System"><dir name="Config"><file name="Signup.php" hash="ed6accbe7a4ce16bb0679eaf0c2dbb22"/></dir></dir></dir></dir><dir name="Helper"><file name="Autoloader.php" hash="393b3e2fc25e63ca28157152d2542b18"/><file name="Console.php" hash="7c909e3226c51c05d6da1f6ff9cbbfc9"/><file name="Cron.php" hash="805557370a2006b15444b7a62bbbc65a"/><file name="Data.php" hash="42c9d44f1bbe530e30cf5379846dea65"/><file name="Image.php" hash="af1c1d734793d6b08feaa7e1abd591d0"/></dir><dir name="Model"><dir name="Catalog"><dir name="Product"><file name="Image.php" hash="b5d14bcb836158890152c9fed191f8bc"/><dir name="Media"><file name="Config.php" hash="c2dbac447d4a22c920c19b0d4eb2672e"/></dir><file name="Media.php" hash="05726616a07d7d08933e9654e6107283"/></dir></dir><dir name="Cms"><dir name="Adminhtml"><dir name="Template"><file name="Filter.php" hash="792893f6b4e884a8e42847d457a6068c"/></dir></dir><file name="Synchronisation.php" hash="8d830a18f169a0ff5f7d865e3afcb710"/><dir name="Template"><file name="Filter.php" hash="c3fe64f98128043de13e92156a26ab02"/></dir><file name="Uploader.php" hash="021195c01a7e6fd9e72c5a30ebd11554"/><dir name="Wysiwyg"><dir name="Images"><file name="Storage.php" hash="0d23e557d6db06308886d9307fe92665"/></dir></dir></dir><file name="CollectionCounter.php" hash="e69953aee5d966a3ec13d33533f017e0"/><file name="Configuration.php" hash="fa6fb95c166048005143bc52d85933f9"/><file name="Cron.php" hash="423c66992195d830973bb9c2d10e4551"/><dir name="Exception"><file name="BadFilePathException.php" hash="68135da8dfe2f0589a531b4bd36e3330"/></dir><file name="Image.php" hash="84d42417651e2feefdb1b0c048f61ca4"/><file name="Logger.php" hash="ab5e45b0769c9dbee33025a202a87fee"/><file name="MagentoFolderTranslator.php" hash="37219fc1804d6ad8d1686af8509e1963"/><file name="Migration.php" hash="30f671877307d93904fd823d01d35c1d"/><file name="MigrationError.php" hash="1c91373b020d639ae3fb8acfa099eea0"/><file name="Observer.php" hash="78fdf1b2d98864f2aa0538b5eb203275"/><dir name="Resource"><dir name="Cms"><dir name="Synchronisation"><file name="Collection.php" hash="b8cbe30bf2a3b03baea4d62bd7127323"/></dir></dir><dir name="Media"><file name="Collection.php" hash="f54d914a6f79c7b3ab51f822bf64de39"/></dir><file name="Migration.php" hash="69a545d0627016afc03ea097641aa749"/><dir name="MigrationError"><file name="Collection.php" hash="3c5ef530b18b4cd7763a610b84cd3d41"/></dir><file name="MigrationError.php" hash="e6de24a80cb0daed6ead44c699dce535"/><dir name="Synchronisation"><file name="Collection.php" hash="1868b1d1a33a7343162c56f86235623b"/></dir><file name="Synchronisation.php" hash="5b721d854d8f89bc3310e46081be7153"/></dir><file name="Synchronisation.php" hash="05414c5959efc7656b8e101617005d9a"/><file name="SynchronisedMediaUnifier.php" hash="dd47a04cc2eaa2a81b6dce27f22301f2"/><file name="SynchronizationChecker.php" hash="fd2a1fd763b7f5b895a392b48e209f00"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Dropdown"><file name="Dpr.php" hash="2b9bfd5f836dbdb5d7224d298264f540"/><file name="Gravity.php" hash="c241498e2093640892170673cd7550cd"/><file name="Quality.php" hash="e0c5902f5c36c96fb8a8ba7cc741ce1f"/></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CloudinaryController.php" hash="cb874253fcee0f772eae77db9935dcf1"/></dir></dir><dir name="data"><dir name="cloudinary_setup"><file name="data-upgrade-0.1.0-0.1.1.php" hash="4c6ce6cd9ab0d94654afb4a398fb3d6c"/><file name="data-upgrade-1.1.2-1.1.3.php" hash="fe2026874346017303a8f41a9d0d6c0d"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="46e365e2f4b1d543aad248dfcfb99c50"/><file name="config.xml" hash="24a67a12b2a796abfdd2a990b1a54c54"/><file name="system.xml" hash="a4ae810df3e6587625d395985b79ee83"/></dir><dir name="sql"><dir name="cloudinary_setup"><file name="install-0.1.0.php" hash="55d93b3dab573c2a932edbb5a2fa4865"/><file name="upgrade-0.1.0-0.1.1.php" hash="6c8d430fbf7b9714586b67db3d455008"/><file name="upgrade-1.1.3-1.1.4.php" hash="d6314fc1843b2061d0d04ae60c4d8091"/><file name="upgrade-1.1.4-1.1.5.php" hash="5b035e4b600cbbc743e9ff6a7b505230"/><file name="upgrade-1.1.5-1.1.6.php" hash="323c5e50635018be420cf524072f6a92"/><file name="upgrade-2.0.0-2.1.0.php" hash="9d053bed5099e064eed808a090755b03"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Cloudinary_Cloudinary.xml" hash="9337962a4ccf8a43164d5d71dfd2d756"/></dir></target><target name="magelib"><dir name="CloudinaryExtension"><file name="Cloud.php" hash="59b0debf9ae297e4e824e39ba819b1d1"/><file name="CloudinaryImageManager.php" hash="a5037ca0a15c864ffb5809e5be0fa507"/><file name="CloudinaryImageProvider.php" hash="53fc1d86819319c451198a753c0dfd38"/><file name="ConfigurationBuilder.php" hash="c8832b207d9228ef14b3c74100ee74c4"/><file name="ConfigurationInterface.php" hash="4129b1e282fb0000b78946f07baa740c"/><file name="CredentialValidator.php" hash="965b0bd024f668aabcc9f30ef2e3c240"/><file name="Credentials.php" hash="71054eb4af7b6496608ffd14912bdbe4"/><dir name="Exception"><file name="InvalidCredentials.php" hash="abecc635a25f6c9896c605ad16e1f7d7"/><file name="MigrationError.php" hash="1f37d28be668edb805e46fd207c72fd9"/></dir><file name="FolderTranslator.php" hash="19a335acf751d67bd7efe46829602490"/><dir name="Image"><file name="ImageFactory.php" hash="0a2e066331584d33a9c4ec03787fd6e5"/><file name="LocalImage.php" hash="ab9b814b1a006baf05b9904af3ebce74"/><file name="Synchronizable.php" hash="b842f71ed25718838233207b7748f1bf"/><file name="SynchronizationChecker.php" hash="f2c45545766a81fede68138cf84dd1af"/><dir name="Transformation"><file name="Crop.php" hash="84e57281780a57326c938ac776641e8b"/><file name="Dimensions.php" hash="86a36c564aa41a08da2cf383d611c060"/><file name="Dpr.php" hash="f78cd1bfabaf3088ca8d4af972bfd453"/><file name="FetchFormat.php" hash="b81c62dd756dee4ad085ee6f0a83356a"/><file name="Format.php" hash="ab8ea9b6a8c813a24f23b079ea6236da"/><file name="Gravity.php" hash="c1c2adf4dbbeaa6b06d67d2014300559"/><file name="Quality.php" hash="23a857f3910aecf6e45645194ff7f54e"/></dir><file name="Transformation.php" hash="a6281e9e7535ddc01729585ffc8bb036"/></dir><file name="Image.php" hash="896d409ebebf8af12dfe0225b21f4c83"/><file name="ImageInterface.php" hash="4a7c7e39d7fda0b0fa99affcac78ec8c"/><file name="ImageProvider.php" hash="a615c472cdc8a6ad7d887133db35c262"/><dir name="Migration"><file name="BatchUploader.php" hash="6aae7adc0f4f99dab7836976d0a06d75"/><file name="Logger.php" hash="648b47bb065de0c81b386ac300b4f9a3"/><file name="Queue.php" hash="add92864192b0950c29c91ffe5e5a3ee"/><file name="SynchronizedMediaRepository.php" hash="9e7e1dae66b40ce991b0e86ecdff4c24"/><file name="Task.php" hash="ac11d06c531d48b38cf88f6e8f2bdc19"/></dir><dir name="Security"><file name="ApiSignature.php" hash="049c7db2684ec2a6cf5bb4efcd064951"/><file name="CloudinaryEnvironmentVariable.php" hash="418af61bdbcfef955df29ac47c54415b"/><file name="ConsoleUrl.php" hash="4e748cfe0f5a0aeab2307c623179c6f9"/><file name="EnvironmentVariable.php" hash="297fa60b819ffc028b9a32dae6eef63d"/><file name="Key.php" hash="ac3a50b59f2a7db1edcf30386759c7ec"/><file name="Secret.php" hash="b1010679976575d57752dbb07f1b94ed"/><file name="SignedConsoleUrl.php" hash="791e1f1080be23423c2ad87f431f6221"/></dir><file name="SynchroniseAssetsRepositoryInterface.php" hash="e0d8e270ae2c74214e82e53e04e3dc0f"/><file name="UploadConfig.php" hash="a68f1ea7b84574ec36a8d2fac9bd6054"/><file name="UploadResponseValidator.php" hash="9fc81798b1c1319b04c71079d8de2bd5"/><file name="UrlGenerator.php" hash="4f4f40a76cbea2efa239084bdf0f8a65"/><file name="ValidateRemoteUrlRequest.php" hash="c2e2eb712e5293ad508a23610dfbbd6d"/></dir><dir name="Cloudinary"><file name="Api.php" hash="d71322346c3625db7c3563cdad191e8c"/><file name="AuthToken.php" hash="bec8b856baf85d89a249c932c3eba39f"/><file name="Cloudinary.php" hash="f2ec7b7bc8fc7c978f7773c3d4ccc5dd"/><file name="CloudinaryField.php" hash="411714580d21b58115ab07737367173a"/><file name="Helpers.php" hash="4db8371fc84d34be49c8ea04eee7d6eb"/><file name="PreloadedFile.php" hash="73cc9e276f96553814f05eae592d11ee"/><file name="Uploader.php" hash="eae92a330d19654028a8d16410616421"/><file name="cacert.pem" hash="c4290b9deb70d0bef2f88b67fc68c8ec"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="cloudinary"><file name="cloudinary.xml" hash="e5a2def3fccdb6a365364dcf23964d08"/></dir></dir><dir name="template"><dir name="cloudinary"><file name="manage.phtml" hash="7630d346f45d7118748b647be3501fa3"/><dir name="system"><dir name="config"><file name="signup.phtml" hash="2a0e06990eb542f22531ac2ebb5996f5"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
|
20 |
<compatible/>
|
21 |
+
<dependencies><required><php><min>5.4.0</min><max>7.1.0</max></php></required></dependencies>
|
22 |
</package>
|