| @@ 406-415 (lines=10) @@ | ||
| 403 | * |
|
| 404 | * @return WP_Error |
|
| 405 | */ |
|
| 406 | protected function validate_queue( $value ) { |
|
| 407 | if ( ! isset( $value ) ) { |
|
| 408 | return new WP_Error( 'invalid_queue', 'Queue name is required', 400 ); |
|
| 409 | } |
|
| 410 | ||
| 411 | if ( ! in_array( $value, array( 'sync', 'full_sync', 'immediate' ), true ) ) { |
|
| 412 | return new WP_Error( 'invalid_queue', 'Queue name should be sync, full_sync or immediate', 400 ); |
|
| 413 | } |
|
| 414 | return $value; |
|
| 415 | } |
|
| 416 | ||
| 417 | } |
|
| 418 | ||
| @@ 54-63 (lines=10) @@ | ||
| 51 | return array( 'scheduled' => Actions::do_full_sync( $modules ) ); |
|
| 52 | } |
|
| 53 | ||
| 54 | protected function validate_queue( $query ) { |
|
| 55 | if ( ! isset( $query ) ) { |
|
| 56 | return new WP_Error( 'invalid_queue', 'Queue name is required', 400 ); |
|
| 57 | } |
|
| 58 | ||
| 59 | if ( ! in_array( $query, array( 'sync', 'full_sync', 'immediate' ) ) ) { |
|
| 60 | return new WP_Error( 'invalid_queue', 'Queue name should be sync, full_sync or immediate', 400 ); |
|
| 61 | } |
|
| 62 | return $query; |
|
| 63 | } |
|
| 64 | } |
|
| 65 | ||
| 66 | // GET /sites/%s/sync/status |
|