WP-CLI Commands and Usage Docs

WP-CLI is the command-line interface for WordPress. You can use it to transfer your WordPress media library, verify, an manage Infinite Uploads cloud storage, without using a web browser. While WP-CLI is faster, working from the command-line can be difficult for new users and is not supported by all hosts.

Moving files with WP-CLI is faster and more reliable. This document is a list of available commands for controlling Infinite Uploads from the command line.

Verify Infinite Uploads is Connected

Once you are connected to the Infinite Uploads cloud, you can run a test to verify that the connection is working. You can do this using the verify command:

wp infinite-uploads verify

Sync files to Infinite Uploads

If you have unsynced files in the WordPress uploads directory, use the below command to copy them all to our cloud from local disk.

wp infinite-uploads sync [--concurrency=<concurrency>] [--noscan] [--verbose]

Concurrency is how many files will be uploaded in parallel. This helps speed up syncs as most libraries have many small files and it can be hard to max out available bandwidth. The default concurrency is 20, but you can experiment with various settings via --concurrency=X based on what your server can handle.

The default is to run a scan of local and cloud filesystems before beginning a sync. If you are just continuing a sync and know there were no filesystem changes you can pass the --noscan argument to skip that step and get right to syncing.

The default output is a progress meter, but by adding the --verbose argument it will show a scrolling list of each filename as it is synced to the cloud.

Delete local files that have been synced (free up local storage)

If you have already synced files in the WordPress uploads directory, use the below command to delete the local copy and free up disk space.

wp infinite-uploads delete [--noscan] [--verbose]

The default is to run a scan of local and cloud filesystems before deleting. If you are just continuing a delete and know there were no filesystem changes you can pass the --noscan argument to skip that step and get right to deleting.

The default output is a progress meter, but by adding the --verbose argument it will show a scrolling list of each filename as it is deleted from local storage.

Listing files on Infinite Uploads

Infinite Uploads comes with a WP-CLI command for listing your files in our cloud for debugging etc.

wp infinite-uploads ls [<path>] 			

You can include the optional <path> parameter to only list files starting with a given prefix, example "2021/".

Download files from the cloud

If you want to disconnect your site from the cloud, you will need to download all files back to the WordPress uploads directory to avoid missing files or data loss. Use the below command to copy all cloud-only files to the local disk.

wp infinite-uploads download [--concurrency=<concurrency>] [--noscan] [--verbose]

Concurrency is how many files will be downloaded in parallel. This helps speed up downloads as most libraries have many small files and it can be hard to max out available bandwidth. The default concurrency is 20, but you can experiment with various settings via --concurrency=X based on what your server can handle.

The default is to run a scan of local and cloud filesystems before beginning a download. If you are just continuing a download and know there were no filesystem changes you can pass the --noscan argument to skip that step and get right to downloading.

The default output is a progress meter, but by adding the --verbose argument it will show a scrolling list of each filename as it is downloaded from the cloud.

Advanced Defines

URL Rewrites

By default, Infinite Uploads will use the canonical CDN URIs for referencing the uploads, i.e. xxxx.infiniteuploads.cloud/[file path].

Infinite Uploads’ URL rewriting feature can be disabled if the current website does not require it, like if you wanted to use a nginx reverse proxy to our CDN etc. In this case the plugin will only upload files to our cloud storage.

// disable URL rewriting alltogether define( 'INFINITE_UPLOADS_DISABLE_REPLACE_UPLOAD_URL', true ); 			

Offline Development

While it’s possible to use Infinite Uploads for local development (this is actually a nice way to not have to sync all uploads from production to development), if you want to develop offline you have a couple of options.

  1. Just disable the Infinite Uploads plugin in your development environment.
  2. Define the INFINITE_UPLOADS_USE_LOCAL constant with the plugin active.

Option 2 will allow you to run the Infinite Uploads plugin for production parity purposes, it will essentially mock our cloud with a local stream wrapper and actually store the uploads in your WP Upload Dir /iu/ subdirectory.

Still need help? Contact Us Contact Us