From cba76a40125835c29645042c2f87f925f5336c68 Mon Sep 17 00:00:00 2001 From: David Cramer Date: Wed, 25 Mar 2020 13:04:33 +0200 Subject: [PATCH] add test package plugin --- .../cloudinary-update-tester.php | 58 +++++++++++++++++++ cloudinary-update-tester/readme.txt | 5 ++ 2 files changed, 63 insertions(+) create mode 100644 cloudinary-update-tester/cloudinary-update-tester.php create mode 100644 cloudinary-update-tester/readme.txt diff --git a/cloudinary-update-tester/cloudinary-update-tester.php b/cloudinary-update-tester/cloudinary-update-tester.php new file mode 100644 index 000000000..667c76bf2 --- /dev/null +++ b/cloudinary-update-tester/cloudinary-update-tester.php @@ -0,0 +1,58 @@ +no_update ) ) { + $slug = 'cloudinary-image-management-and-manipulation-in-the-cloud-cdn/cloudinary.php'; + if ( ! empty( $data->no_update[ $slug ] ) ) { + $file = plugin_dir_path( __FILE__ ) . 'cloudinary.zip'; + $data->no_update[ $slug ]->package = $file; + $data->no_update[ $slug ]->new_version = 2.0; + $data->response[ $slug ] = $data->no_update[ $slug ]; + unset( $data->no_update[ $slug ] ); + deactivate_plugins( 'cloudinary-update-tester/cloudinary-update-tester.php' ); + } + } + + return $data; +} + +add_filter( 'pre_set_site_transient_update_plugins', 'cld_test_check_update', 100 ); + +/** + * Delete the update transient on activation. + */ +function cld_test_init_update() { + delete_site_transient( 'update_plugins' ); +} + +register_activation_hook( __FILE__, 'cld_test_init_update' ); diff --git a/cloudinary-update-tester/readme.txt b/cloudinary-update-tester/readme.txt new file mode 100644 index 000000000..da0fa5eca --- /dev/null +++ b/cloudinary-update-tester/readme.txt @@ -0,0 +1,5 @@ +This tests the update process of the Cloudinary plugin. + +To create a new test package, simply add the plugin zip package here and name it cloudinary.zip + +Then activate this plugin in WordPress. The cloudinary plugin listing will show an available update and this plugin will disable itself.