Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ coverage/html/
.vscode
cloudinary-image-management-and-manipulation-in-the-cloud-cdn
cloudinary-image-management-and-manipulation-in-the-cloud-cdn.zip
cloudinary-wordpress-v2.zip
2 changes: 1 addition & 1 deletion cloudinary.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Cloudinary
* Plugin URI: https://cloudinary.com/documentation/wordpress_integration
* Description: With the Cloudinary plugin, you can upload and manage your media assets in the cloud, then deliver them to your users through a fast content delivery network, improving your website’s loading speed and overall user experience. Apply multiple transformations and take advantage of a full digital asset management solution without leaving WordPress.
* Version: 2.7.1
* Version: 2.7.2-rc-2
* Author: Cloudinary Ltd., XWP
* Author URI: https://cloudinary.com/
* License: GPLv2+
Expand Down
13 changes: 7 additions & 6 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ module.exports = function ( grunt ) {
compress: {
release: {
options: {
archive:
'cloudinary-image-management-and-manipulation-in-the-cloud-cdn.zip',
archive: 'cloudinary-wordpress-v2.zip',
},
cwd: 'build',
dest:
Expand All @@ -71,16 +70,18 @@ module.exports = function ( grunt ) {
},
assets: {
// Deploy only screenshots and icons.
...options,
deploy_trunk: false,
deploy_tag: false,
options: {
...options,
deploy_trunk: false,
deploy_tag: false,
},
},
},
} );

grunt.registerTask( 'package', [ 'clean', 'copy', 'replace', 'compress' ] );

grunt.registerTask( 'deploy', [ 'package', 'wp_deploy' ] );
grunt.registerTask( 'deploy', [ 'package', 'wp_deploy:default' ] );

grunt.registerTask( 'deploy-assets', [ 'wp_deploy:assets' ] );
};
2 changes: 1 addition & 1 deletion js/cloudinary.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/gallery-block.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-components/build-style/style.css', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '54ddd5468cd6b1f2cef0d5b4ca5d19eb');
<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-components/build-style/style.css', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '95635dcdce3468c638dab46e572af7a3');
2 changes: 1 addition & 1 deletion js/gallery-block.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/gallery.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'react-dom', 'wp-block-editor', 'wp-components', 'wp-components/build-style/style.css', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '4df595e09f7d7da9fac1e3e07b2944d4');
<?php return array('dependencies' => array('react', 'react-dom', 'wp-block-editor', 'wp-components', 'wp-components/build-style/style.css', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '29099104bb87442e73de687aa973be61');
2 changes: 1 addition & 1 deletion js/gallery.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion php/class-media.php
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,7 @@ private function create_attachment( $asset, $public_id ) {

$sync_key = $asset['sync_key'];
// Capture public_id. Use core update_post_meta since this attachment data doesnt exist yet.
$this->update_post_meta( $attachment_id, Sync::META_KEYS['public_id'], $public_id );
update_post_meta( $attachment_id, Sync::META_KEYS['public_id'], $public_id );
// Capture version number.
$this->update_post_meta( $attachment_id, Sync::META_KEYS['version'], $asset['version'] );
if ( ! empty( $asset['transformations'] ) ) {
Expand Down
8 changes: 8 additions & 0 deletions php/class-sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,15 @@ public function delete_cloudinary_meta( $attachment_id ) {
$queued = get_post_meta( $attachment_id, self::META_KEYS['queued'] );
delete_post_meta( $attachment_id, self::META_KEYS['pending'] );
delete_post_meta( $attachment_id, self::META_KEYS['queued'] );
delete_post_meta( $attachment_id, self::META_KEYS['suffix'] );
delete_post_meta( $attachment_id, self::META_KEYS['public_id'] );
delete_post_meta( $attachment_id, $queued );

// Signatures cleanup.
$signatures = $this->get_signature( $attachment_id );
foreach ( $signatures as $signature ) {
delete_post_meta( $attachment_id, "_{$signature}" );
}
}

/**
Expand Down
18 changes: 12 additions & 6 deletions php/sync/class-upload-sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,20 @@ public function handle_bulk_actions( $location, $action, $post_ids ) {
switch ( $action ) {
case 'cloudinary-push':
foreach ( $post_ids as $post_id ) {
if ( ! $this->media->is_local_media( $post_id ) ) {
// Clean up for previous attempts to sync.
$this->sync->delete_cloudinary_meta( $post_id );
if ( ! $this->sync->is_syncable( $post_id ) ) {
continue;
}
if ( ! $this->sync->is_syncable( $post_id ) ) {

// It's required to perform a new sync that Cloudinary and WordPress storage is set.
if (
'dual_full' !== $this->plugin->settings->find_setting( 'offload' )->get_value() &&
$this->plugin->components['sync']->is_synced( $post_id )
) {
continue;
}

// Clean up for previous syncs and start over.
$this->sync->delete_cloudinary_meta( $post_id );
$this->sync->set_signature_item( $post_id, 'file', '' );
$this->media->delete_post_meta( $post_id, Sync::META_KEYS['public_id'] );
$this->sync->add_to_sync( $post_id );
Expand Down Expand Up @@ -271,7 +277,7 @@ function ( $is_synced, $post_id ) use ( $attachment_id ) {
// Set folder Synced.
$this->media->update_post_meta( $attachment_id, Sync::META_KEYS['folder_sync'], $this->media->is_folder_synced( $attachment_id ) );
// Set public_id.
$this->media->update_post_meta( $attachment_id, Sync::META_KEYS['public_id'], $public_id );
update_post_meta( $attachment_id, Sync::META_KEYS['public_id'], $public_id );
// Set version.
$this->media->update_post_meta( $attachment_id, Sync::META_KEYS['version'], $result['version'] );
// Set the delivery type.
Expand Down Expand Up @@ -307,7 +313,7 @@ public function context_update( $attachment_id ) {

if ( ! is_wp_error( $result ) ) {
$this->sync->set_signature_item( $attachment_id, $type );
$this->media->update_post_meta( $attachment_id, Sync::META_KEYS['public_id'], $options['public_id'] );
update_post_meta( $attachment_id, Sync::META_KEYS['public_id'], $options['public_id'] );
}

return $result;
Expand Down