PluginProbe
WP Synchro – The Ultimate WordPress Migration Tool / trunk
WP Synchro – The Ultimate WordPress Migration Tool vtrunk
1.16.1 1.16.0 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0 1.10.0 1.11.0 1.11.1 1.11.2 1.11.3 1.11.4 1.11.5 1.12.0 1.13.0 1.14.0 1.15.0 1.2.0 1.3.0 1.3.1 1.3.2 All 45 releases
wpsynchro / src / API / Status.php

Status.php in WP Synchro – The Ultimate WordPress Migration Tool trunk, at src/API/Status.php

44 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPSynchro\API;
4
5 use WPSynchro\Status\MigrateStatus;
6
7 /**
8 * Class for handling service "status"
9 * Call should already be verified by permissions callback
10 *
11 */
12 class Status extends WPSynchroService
13 {
14 public function service()
15 {
16 // Extract parameters
17 $body = $this->getRequestBody();
18 $parameters = json_decode($body);
19
20 if (isset($parameters->migration_id)) {
21 $migration_id = $parameters->migration_id;
22 } else {
23 $migration_id = '';
24 }
25 if (isset($parameters->job_id)) {
26 $job_id = $parameters->job_id;
27 } else {
28 $job_id = '';
29 }
30
31 $status = new MigrateStatus();
32 $status->setup($migration_id, $job_id);
33 $sync_response = $status->getMigrationStatus();
34
35 if (isset($sync_response->errors) && count($sync_response->errors) > 0) {
36 $sync_response->should_continue = false;
37 } else {
38 $sync_response->should_continue = true;
39 }
40
41 echo json_encode($sync_response);
42 }
43 }
44