PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backups, Restore, Migration & Clone / 3.0.2
WP STAGING – WordPress Backups, Restore, Migration & Clone v3.0.2
4.11.2 4.11.1 4.11.0 4.10.0 4.9.5 4.9.4 4.9.3 4.9.2 4.9.1 4.9.0 4.8.1 trunk 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.10.0 3.2.0 3.3.1 3.3.2 3.3.3 3.4.1 3.4.3 3.5.0 3.6.0 3.7.1 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 4.0.0 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.7.2 4.7.3 4.8.0
wp-staging / Backend / Modules / Jobs / Cancel.php
wp-staging / Backend / Modules / Jobs Last commit date
Cleaners 5 years ago Exceptions 5 years ago Cancel.php 3 years ago CancelUpdate.php 4 years ago Cloning.php 3 years ago CloningProcess.php 3 years ago Data.php 3 years ago Database.php 3 years ago Delete.php 3 years ago Directories.php 3 years ago Files.php 3 years ago Finish.php 3 years ago Job.php 3 years ago JobExecutable.php 3 years ago Logs.php 3 years ago PreserveDataFirstStep.php 3 years ago PreserveDataSecondStep.php 3 years ago ProcessLock.php 3 years ago Scan.php 3 years ago SearchReplace.php 3 years ago TotalStepsAreNumberOfTables.php 5 years ago Updating.php 3 years ago Verify.php 3 years ago
Cancel.php
94 lines
1 <?php
2
3 namespace WPStaging\Backend\Modules\Jobs;
4
5 use WPStaging\Framework\Analytics\AnalyticsEventDto;
6
7 /**
8 * Class Cancel Processing
9 * @package WPStaging\Backend\Modules\Jobs
10 */
11 class Cancel extends Job
12 {
13
14 /**
15 * Start Module
16 * @return bool
17 */
18 public function start()
19 {
20 $cloneData = $this->createCloneData();
21
22 if (!empty($this->options->jobIdentifier)) {
23 AnalyticsEventDto::enqueueCancelEvent($this->options->jobIdentifier);
24 }
25
26 if (empty($cloneData)) {
27 return true;
28 }
29 // Delete data in external database
30 if (empty($this->options->databaseUser)) {
31 $delete = new Delete();
32 } else {
33 $delete = new Delete(true);
34 }
35 return $delete->start($cloneData);
36 }
37
38 /**
39 * @return array
40 */
41 protected function createCloneData()
42 {
43 $clone = [];
44
45 if (!$this->check()) {
46 return $clone;
47 }
48
49 $clone["name"] = $this->options->clone;
50 $clone["number"] = $this->options->cloneNumber;
51 $clone["path"] = ABSPATH . $this->options->cloneDirectoryName;
52 $clone["prefix"] = $this->options->prefix;
53 $clone["databaseServer"] = $this->options->databaseServer;
54 $clone["databaseUser"] = $this->options->databaseUser;
55 $clone["databasePassword"] = $this->options->databasePassword;
56 $clone["databasePrefix"] = $this->options->databasePrefix;
57 $clone["databaseDatabase"] = $this->options->databaseDatabase;
58 $clone["databaseSsl"] = $this->options->databaseSsl;
59
60 return $clone;
61 }
62
63 /**
64 * @return bool
65 */
66 public function check()
67 {
68 return (
69 isset($this->options) &&
70 isset($this->options->clone) &&
71 isset($this->options->cloneNumber) &&
72 isset($this->options->cloneDirectoryName) &&
73 isset($_POST["clone"]) &&
74 $_POST["clone"] === $this->options->clone
75 );
76 }
77
78 /**
79 * Get json response
80 * return json
81 */
82 private function returnFinish($message = '')
83 {
84
85 wp_die(json_encode([
86 'job' => 'delete',
87 'status' => true,
88 'message' => $message,
89 'error' => false,
90 'delete' => 'finished'
91 ]));
92 }
93 }
94