PluginProbe
ezCache / 2.5
ezCache v2.5
2.6.5 2.6.4 2.6.2 2.6.3 2.6.1 2.6.0 2.5.6 2.5.5 2.5.4 2.5.3 2.5.2 2.5.1 2.5 2.2.1 2.2.2 trunk 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.3 1.3.1 1.3.10 1.3.11 All 49 releases
ezcache / includes / Rest / PreloadController.php

PreloadController.php in ezCache 2.5, at includes/Rest/PreloadController.php

37 lines 650 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Upress\EzCache\Rest;
4
5 use Upress\EzCache\Preload;
6 use WP_REST_Request;
7
8 class PreloadController {
9
10 /**
11 * Get the current state of the preload queue.
12 */
13 public function show() {
14 return wp_send_json_success( Preload::instance()->get_status() );
15 }
16
17 /**
18 * Start (or restart) the preload process.
19 *
20 * @param WP_REST_Request $request
21 */
22 public function start( $request ) {
23 $status = Preload::instance()->start();
24
25 return wp_send_json_success( $status );
26 }
27
28 /**
29 * Cancel a running preload.
30 */
31 public function destroy() {
32 $status = Preload::instance()->stop();
33
34 return wp_send_json_success( $status );
35 }
36 }
37