PluginProbe
ElasticPress / 4.4.0
ElasticPress v4.4.0
5.3.5 5.3.4 3.6.5 3.6.6 4.0.0 4.0.1 4.1.0 4.2.0 4.2.1 4.2.2 4.3.0 4.3.1 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.6.0 4.6.1 4.7.0 4.7.1 4.7.2 5.0.0 5.0.1 5.0.2 All 108 releases
elasticpress / includes / classes / DeprecatedCommand.php

DeprecatedCommand.php in ElasticPress 4.4.0, at includes/classes/DeprecatedCommand.php

277 lines 8.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WP-CLI depreceated commands for ElasticPress
4 *
5 * @since 4.4.0
6 * @package elasticpress
7 */
8
9 namespace ElasticPress;
10
11 use \WP_CLI as WP_CLI;
12
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit; // Exit if accessed directly.
15 }
16
17 /**
18 * Deprecated CLI Commands for ElasticPress
19 */
20 trait DeprecatedCommand {
21
22 /**
23 * DEPRECATED. Return all index names as a JSON object.
24 *
25 * This command is deprecated. Please use `get-indices` instead.
26 *
27 * ## OPTIONS
28 *
29 * [--pretty]
30 * : Use this flag to render a pretty-printed version of the JSON response.
31 *
32 * @subcommand get-indexes
33 * @since 3.2, `--pretty` introduced in 4.1.0
34 * @param array $args Positional CLI args.
35 * @param array $assoc_args Associative CLI args.
36 * @deprecated 4.4.0
37 * @see Command\get_indices()
38 */
39 public function get_indexes( $args, $assoc_args ) {
40 _deprecated_function( 'get-indexes', '4.4.0', 'get-indices' );
41 WP_CLI::warning(
42 sprintf(
43 /* translators: New command name */
44 esc_html__( 'This command is deprecated. Please use %s instead.', 'elasticpress' ),
45 'get-indices'
46 )
47 );
48 $this->get_indices( $args, $assoc_args );
49 }
50
51 /**
52 * DEPRECATED. Return all indexes from the cluster as a JSON object.
53 *
54 * This command is deprecated. Please use `get-cluster-indices` instead.
55 *
56 * ## OPTIONS
57 *
58 * [--pretty]
59 * : Use this flag to render a pretty-printed version of the JSON response.
60 *
61 * @subcommand get-cluster-indexes
62 * @since 3.2, `--pretty` introduced in 4.1.0
63 * @param array $args Positional CLI args.
64 * @param array $assoc_args Associative CLI args.
65 * @deprecated 4.4.0
66 * @see Command\get_cluster_indices()
67 */
68 public function get_cluster_indexes( $args, $assoc_args ) {
69 _deprecated_function( 'get-cluster-indexes', '4.4.0', 'get-cluster-indices' );
70 WP_CLI::warning(
71 sprintf(
72 /* translators: New command name */
73 esc_html__( 'This command is deprecated. Please use %s instead.', 'elasticpress' ),
74 'get-cluster-indices'
75 )
76 );
77 $this->get_cluster_indices( $args, $assoc_args );
78 }
79
80 /**
81 * DEPRECATED. Index all posts for a site or network wide.
82 *
83 * This command is deprecated. Please use `sync` instead.
84 *
85 * ## OPTIONS
86 *
87 * [--network-wide]
88 * : Force indexing on all the blogs in the network. `--network-wide` takes an optional argument to limit the number of blogs to be indexed across where 0 is no limit. For example, `--network-wide=5` would limit indexing to only 5 blogs on the network
89 *
90 * [--setup]
91 * : Clear the index first and re-send the put mapping. Use `--yes` to skip the confirmation
92 *
93 * [--per-page=<per_page_number>]
94 * : Determine the amount of posts to be indexed per bulk index (or cycle)
95 *
96 * [--nobulk]
97 * : Disable bulk indexing
98 *
99 * [--static-bulk]
100 * : Do not use dynamic bulk requests, i.e., send only one request per batch of documents.
101 *
102 * [--show-errors]
103 * : Show all errors
104 *
105 * [--show-bulk-errors]
106 * : Display the error message returned from Elasticsearch when a post fails to index using the /_bulk endpoint
107 *
108 * [--show-nobulk-errors]
109 * : Display the error message returned from Elasticsearch when a post fails to index while not using the /_bulk endpoint
110 *
111 * [--offset=<offset_number>]
112 * : Skip the first n posts (don't forget to remove the `--setup` flag when resuming or the index will be emptied before starting again).
113 *
114 * [--indexables=<indexables>]
115 * : Specify the Indexable(s) which will be indexed
116 *
117 * [--post-type=<post_types>]
118 * : Specify which post types will be indexed (by default: all indexable post types are indexed). For example, `--post-type="my_custom_post_type"` would limit indexing to only posts from the post type "my_custom_post_type". Accepts multiple post types separated by comma
119 *
120 * [--include=<IDs>]
121 * : Choose which object IDs to include in the index
122 *
123 * [--post-ids=<IDs>]
124 * : Choose which post_ids to include when indexing the Posts Indexable (deprecated)
125 *
126 * [--upper-limit-object-id=<ID>]
127 * : Upper limit of a range of IDs to be indexed. If indexing IDs from 30 to 45, this should be 45
128 *
129 * [--lower-limit-object-id=<ID>]
130 * : Lower limit of a range of IDs to be indexed. If indexing IDs from 30 to 45, this should be 30
131 *
132 * [--ep-host=<host>]
133 * : Custom Elasticsearch host
134 *
135 * [--ep-prefix=<prefix>]
136 * : Custom ElasticPress prefix
137 *
138 * [--yes]
139 * : Skip confirmation needed by `--setup`
140 *
141 * @param array $args Positional CLI args.
142 * @since 0.1.2
143 * @param array $assoc_args Associative CLI args.
144 * @deprecated 4.4.0
145 * @see Command\sync()
146 */
147 public function index( $args, $assoc_args ) {
148 _deprecated_function( 'index', '4.4.0', 'sync' );
149 WP_CLI::warning(
150 sprintf(
151 /* translators: New command name */
152 esc_html__( 'This command is deprecated. Please use %s instead.', 'elasticpress' ),
153 'sync'
154 )
155 );
156 $this->sync( $args, $assoc_args );
157 }
158
159 /**
160 * DEPRECATED. Clear a sync/index process.
161 *
162 * This command is deprecated. Please use `clear-sync` instead.
163 *
164 * If an index was stopped prematurely and won't start again, this will clear this cached data such that a new index can start.
165 *
166 * @subcommand clear-index
167 * @param array $args Positional CLI args.
168 * @param array $assoc_args Associative CLI args.
169 * @since 3.4
170 * @deprecated 4.4.0
171 * @see Command\clear_sync()
172 */
173 public function clear_index( $args, $assoc_args ) {
174 _deprecated_function( 'clear-index', '4.4.0', 'clear-sync' );
175 WP_CLI::warning(
176 sprintf(
177 /* translators: New command name */
178 esc_html__( 'This command is deprecated. Please use %s instead.', 'elasticpress' ),
179 'clear-sync'
180 )
181 );
182 $this->clear_sync( $args, $assoc_args );
183 }
184
185 /**
186 * DEPRECATED. Returns the status of an ongoing index operation in JSON array.
187 *
188 * This command is deprecated. Please use `get-ongoing-sync-status` instead.
189 *
190 * Returns the status of an ongoing index operation in JSON array with the following fields:
191 * indexing | boolean | True if index operation is ongoing or false
192 * method | string | 'cli', 'web' or 'none'
193 * items_indexed | integer | Total number of items indexed
194 * total_items | integer | Total number of items indexed or -1 if not yet determined
195 *
196 * ## OPTIONS
197 *
198 * [--pretty]
199 * : Use this flag to render a pretty-printed version of the JSON response.
200 *
201 * @subcommand get-indexing-status
202 * @since 3.5.1, `--pretty` introduced in 4.1.0
203 * @param array $args Positional CLI args.
204 * @param array $assoc_args Associative CLI args.
205 * @deprecated 4.4.0
206 * @see Command\get_ongoing_sync_status()
207 */
208 public function get_indexing_status( $args, $assoc_args ) {
209 _deprecated_function( 'get-indexing-status', '4.4.0', 'get-ongoing-sync-status' );
210 WP_CLI::warning(
211 sprintf(
212 /* translators: New command name */
213 esc_html__( 'This command is deprecated. Please use %s instead.', 'elasticpress' ),
214 'get-ongoing-sync-status'
215 )
216 );
217 $this->get_ongoing_sync_status( $args, $assoc_args );
218 }
219
220 /**
221 * DEPRECATED. Returns a JSON array with the results of the last CLI index (if present) or an empty array.
222 *
223 * This command is deprecated. Please use `get-last-cli-sync` instead.
224 *
225 * ## OPTIONS
226 *
227 * [--clear]
228 * : Clear the `ep_last_cli_index` option.
229 *
230 * [--pretty]
231 * : Use this flag to render a pretty-printed version of the JSON response.
232 *
233 * @subcommand get-last-cli-index
234 * @since 3.5.1, `--pretty` introduced in 4.1.0
235 * @param array $args Positional CLI args.
236 * @param array $assoc_args Associative CLI args.
237 * @deprecated 4.4.0
238 * @see Command\get_last_cli_sync()
239 */
240 public function get_last_cli_index( $args, $assoc_args ) {
241 _deprecated_function( 'get-last-cli-index', '4.4.0', 'get-last-cli-sync' );
242 WP_CLI::warning(
243 sprintf(
244 /* translators: New command name */
245 esc_html__( 'This command is deprecated. Please use %s instead.', 'elasticpress' ),
246 'get-last-cli-sync'
247 )
248 );
249 $this->get_last_cli_sync( $args, $assoc_args );
250 }
251
252 /**
253 * DEPRECATED. Stop the indexing operation started from the dashboard.
254 *
255 * This command is deprecated. Please use `stop-sync` instead.
256 *
257 * @subcommand stop-indexing
258 * @since 3.5.2
259 * @param array $args Positional CLI args.
260 * @param array $assoc_args Associative CLI args.
261 * @deprecated 4.4.0
262 * @see Command\stop_sync()
263 */
264 public function stop_indexing( $args, $assoc_args ) {
265 _deprecated_function( 'stop-indexing', '4.4.0', 'stop-sync' );
266 WP_CLI::warning(
267 sprintf(
268 /* translators: New command name */
269 esc_html__( 'This command is deprecated. Please use %s instead.', 'elasticpress' ),
270 'stop-sync'
271 )
272 );
273 $this->stop_sync( $args, $assoc_args );
274 }
275
276 }
277