|
1 |
| -# Revisions CLI [](https://travis-ci.org/trepmal/wp-revisions-cli) |
| 1 | +trepmal/wp-revisions-cli |
| 2 | +======================== |
2 | 3 |
|
3 |
| -WP CLI command for managing revisions |
| 4 | +Manage revisions |
4 | 5 |
|
5 |
| -## Installation |
| 6 | +[](https://travis-ci.org/trepmal/wp-revisions-cli) |
6 | 7 |
|
7 |
| -### as wp-cli package (recommended) |
| 8 | +Quick links: [Using](#using) | [Installing](#installing) | [Contributing](#contributing) | [Support](#support) |
8 | 9 |
|
9 |
| -``` |
10 |
| -wp package install trepmal/wp-revisions-cli |
11 |
| -``` |
| 10 | +## Using |
12 | 11 |
|
13 |
| -### as standard plugin (for older installations of wp-cli) |
| 12 | +This package implements the following commands: |
14 | 13 |
|
15 |
| -``` |
16 |
| -wp plugin install https://github.com/trepmal/wp-revisions-cli/archive/master.zip --activate |
17 |
| -``` |
| 14 | +### wp revisions list |
18 | 15 |
|
19 |
| -## Usage |
| 16 | +List all revisions |
20 | 17 |
|
| 18 | +~~~ |
| 19 | +wp revisions list [--post_type=<post-type>] [--post_id=<post-id>] [--fields=<fields>] [--yes] [--format=<format>] |
| 20 | +~~~ |
21 | 21 |
|
22 |
| -For a rundown of all commands at any time, run `wp help revisions` |
| 22 | +**OPTIONS** |
23 | 23 |
|
| 24 | + [--post_type=<post-type>] |
| 25 | + List revisions for given post type(s). |
24 | 26 |
|
25 |
| -### `wp revisions clean [<keep>]` |
| 27 | + [--post_id=<post-id>] |
| 28 | + List revisions for given post. Trumps --post_type. |
26 | 29 |
|
27 |
| -For all posts, keep only the last `<keep>` revisions for all posts. |
| 30 | + [--fields=<fields>] |
| 31 | + Comma-separated list of fields to be included in the output. |
| 32 | + --- |
| 33 | + default: ID,post_title,post_parent |
| 34 | + --- |
28 | 35 |
|
29 |
| - - `<keep>` *integer*. Defaults to value of `WP_POST_REVISIONS` |
30 |
| - - `--post_type=<post_type>` *string*. Clean revisions for given post type. Default any |
31 |
| - - `--post_id=<post_id>` *integer*. Clean revisions for given post. (Does not yet accept lists) |
32 |
| - - `--after-date=<date>` *string*. Clean revisions published on or after this date. Use YYYY-MM-DD |
33 |
| - - `--before-date=<date>` *string*. Clean revisions published on or before this date. Use YYYY-MM-DD |
34 |
| - - `--hard` use `wp_delete_post_revision()` when deleting, this picks up any potential related data such as meta or comments. |
| 36 | + [--yes] |
| 37 | + Answer yes to the confirmation message. |
35 | 38 |
|
36 |
| -### `wp revisions dump` |
| 39 | + [--format=<format>] |
| 40 | + Format to use for the output. One of table, csv or json. |
37 | 41 |
|
38 |
| -Dump all revisions for all posts. Faster than `wp revisions clean -1` since it doesn't query each post. |
| 42 | +**EXAMPLES** |
39 | 43 |
|
40 |
| - - `--hard` Slower. Uses `wp_delete_post_revision()` when deleting, this picks up any potential related data such as meta or comments. Equivalent to `wp revisions clean -1 --hard` |
41 |
| - - `--yes` answer *yes* to confirmation message |
| 44 | + wp revisions list |
| 45 | + wp revisions list --post_id=2 |
| 46 | + wp revisions list --post_type=post,page |
42 | 47 |
|
43 |
| -### `wp revisions generate [<count>]` |
44 | 48 |
|
45 |
| -Generate revisions for posts. |
46 | 49 |
|
47 |
| - - `<count>` *integer*. Number of revisions to generate per post. Default 15 |
48 |
| - - `--post_type=<post_type>` *string*. Generate revisions for given post type. Default any |
49 |
| - - `--post_id=<post_id>` *integer*. Generate revisions for given post. (Does not yet accept lists) |
| 50 | +### wp revisions dump |
50 | 51 |
|
51 |
| -### `wp revisions list` |
| 52 | +Delete all revisions |
52 | 53 |
|
53 |
| -List revisions. |
| 54 | +~~~ |
| 55 | +wp revisions dump [--hard] [--yes] |
| 56 | +~~~ |
54 | 57 |
|
55 |
| - - `--post_type=<post_type>` *string*. Generate revisions for given post type. Default any |
56 |
| - - `--post_id=<post_id>` *integer*. Generate revisions for given post. (Does not yet accept lists) |
57 |
| - - `--yes` answer *yes* to confirmation message |
| 58 | +**OPTIONS** |
58 | 59 |
|
59 |
| -### `wp revisions status` |
| 60 | + [--hard] |
| 61 | + Hard delete. Slower, uses wp_delete_post_revision(). Alias to wp revisions clean -1 |
60 | 62 |
|
61 |
| -Get revisions status. Namely, the value of `WP_POST_REVISIONS` |
| 63 | + [--yes] |
| 64 | + Answer yes to the confirmation message. |
62 | 65 |
|
| 66 | +**EXAMPLES** |
63 | 67 |
|
64 |
| -## Credits |
| 68 | + wp revisions dump |
65 | 69 |
|
66 |
| -## License |
67 | 70 |
|
68 |
| -The MIT License (MIT) |
69 |
| -Copyright (c) 2016 Kailey Lampert |
70 |
| -[Full text license](LICENSE) |
| 71 | + |
| 72 | +### wp revisions clean |
| 73 | + |
| 74 | +Delete old revisions |
| 75 | + |
| 76 | +~~~ |
| 77 | +wp revisions clean [<keep>] [--post_type=<post-type>] [--after-date=<yyyy-mm-dd>] [--before-date=<yyyy-mm-dd>] [--post_id=<post-id>] [--hard] [--dry-run] |
| 78 | +~~~ |
| 79 | + |
| 80 | +**OPTIONS** |
| 81 | + |
| 82 | + [<keep>] |
| 83 | + Number of revisions to keep per post. Defaults to WP_POST_REVISIONS if it is an integer |
| 84 | + |
| 85 | + [--post_type=<post-type>] |
| 86 | + Clean revisions for given post type(s). Default: any |
| 87 | + |
| 88 | + [--after-date=<yyyy-mm-dd>] |
| 89 | + Clean revisions published on or after this date. Default: none. |
| 90 | + |
| 91 | + [--before-date=<yyyy-mm-dd>] |
| 92 | + Clean revisions published on or before this date. Default: none. |
| 93 | + |
| 94 | + [--post_id=<post-id>] |
| 95 | + Clean revisions for given post. |
| 96 | + |
| 97 | + [--hard] |
| 98 | + Hard delete. Slower, uses wp_delete_post_revision(). |
| 99 | + |
| 100 | + [--dry-run] |
| 101 | + Dry run, just a test, no actual cleaning done. |
| 102 | + |
| 103 | +**EXAMPLES** |
| 104 | + |
| 105 | + wp revisions clean |
| 106 | + wp revisions clean 5 |
| 107 | + wp revisions clean --post_id=2 |
| 108 | + wp revisions clean 5 --post_type=post,page |
| 109 | + wp revisions clean --after-date=2015-11-01 --before-date=2015-12-30 |
| 110 | + wp revisions clean --after-date=2015-11-01 --before-date=2015-12-30 --dry-run |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | +### wp revisions generate |
| 115 | + |
| 116 | +Generate revisions |
| 117 | + |
| 118 | +~~~ |
| 119 | +wp revisions generate [<count>] [--post_type=<post-type>] [--post_id=<post-id>] |
| 120 | +~~~ |
| 121 | + |
| 122 | +**OPTIONS** |
| 123 | + |
| 124 | + [<count>] |
| 125 | + Number of revisions to generate per post. Default 15 |
| 126 | + |
| 127 | + [--post_type=<post-type>] |
| 128 | + Generate revisions for given post type(s). Default any |
| 129 | + |
| 130 | + [--post_id=<post-id>] |
| 131 | + Generate revisions for given post. |
| 132 | + |
| 133 | +**EXAMPLES** |
| 134 | + |
| 135 | + wp revisions generate 10 |
| 136 | + wp revisions generate --post_id=2 |
| 137 | + wp revisions generate 2 --post_type=post,page |
| 138 | + |
| 139 | + |
| 140 | + |
| 141 | +### wp revisions status |
| 142 | + |
| 143 | +Get revision status |
| 144 | + |
| 145 | +~~~ |
| 146 | +wp revisions status |
| 147 | +~~~ |
| 148 | + |
| 149 | +**OPTIONS** |
| 150 | + |
| 151 | +**EXAMPLES** |
| 152 | + |
| 153 | + wp revisions status |
| 154 | + |
| 155 | +## Installing |
| 156 | + |
| 157 | +Installing this package requires WP-CLI v2.1 or greater. Update to the latest stable release with `wp cli update`. |
| 158 | + |
| 159 | +Once you've done so, you can install this package with: |
| 160 | + |
| 161 | + wp package install git@github.com:trepmal/wp-revisions-cli.git |
| 162 | + |
| 163 | +## Contributing |
| 164 | + |
| 165 | +We appreciate you taking the initiative to contribute to this project. |
| 166 | + |
| 167 | +Contributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation. |
| 168 | + |
| 169 | +For a more thorough introduction, [check out WP-CLI's guide to contributing](https://make.wordpress.org/cli/handbook/contributing/). This package follows those policy and guidelines. |
| 170 | + |
| 171 | +### Reporting a bug |
| 172 | + |
| 173 | +Think you’ve found a bug? We’d love for you to help us get it fixed. |
| 174 | + |
| 175 | +Before you create a new issue, you should [search existing issues](https://github.com/trepmal/wp-revisions-cli/issues?q=label%3Abug%20) to see if there’s an existing resolution to it, or if it’s already been fixed in a newer version. |
| 176 | + |
| 177 | +Once you’ve done a bit of searching and discovered there isn’t an open or fixed issue for your bug, please [create a new issue](https://github.com/trepmal/wp-revisions-cli/issues/new). Include as much detail as you can, and clear steps to reproduce if possible. For more guidance, [review our bug report documentation](https://make.wordpress.org/cli/handbook/bug-reports/). |
| 178 | + |
| 179 | +### Creating a pull request |
| 180 | + |
| 181 | +Want to contribute a new feature? Please first [open a new issue](https://github.com/trepmal/wp-revisions-cli/issues/new) to discuss whether the feature is a good fit for the project. |
| 182 | + |
| 183 | +Once you've decided to commit the time to seeing your pull request through, [please follow our guidelines for creating a pull request](https://make.wordpress.org/cli/handbook/pull-requests/) to make sure it's a pleasant experience. See "[Setting up](https://make.wordpress.org/cli/handbook/pull-requests/#setting-up)" for details specific to working on this package locally. |
| 184 | + |
| 185 | +## Support |
| 186 | + |
| 187 | +Github issues aren't for general support questions, but there are other venues you can try: https://wp-cli.org/#support |
| 188 | + |
| 189 | + |
| 190 | +*This README.md is generated dynamically from the project's codebase using `wp scaffold package-readme` ([doc](https://github.com/wp-cli/scaffold-package-command#wp-scaffold-package-readme)). To suggest changes, please submit a pull request against the corresponding part of the codebase.* |
0 commit comments