Skip to content

Commit

Permalink
* Fix for NOTICE "error" when using DigitalOcean or another S3 compat…
Browse files Browse the repository at this point in the history
…ible service

* Fix for Imgix when an image size has been defined with a width or height of zero.
* Ability to override the upload path for cloud uploads via the `media-cloud/storage/custom-prefix` filter.
* When migrating from another plugin like Offload Media or WP-Stateless, you can now choose to manually migrate any media uploaded with the other plugin.  This is a very fast process.  If you do not do the manual migration, media will be migrated the first time a URL for an attachment is generated.  You should choose to do the manual migration though.
* New option in Cloud Storage settings to turn off the automatic migration of media uploaded with another plugin.
* Fix for Regenerate Thumbnails not using the original image with 5.3's big image feature
* Fix for uploads not being deleted from WordPress in certain circumstances
* Fix for duplicates being uploaded to Cloud Storage when the upload path prefix `@{versioning}` is being used
* Fix for some uploads not being deleted when deleted from the WordPress media library
* Support for direct uploading on the front end when using plugins like WC Frontend Manager for WooCommerce.
* BuddyPress integration for uploading profile and cover images on profiles and groups.
  • Loading branch information
jawngee committed Mar 5, 2020
1 parent 7d2356f commit 565d190
Show file tree
Hide file tree
Showing 20 changed files with 669 additions and 300 deletions.
5 changes: 4 additions & 1 deletion classes/Storage/StorageGlobals.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

namespace ILAB\MediaCloud\Storage;

use ILAB\MediaCloud\Utilities\Logging\Logger;
use function ILAB\MediaCloud\Utilities\arrayPath;
use ILAB\MediaCloud\Utilities\Environment;
use ILAB\MediaCloud\Utilities\NoticeManager;
Expand Down Expand Up @@ -351,7 +352,9 @@ public static function deleteOnUpload() {

/** @return bool */
public static function queuedDeletes() {
return self::instance()->queuedDeletes;
$canQueue = apply_filters('media-cloud/storage/queue-deletes', true);
Logger::info("StorageGlobals::queuedDeletes - Filter returned: '$canQueue'");
return (!empty($canQueue) && self::instance()->queuedDeletes);
}

/** @return bool */
Expand Down
3 changes: 2 additions & 1 deletion classes/Tools/Crop/CropTool.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,8 @@ private function doPerformCrop($post_id, $size, $crop_x, $crop_y, $crop_width, $
list($full_src,$full_width,$full_height,$full_cropped)=$attrs;

if ($storageTool->enabled()) {
if(StorageGlobals::deleteOnUpload() && !StorageGlobals::queuedDeletes()) {
$canDelete = apply_filters('media-cloud/storage/delete_uploads', true);
if(!empty($canDelete) && StorageGlobals::deleteOnUpload() && !StorageGlobals::queuedDeletes()) {
$toDelete = trailingslashit($save_path).$filename;
if (file_exists($toDelete)) {
@unlink($toDelete);
Expand Down
22 changes: 22 additions & 0 deletions classes/Tools/Storage/CLI/StorageCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use ILAB\MediaCloud\Tools\Integrations\PlugIns\Elementor\Tasks\UpdateElementorTask ;
use ILAB\MediaCloud\Tools\Integrations\PlugIns\NextGenGallery\Tasks\MigrateNextGenTask ;
use ILAB\MediaCloud\Tools\Storage\StorageTool ;
use ILAB\MediaCloud\Tools\Storage\Tasks\MigrateFromOtherTask ;
use ILAB\MediaCloud\Tools\Storage\Tasks\MigrateTask ;
use ILAB\MediaCloud\Tools\Storage\Tasks\RegenerateThumbnailTask ;
use ILAB\MediaCloud\Tools\Storage\Tasks\UnlinkTask ;
Expand Down Expand Up @@ -75,6 +76,9 @@ class StorageCommands extends Command
*
* [--order-by=<string>]
* : The field to sort the items to be imported by. Valid values are 'date', 'title' and 'filename'.
*
* [--delete-migrated]
* : Deletes migrated media from your local WordPress server. Note: You must have Delete Uploads enabled in Cloud Storage for this setting to have any effect. If you have Delete Uploads disabled, turning this on will have zero effect.
* ---
* options:
* - date
Expand Down Expand Up @@ -290,6 +294,24 @@ public function updateElementor( $args, $assoc_args )
self::Error( "Only available in the Premium version. To upgrade: https://mediacloud.press/pricing/" );
}

/**
* Migrate other plugin settings
*
*
* @when after_wp_load
*
* @param $args
* @param $assoc_args
*
* @throws \Exception
*/
public function migrateFromOther( $args, $assoc_args )
{
/** @var MigrateFromOtherTask $task */
$task = new MigrateFromOtherTask();
$this->runTask( $task, [] );
}

/**
* Migrates any media that was uploaded with Human Made S3 Uploads plugin
*
Expand Down
Loading

0 comments on commit 565d190

Please sign in to comment.