Skip to content

Commit

Permalink
3.2.0
Browse files Browse the repository at this point in the history
* Activating Media Cloud will now import your WP Offload Media or WP-Stateless settings, making the transition as smooth as possible.
* Improved import for media uploaded with WP Offload Media or WP-Stateless
* New and improved background processing system, completely replaced the old error prone one
* New Task Manager shows you all running background tasks and upcoming scheduled ones
* Vastly improved Elementor integration
* Fixed Smush Pro integration (thanks to Brett Porcelli!)
* Asset push now queues uploads in the background instead of during page loads
* Support for "Bucket Only Policy" with Google Cloud Storage (thanks to Wietse Muizelaar!)
* Fix for environment variable MCLOUD_STORAGE_GOOGLE_CREDENTIALS_FILE (thanks to Wietse Muizelaar!)
* When "Delete Uploaded Files" is enabled, deletes can be queued in the background to be deleted in the future.  Allowing other plugins to process the upload before being removed from the local server.
* New "Clean Uploads" task removes media from the local uploads directory.
* Fix for path handling during migration and imports
* Fix for Vision where items were not being queued in a background task
* Fix for upload paths using @{version} token
* New integrated inline help system
* If Assets are enabled, added entries to WordPress admin bar to update build version and clear asset cache
* The `import` command line task renamed to `migrateToStorage`
* Added new `importFromStorage` command line task
* Added new `updateElementor` command line task
* Ability to hide Task Manager on multisite sub-sites
* Improved error reporting for invalid credentials
* Fixed dreaded white screen of doom when invalid cloud storage credentials are supplied
* Fix for blank settings pages in more restrictive server setups
  • Loading branch information
jawngee committed Oct 3, 2019
1 parent bd6dad2 commit 41eeee1
Show file tree
Hide file tree
Showing 190 changed files with 7,415 additions and 6,629 deletions.
41 changes: 41 additions & 0 deletions classes/CLI/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

namespace ILAB\MediaCloud\CLI;

use ILAB\MediaCloud\Tasks\Task;

if (!defined('ABSPATH')) { header('Location: /'); die; }

abstract class Command extends \WP_CLI_Command {
Expand All @@ -35,5 +37,44 @@ public static function Out($string, $newline = false) {
\WP_CLI::out(\WP_CLI::colorize($string).($newline ? "\n" : ""));
}

/**
* @param Task $task
* @param array $options
* @param array $selected
*
* @throws \Exception
*/
protected function runTask($task, $options = [], $selected = []) {
$task->cli = true;
$task->setHandlers(function($message, $newLine) {
Command::Info($message, $newLine);
}, function($message) {
Command::Error($message);
});

$task->prepare($options);
if ($task->totalItems == 0) {
self::Warn("No items found to process. Exiting.");
exit(0);
}

$task->save();


Command::Out("", true);
Command::Info("Found %W{$task->totalItems}%n items.", true);

while(true) {
$result = $task->run();
if (intval($result) >= Task::TASK_COMPLETE) {
$task->cleanUp();
break;
}
}

Command::Info("Complete.", true);
Command::Out("", true);
}

public abstract static function Register();
}
Loading

0 comments on commit 41eeee1

Please sign in to comment.