Skip to content

Commit

Permalink
* Added wp mediacloud:storage syncAllLocal command to download all …
Browse files Browse the repository at this point in the history
…cloud storage files to your local server.

* Added integration for WPForms to automatically upload files to the cloud. (Premium)
* Added task to migrate existing WPForms entries to cloud storage. (Premium)
* Added new **Generate EWW WebP** task to generate webp files from images on cloud storage.  EWWW Image Optimization
  plugin must be installed and activated and working in local mode (NOT cloud mode).  (Premium)
* Added `wp mediacloud:storage makewebp` command to generate webp files using EWWW (see above).  (Premium)
* Updated Freemius to latest version.
  • Loading branch information
jawngee committed Dec 8, 2022
1 parent 0326322 commit e55094c
Show file tree
Hide file tree
Showing 82 changed files with 45,604 additions and 45,351 deletions.
109 changes: 109 additions & 0 deletions classes/Tools/Storage/CLI/StorageCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
use MediaCloud\Plugin\Tools\Integrations\PlugIns\Elementor\Tasks\UpdateElementorTask ;
use MediaCloud\Plugin\Tools\Integrations\PlugIns\NextGenGallery\Tasks\MigrateNextGenTask ;
use MediaCloud\Plugin\Tools\Storage\StorageTool ;
use MediaCloud\Plugin\Tools\Storage\Tasks\GenerateEwwwWebPTask ;
use MediaCloud\Plugin\Tools\Storage\Tasks\MigrateFromOtherTask ;
use MediaCloud\Plugin\Tools\Storage\Tasks\MigrateTask ;
use MediaCloud\Plugin\Tools\Storage\Tasks\RegenerateThumbnailTask ;
use MediaCloud\Plugin\Tools\Storage\Tasks\SyncLocalTask ;
use MediaCloud\Plugin\Tools\Storage\Tasks\UnlinkTask ;
use MediaCloud\Plugin\Tools\Storage\Tasks\UpdateURLsTask ;
use MediaCloud\Plugin\Tools\Storage\Tasks\VerifyLibraryTask ;
Expand Down Expand Up @@ -674,6 +676,69 @@ public function verify( $args, $assoc_args )
$this->runTask( $task, $options );
}

/**
* Syncs all files on cloud storage back to your local server. Note that this does not remove the cloud metadata, you must run `unlink` after if you want to do that.
*
* ## OPTIONS
*
* [--limit=<number>]
* : The maximum number of items to process, default is infinity.
*
* [--offset=<number>]
* : The starting offset to process. Cannot be used with page.
*
* [--page=<number>]
* : The starting offset to process. Page numbers start at 1. Cannot be used with offset.
*
* [--order-by=<string>]
* : The field to sort the items to be imported by. Valid values are 'date', 'title' and 'filename'.
* ---
* options:
* - date
* - title
* - filename
* ---
*
* [--order=<string>]
* : The sort order. Valid values are 'asc' and 'desc'.
* ---
* default: asc
* options:
* - asc
* - desc
* ---
*
* @when after_wp_load
*
* @param $args
* @param $assoc_args
*
* @throws \Exception
*/
public function syncAllLocal( $args, $assoc_args )
{
$options = $assoc_args;
if ( isset( $options['limit'] ) ) {

if ( isset( $options['page'] ) ) {
$options['offset'] = max( 0, ($assoc_args['page'] - 1) * $assoc_args['limit'] );
unset( $options['page'] );
}

}

if ( isset( $options['order-by'] ) ) {
$orderBy = $options['order-by'];
$dir = arrayPath( $options, 'order', 'asc' );
unset( $options['order-by'] );
unset( $options['order'] );
$options['sort-order'] = $orderBy . '-' . $dir;
}

$task = new SyncLocalTask();
$this->runTask( $task, $options );
}

/**
* Syncs cloud storage to the local file system
*
Expand Down Expand Up @@ -784,6 +849,50 @@ public function syncLocal( $args, $assoc_args )
$reporter->close();
}

/**
* Generates webp files for images on cloud storage.
*
* ## OPTIONS
*
* [--limit=<number>]
* : The maximum number of items to process, default is infinity.
*
* [--offset=<number>]
* : The starting offset to process. Cannot be used with page.
*
* [--page=<number>]
* : The starting offset to process. Page numbers start at 1. Cannot be used with offset.
*
* [--order-by=<string>]
* : The field to sort the items to be imported by. Valid values are 'date', 'title' and 'filename'.
* ---
* options:
* - date
* - title
* - filename
* ---
*
* [--order=<string>]
* : The sort order. Valid values are 'asc' and 'desc'.
* ---
* default: asc
* options:
* - asc
* - desc
* ---
*
* @when after_wp_load
*
* @param $args
* @param $assoc_args
*
* @throws \Exception
*/
public function makewebp( $args, $assoc_args )
{
self::Error( "Only available in the Premium version. To upgrade: https://mediacloud.press/pricing/" );
}

/**
* Replaces URLs in content with the cloud storage URL. This will only replace local URLs.
*
Expand Down
1 change: 1 addition & 0 deletions classes/Tools/Storage/StorageTool.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use MediaCloud\Plugin\Tools\Storage\Tasks\CleanUploadsTask ;
use MediaCloud\Plugin\Tools\Storage\Tasks\DeleteUploadsTask ;
use MediaCloud\Plugin\Tools\Storage\Tasks\FixMetadataTask ;
use MediaCloud\Plugin\Tools\Storage\Tasks\GenerateEwwwWebPTask ;
use MediaCloud\Plugin\Tools\Storage\Tasks\MigrateFromOtherTask ;
use MediaCloud\Plugin\Tools\Storage\Tasks\MigrateTask ;
use MediaCloud\Plugin\Tools\Storage\Tasks\RegenerateThumbnailTask ;
Expand Down
2 changes: 1 addition & 1 deletion external/Freemius/assets/css/admin/add-ons.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion external/Freemius/assets/css/admin/affiliation.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion external/Freemius/assets/css/admin/common.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e55094c

Please sign in to comment.