PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backups, Restore, Migration & Clone / 3.0.6
WP STAGING – WordPress Backups, Restore, Migration & Clone v3.0.6
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 / ProcessLock.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 2 years ago Files.php 2 years ago Finish.php 2 years ago Job.php 2 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 2 years ago SearchReplace.php 3 years ago TotalStepsAreNumberOfTables.php 5 years ago Updating.php 3 years ago Verify.php 3 years ago
ProcessLock.php
89 lines
1 <?php
2
3 namespace WPStaging\Backend\Modules\Jobs;
4
5 use WPStaging\Core\WPStaging;
6
7 //use WPStaging\Core\Utils\Cache;
8
9 /**
10 * Class Cloning
11 * @package WPStaging\Backend\Modules\Jobs
12 */
13 class ProcessLock extends JobExecutable
14 {
15
16 /**
17 * Check if any process is already running
18 * @return boolean
19 */
20 public function isRunning()
21 {
22 // Another process is running
23 if (parent::isRunning()) {
24 $this->log("Another process is running");
25
26 $message = __('Hold on, another WP STAGING process is already running...', 'wp-staging');
27
28 require_once WPSTG_PLUGIN_DIR . "Backend/views/clone/ajax/process-lock.php";
29
30 wp_die();
31 }
32 // No other process running
33
34 return false;
35 }
36
37 /**
38 * Check if any process is already running, if running return a json encoded response for Swal Modal,
39 * Otherwise return false
40 *
41 * @return false|array
42 */
43 public function ajaxIsRunning()
44 {
45 if (parent::isRunning()) {
46 return [
47 'success' => false,
48 'type' => 'processLock',
49 // TODO: Create a Swal Response Class and Js library to handle that response or, Implement own Swal alternative
50 'swalOptions' => [
51 'title' => __('Error!', 'wp-staging'),
52 'html' => __('Hold on, another WP STAGING process is already running...', 'wp-staging'),
53 'confirmButtonText' => __('Stop other process', 'wp-staging'),
54 'showCancelButton' => true,
55 ],
56 ];
57 }
58
59 return false;
60 }
61
62 /**
63 * remove process lock value
64 */
65 public function restart()
66 {
67 unset($this->options->isRunning);
68 $this->cache->delete("clone_options");
69 $this->cache->delete("files_to_copy");
70 }
71
72 /**
73 * abstract
74 * @return void
75 */
76 protected function calculateTotalSteps()
77 {
78 }
79
80 /**
81 * abstract
82 * @return bool
83 */
84 protected function execute()
85 {
86 return false;
87 }
88 }
89