Skip to content

Commit a6a4913

Browse files
author
Dukagjin Surdulli
committed
Rollback to 2.0.0
1 parent 0998e57 commit a6a4913

File tree

6 files changed

+8
-46
lines changed

6 files changed

+8
-46
lines changed

cloudinary-image-management-and-manipulation-in-the-cloud-cdn/cloudinary.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: Cloudinary
44
* Plugin URI: https://cloudinary.com/documentation/wordpress_integration
55
* 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.
6-
* Version: 2.0.1
6+
* Version: 2.0.0
77
* Author: Cloudinary Ltd., XWP
88
* Author URI: https://cloudinary.com/
99
* License: GPLv2+

cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-media.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ public function cloudinary_url( $attachment_id, $size = array(), $transformation
571571
'version' => $this->get_post_meta( $attachment_id, Sync::META_KEYS['version'], true ),
572572
'resource_type' => $resource_type,
573573
);
574-
574+
575575
// Check size and correct if string or size.
576576
if ( is_string( $size ) || ( is_array( $size ) && 3 === count( $size ) ) ) {
577577
$intermediate = image_get_intermediate_size( $attachment_id, $size );
@@ -692,11 +692,6 @@ public function cloudinary_id( $attachment_id ) {
692692
* @return string|bool
693693
*/
694694
$cloudinary_id = apply_filters( 'cloudinary_id', $cloudinary_id, $attachment_id );
695-
696-
if ( empty( $cloudinary_id ) ) {
697-
return false;
698-
}
699-
700695
// Cache ID to prevent multiple lookups.
701696
if ( false !== $cloudinary_id ) {
702697
$this->cloudinary_ids[ $attachment_id ] = $cloudinary_id;
@@ -767,11 +762,10 @@ public function image_srcset( $sources, $size_array, $image_src, $image_meta, $a
767762
if ( false === $cloudinary_id ) {
768763
return $sources; // Return WordPress default sources.
769764
}
770-
771765
// Get transformations from URL.
772766
$transformations = $this->get_transformations_from_string( $image_src );
773-
774767
// Use Cloudinary breakpoints for same ratio.
768+
775769
if ( 'on' === $this->plugin->config['settings']['global_transformations']['enable_breakpoints'] && wp_image_matches_ratio( $image_meta['width'], $image_meta['height'], $size_array[0], $size_array[1] ) ) {
776770
$meta = $this->get_post_meta( $attachment_id, Sync::META_KEYS['breakpoints'], true );
777771
if ( ! empty( $meta ) ) {
@@ -807,11 +801,11 @@ function ( $item ) use ( $crop ) {
807801
);
808802
}
809803
krsort( $sources, SORT_NUMERIC );
810-
804+
811805
return $sources;
812806
}
813807
}
814-
808+
815809
// Add the main size as the largest srcset src.
816810
$crop = $this->get_crop_from_transformation( $transformations );
817811
if ( ! empty( $crop ) ) {

cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ class Sync implements Setup, Assets {
4848
'transformation' => '_transformations',
4949
'sync_error' => '_sync_error',
5050
'cloudinary' => '_cloudinary_v2',
51-
'attempts' => '_sync_attempts',
5251
);
5352

5453
/**

cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-upgrade.php

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,6 @@ public function check_cloudinary_version( $cloudinary_id, $attachment_id ) {
5555
*/
5656
if ( ! empty( $meta['cloudinary'] ) && empty( $public_id ) ) {
5757
$cloudinary_id = $this->convert_cloudinary_version( $attachment_id );
58-
} elseif ( ! empty( $meta['cloudinary'] ) ) {
59-
// Has public ID, but still has cloudinary, check pending status.
60-
$is_pending = $this->media->get_post_meta( $attachment_id, Sync::META_KEYS['pending'], true );
61-
$attempts = (int) $this->media->get_post_meta( $attachment_id, Sync::META_KEYS['attempts'], true );
62-
if ( ( empty( $is_pending ) || $is_pending < time() - 5 * 60 ) && 10 > $attempts ) {
63-
// Timeout.
64-
$this->media->update_post_meta( $attachment_id, Sync::META_KEYS['attempts'], $attempts + 1 );
65-
66-
// return proposed ID to allow front render.
67-
return $this->convert_cloudinary_version( $attachment_id );
68-
}
69-
$cloudinary_id = $public_id;
70-
} else {
71-
$cloudinary_id = $public_id;
7258
}
7359
}
7460

@@ -119,8 +105,6 @@ function ( $val ) use ( $media ) {
119105
$public_id = strstr( $public_id, '.' . $path['extension'], true );
120106
// Save public ID.
121107
$this->media->update_post_meta( $attachment_id, Sync::META_KEYS['public_id'], $public_id );
122-
// Set download started data.
123-
$this->media->update_post_meta( $attachment_id, Sync::META_KEYS['pending'], time() );
124108

125109
// Setup a call for a background sync.
126110
$params = array(
@@ -141,7 +125,7 @@ public function setup_hooks() {
141125
add_filter( 'cloudinary_id', array( $this, 'check_cloudinary_version' ), 9, 2 ); // Priority 9, to take preference over prep_on_demand_upload.
142126

143127
// Add a redirection to the new plugin settings, from the old plugin.
144-
if ( is_admin() ) {
128+
if( is_admin() ) {
145129
add_action( 'admin_menu', function () {
146130
global $plugin_page;
147131
if ( ! empty( $plugin_page ) && false !== strpos( $plugin_page, 'cloudinary-image-management-and-manipulation-in-the-cloud-cdn' ) ) {

cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-download-sync.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
namespace Cloudinary\Sync;
99

10-
use Cloudinary\Sync;
11-
1210
/**
1311
* Class Download_Sync.
1412
*
@@ -90,15 +88,9 @@ public function rest_can_upload_files( \WP_REST_Request $request ) {
9088
*/
9189
public function handle_failed_download( $attachment_id, $error ) {
9290
// @todo: Place a handler to catch the error for logging.
91+
// Delete attachment temp.
92+
wp_delete_attachment( $attachment_id, true );
9393

94-
$is_pending = $this->plugin->components['media']->get_post_meta( $attachment_id, Sync::META_KEYS['pending'], true );
95-
if ( ! empty( $is_pending ) ) {
96-
// Dont delete if it's a downsync.
97-
$this->plugin->components['media']->update_post_meta( $attachment_id, Sync::META_KEYS['sync_error'], $error );
98-
} else {
99-
// Delete attachment temp.
100-
wp_delete_attachment( $attachment_id, true );
101-
}
10294
// Send error.
10395
wp_send_json_error( $error );
10496
}
@@ -189,10 +181,6 @@ public function rest_download_asset( \WP_REST_Request $request ) {
189181
'data' => $attachment,
190182
);
191183

192-
// Remove pending.
193-
delete_post_meta( $attachment_id, Sync::META_KEYS['pending'] );
194-
delete_post_meta( $attachment_id, Sync::META_KEYS['sync_error'] );
195-
196184
return rest_ensure_response( $response );
197185
}
198186
}

cloudinary-image-management-and-manipulation-in-the-cloud-cdn/readme.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,6 @@ You can read the plugin [documentation](https://cloudinary.com/documentation/wor
108108
9. Easily Configure Your Account
109109

110110
== Changelog ==
111-
= 2.0.1 (02 Apr 2020) =
112-
* Fix an issue with v1 migrating
113-
114111
= 2.0.0 (31 Mar 2020) =
115112
* Release of a new major version of the plugin
116113

0 commit comments

Comments
 (0)