-
Notifications
You must be signed in to change notification settings - Fork 64
WP CLI
WP-Stateless works with the WP-CLI command wp stateless
for upgrading postmeta and sync media.
It uses subcommands under the wp stateless
command. The syntax for the subcommands is as follows.
wp stateless upgrade meta <uri> [<type>] [--start=<val>] [--limit=<val>] [--end=<val>] [--batch=<val>] [--batches=<val>] [--b] [--log] [--o]
wp stateless sync images <uri> [<type>] [--start=<val>] [--limit=<val>] [--end=<val>] [--batch=<val>] [--batches=<val>] [--b] [--log] [--o] [--force] [--continue] [--fix] [--order]
wp stateless sync files <uri> [<type>] [--start=<val>] [--limit=<val>] [--end=<val>] [--batch=<val>] [--batches=<val>] [--b] [--log] [--o] [--force] [--continue] [--fix] [--use_wildcards] [--order]
The information on the subcommands can be found from the following commands.
wp stateless upgrade --help
wp stateless sync --help
Uses for upgrade DB after updating plugin.
Uses for sync attachments with GCS. May be run for images (mode images
) and non-images (mode files
) attachments.
By default command sync only non-synchronized attachments. For force sync all media should be used option --force
.
Limit by default set to 100.
Argument | Description |
---|---|
--start | Indent (sql OFFSET). It's ignored on batches |
--limit | Limit per query (sql LIMIT) |
--end | Where ( on which row ) we should stop script. It's ignored on batches |
--batch | Number of Batch. Default is 1 |
--batches | General amount of batches |
--b | Runs command using batches till it's done. Other parameters will be ignored. There are 10 batches by default. Batch is external command process |
--log | Show more information in command line |
--o | Process includes database optimization and transient removing |
Argument | Description |
---|---|
--force | Force sync all images or files |
--continue | Continue the last process |
--fix | Try to fix previously failed items |
--use_wildcards | Use wildcards for sync proccess |
--order | Order (sql ORDER BY). May be ASC or DESC. By default is DESC |
Run process looping 10 batches. Every batch is external command 'wp stateless sync images --url=example.com --batch= --batches=10'
Run process looping 100 batches.
Run second batch from 10 batches manually.
Run default process showing additional information in command line.
Run process from 1 to 3000 row. Splits process by limiting queries to 50 rows. So, the current example does 60 queries ( 3000 / 50 = 60 ).
Run process from 777 to 3000 row. Also does database optimization and removes transient in the end.
Run process with additional logs in command line.
Run process for all existing images, including already synchronized images.
Run process from last synchronized image, items will be ordered by ASC.
Run process only for previously failed items and trying to fix its.
Run process with using wildcards.