Duplicator – WordPress Migration Plugin - Version 1.1.4

Version Description

Download this release

Release Info

Developer cory@lamle.org
Plugin Icon 128x128 Duplicator – WordPress Migration Plugin
Version 1.1.4
Comparing to
See all releases

Code changes from version 1.1.2 to 1.1.4

classes/package.php CHANGED
@@ -1,506 +1,519 @@
1
- <?php
2
- if ( ! defined( 'DUPLICATOR_VERSION' ) ) exit; // Exit if accessed directly
3
-
4
- require_once (DUPLICATOR_PLUGIN_PATH . 'classes/package.archive.php');
5
- require_once (DUPLICATOR_PLUGIN_PATH . 'classes/package.installer.php');
6
- require_once (DUPLICATOR_PLUGIN_PATH . 'classes/package.database.php');
7
- require_once (DUPLICATOR_PLUGIN_PATH . 'classes/utility.php');
8
-
9
- final class DUP_PackageStatus {
10
- private function __construct() {}
11
- const START = 10;
12
- const DBSTART = 20;
13
- const DBDONE = 30;
14
- const ARCSTART = 40;
15
- const ARCDONE = 50;
16
- const COMPLETE = 100;
17
- }
18
-
19
- final class DUP_PackageType {
20
- private function __construct() {}
21
- const MANUAL = 0;
22
- const SCHEDULED = 1;
23
- }
24
-
25
- /**
26
- * Class used to store and process all Package logic
27
- * @package Dupicator\classes
28
- */
29
- class DUP_Package {
30
-
31
- const OPT_ACTIVE = 'duplicator_package_active';
32
-
33
- //Properties
34
- public $ID;
35
- public $Name;
36
- public $Hash;
37
- public $NameHash;
38
- public $Version;
39
- public $Type;
40
- public $Notes;
41
- public $StorePath;
42
- public $StoreURL;
43
- public $ScanFile;
44
- public $Runtime;
45
- public $ExeSize;
46
- public $ZipSize;
47
- public $Status;
48
- public $WPUser;
49
- //Objects
50
- public $Archive;
51
- public $Installer;
52
- public $Database;
53
-
54
- /**
55
- * Manages the Package Process
56
- */
57
- function __construct() {
58
-
59
- $this->ID = null;
60
- $this->Version = DUPLICATOR_VERSION;
61
- $this->Type = DUP_PackageType::MANUAL;
62
- $this->Name = self::GetDefaultName();
63
- $this->Notes = null;
64
- $this->StoreURL = DUP_Util::SSDirURL();
65
- $this->StorePath = DUPLICATOR_SSDIR_PATH_TMP;
66
- $this->Database = new DUP_Database($this);
67
- $this->Archive = new DUP_Archive($this);
68
- $this->Installer = new DUP_Installer($this);
69
-
70
- }
71
-
72
- /**
73
- * Generates a scan report
74
- * @return array of scan results
75
- */
76
- public function Scan() {
77
-
78
- $timerStart = DUP_Util::GetMicrotime();
79
- $report = array();
80
- $this->ScanFile = "{$this->NameHash}_scan.json";
81
-
82
- $report['RPT']['ScanTime'] = "0";
83
- $report['RPT']['ScanFile'] = $this->ScanFile;
84
-
85
- //SERVER
86
- $srv = DUP_Server::GetChecks();
87
- $report['SRV']['WEB']['ALL'] = $srv['SRV']['WEB']['ALL'];
88
- $report['SRV']['WEB']['model'] = $srv['SRV']['WEB']['model'];
89
-
90
- $report['SRV']['PHP']['ALL'] = $srv['SRV']['PHP']['ALL'];
91
- $report['SRV']['PHP']['openbase'] = $srv['SRV']['PHP']['openbase'];
92
- $report['SRV']['PHP']['maxtime'] = $srv['SRV']['PHP']['maxtime'];
93
- $report['SRV']['PHP']['mysqli'] = $srv['SRV']['PHP']['mysqli'];
94
-
95
- $report['SRV']['WP']['ALL'] = $srv['SRV']['WP']['ALL'];
96
- $report['SRV']['WP']['version'] = $srv['SRV']['WP']['version'];
97
- $report['SRV']['WP']['core'] = $srv['SRV']['WP']['core'];
98
- $report['SRV']['WP']['cache'] = $srv['SRV']['WP']['cache'];
99
-
100
- //FILES
101
- $this->Archive->Stats();
102
- $dirCount = count($this->Archive->Dirs);
103
- $fileCount = count($this->Archive->Files);
104
- $fullCount = $dirCount + $fileCount;
105
-
106
- $report['ARC']['Size'] = DUP_Util::ByteSize($this->Archive->Size) or "unknown";
107
- $report['ARC']['DirCount'] = number_format($dirCount);
108
- $report['ARC']['FileCount'] = number_format($fileCount);
109
- $report['ARC']['FullCount'] = number_format($fullCount);
110
-
111
- $report['ARC']['FilterInfo']['Dirs'] = $this->Archive->FilterInfo->Dirs;
112
- $report['ARC']['FilterInfo']['Files'] = $this->Archive->FilterInfo->Files;
113
- $report['ARC']['FilterInfo']['Exts'] = $this->Archive->FilterInfo->Exts;
114
-
115
- $report['ARC']['Status']['Size'] = ($this->Archive->Size > DUPLICATOR_SCAN_SITE) ? 'Warn' : 'Good';
116
- $report['ARC']['Status']['Names'] = (count($this->Archive->FilterInfo->Files->Warning) + count($this->Archive->FilterInfo->Dirs->Warning)) ? 'Warn' : 'Good';
117
- $report['ARC']['Status']['Big'] = count($this->Archive->FilterInfo->Files->Size) ? 'Warn' : 'Good';
118
-
119
- $report['ARC']['Dirs'] = $this->Archive->Dirs;
120
- $report['ARC']['Files'] = $this->Archive->Files;
121
-
122
-
123
- //DATABASE
124
- $db = $this->Database->Stats();
125
- $report['DB']['Status'] = $db['Status'];
126
- $report['DB']['Size'] = DUP_Util::ByteSize($db['Size']) or "unknown";
127
- $report['DB']['Rows'] = number_format($db['Rows']) or "unknown";
128
- $report['DB']['TableCount'] = $db['TableCount'] or "unknown";
129
- $report['DB']['TableList'] = $db['TableList'] or "unknown";
130
-
131
- $warnings = array($report['SRV']['WEB']['ALL'],
132
- $report['SRV']['PHP']['ALL'],
133
- $report['SRV']['WP']['ALL'],
134
- $report['ARC']['Status']['Size'],
135
- $report['ARC']['Status']['Names'],
136
- $report['ARC']['Status']['Big'],
137
- $db['Status']['Size'],
138
- $db['Status']['Rows']);
139
-
140
- $warn_counts = array_count_values($warnings);
141
-
142
- $report['RPT']['Warnings'] = $warn_counts['Warn'];
143
- $report['RPT']['Success'] = $warn_counts['Good'];
144
- $report['RPT']['ScanTime'] = DUP_Util::ElapsedTime(DUP_Util::GetMicrotime(), $timerStart);
145
- $fp = fopen(DUPLICATOR_SSDIR_PATH_TMP . "/{$this->ScanFile}", 'w');
146
- fwrite($fp, json_encode($report));
147
- fclose($fp);
148
-
149
- return $report;
150
- }
151
-
152
- /**
153
- * Starts the package build process
154
- * @return DUP_Package
155
- */
156
- public function Build() {
157
-
158
- global $wp_version;
159
- global $wpdb;
160
- global $current_user;
161
-
162
- $timerStart = DUP_Util::GetMicrotime();
163
-
164
- $this->Archive->File = "{$this->NameHash}_archive.zip";
165
- $this->Installer->File = "{$this->NameHash}_installer.php";
166
- $this->Database->File = "{$this->NameHash}_database.sql";
167
- $this->WPUser = isset($current_user->user_login) ? $current_user->user_login : 'unknown';
168
-
169
- //START LOGGING
170
- DUP_Log::Open($this->NameHash);
171
- $php_max_time = @ini_get("max_execution_time");
172
- $php_max_memory = @ini_set('memory_limit', DUPLICATOR_PHP_MAX_MEMORY);
173
- $php_max_time = ($php_max_time == 0) ? "(0) no time limit imposed" : "[{$php_max_time}] not allowed";
174
- $php_max_memory = ($php_max_memory === false) ? "Unabled to set php memory_limit" : DUPLICATOR_PHP_MAX_MEMORY . " ({$php_max_memory} default)";
175
-
176
- $info = "********************************************************************************\n";
177
- $info .= "PACKAGE-LOG: " . @date("Y-m-d H:i:s") . "\n";
178
- $info .= "NOTICE: Do NOT post to public sites or forums \n";
179
- $info .= "********************************************************************************\n";
180
- $info .= "VERSION:\t" . DUPLICATOR_VERSION . "\n";
181
- $info .= "WORDPRESS:\t{$wp_version}\n";
182
- $info .= "PHP INFO:\t" . phpversion() . ' | ' . 'SAPI: ' . php_sapi_name() . "\n";
183
- $info .= "SERVER:\t\t{$_SERVER['SERVER_SOFTWARE']} \n";
184
- $info .= "PHP TIME LIMIT: {$php_max_time} \n";
185
- $info .= "PHP MAX MEMORY: {$php_max_memory} \n";
186
- $info .= "MEMORY STACK: " . DUP_Server::GetPHPMemory();
187
- DUP_Log::Info($info);
188
- $info = null;
189
-
190
- //CREATE DB RECORD
191
- $packageObj = serialize($this);
192
- if (! $packageObj) {
193
- DUP_Log::Error("Unable to serialize pacakge object while building record.");
194
- }
195
-
196
- $this->ID = $this->FindHashKey($this->Hash);
197
-
198
- if ($this->ID != 0){
199
- $this->SetStatus(DUP_PackageStatus::START);
200
- } else {
201
- $results = $wpdb->insert($wpdb->prefix . "duplicator_packages", array(
202
- 'name' => $this->Name,
203
- 'hash' => $this->Hash,
204
- 'status' => DUP_PackageStatus::START,
205
- 'created' => current_time('mysql', get_option('gmt_offset', 1)),
206
- 'owner' => isset($current_user->user_login) ? $current_user->user_login : 'unknown',
207
- 'package' => $packageObj)
208
- );
209
- if ($results == false) {
210
- $error_result = $wpdb->print_error();
211
- DUP_Log::Error("Duplicator is unable to insert a package record into the database table.", "'{$error_result}'");
212
- }
213
- $this->ID = $wpdb->insert_id;
214
- }
215
-
216
- //START BUILD
217
- //PHPs serialze method will return the object, but the ID above is not passed
218
- //for one reason or another so passing the object back in seems to do the trick
219
- $this->Database->Build($this);
220
- $this->Archive->Build($this);
221
- $this->Installer->Build($this);
222
-
223
-
224
- //INTEGRITY CHECKS
225
- DUP_Log::Info("\n********************************************************************************");
226
- DUP_Log::Info("INTEGRITY CHECKS:");
227
- DUP_Log::Info("********************************************************************************");
228
- $dbSizeRead = DUP_Util::ByteSize($this->Database->Size);
229
- $zipSizeRead = DUP_Util::ByteSize($this->Archive->Size);
230
- $exeSizeRead = DUP_Util::ByteSize($this->Installer->Size);
231
-
232
- DUP_Log::Info("SQL File: {$dbSizeRead}");
233
- DUP_Log::Info("Installer File: {$exeSizeRead}");
234
- DUP_Log::Info("Archive File: {$zipSizeRead} ");
235
-
236
- if ( !($this->Archive->Size && $this->Database->Size && $this->Installer->Size)) {
237
- DUP_Log::Error("A required file contains zero bytes.", "Archive Size: {$zipSizeRead} | SQL Size: {$dbSizeRead} | Installer Size: {$exeSizeRead}");
238
- }
239
-
240
- //Validate SQL files completed
241
- $sql_tmp_path = DUP_UTIL::SafePath(DUPLICATOR_SSDIR_PATH_TMP . '/'. $this->Database->File);
242
- $sql_complete_txt = DUP_Util::TailFile($sql_tmp_path, 3);
243
- if (! strstr($sql_complete_txt, 'DUPLICATOR_MYSQLDUMP_EOF')) {
244
- DUP_Log::Error("ERROR: SQL file not complete. The end of file marker was not found. Please try to re-create the package.");
245
- }
246
-
247
- $timerEnd = DUP_Util::GetMicrotime();
248
- $timerSum = DUP_Util::ElapsedTime($timerEnd, $timerStart);
249
-
250
- $this->Runtime = $timerSum;
251
- $this->ExeSize = $exeSizeRead;
252
- $this->ZipSize = $zipSizeRead;
253
-
254
- $this->buildCleanup();
255
-
256
- //FINAL REPORT
257
- $info = "\n********************************************************************************\n";
258
- $info .= "RECORD ID:[{$this->ID}]\n";
259
- $info .= "TOTAL PROCESS RUNTIME: {$timerSum}\n";
260
- $info .= "PEAK PHP MEMORY USED: " . DUP_Server::GetPHPMemory(true) . "\n";
261
- $info .= "DONE PROCESSING => {$this->Name} " . @date("Y-m-d H:i:s") . "\n";
262
-
263
- DUP_Log::Info($info);
264
- DUP_Log::Close();
265
-
266
- $this->SetStatus(DUP_PackageStatus::COMPLETE);
267
- return $this;
268
- }
269
-
270
- /**
271
- * Saves the active options associted with the active(latest) package.
272
- * @param $_POST $post The Post server object
273
- * @see DUP_Package::GetActive
274
- * @return void */
275
- public function SaveActive($post = null) {
276
-
277
- if (isset($post)) {
278
- $post = stripslashes_deep($post);
279
-
280
- $name_chars = array(".", "-");
281
- $name = ( isset($post['package-name']) && ! empty($post['package-name'])) ? $post['package-name'] : self::GetDefaultName();
282
- $name = substr(sanitize_file_name($name), 0 , 40);
283
- $name = str_replace($name_chars, '', $name);
284
-
285
- $filter_dirs = isset($post['filter-dirs']) ? $this->parseDirectoryFilter($post['filter-dirs']) : '';
286
- $filter_exts = isset($post['filter-exts']) ? $this->parseExtensionFilter($post['filter-exts']) : '';
287
- $tablelist = isset($post['dbtables']) ? implode(',', $post['dbtables']) : '';
288
- $compatlist = isset($post['dbcompat']) ? implode(',', $post['dbcompat']) : '';
289
-
290
- //PACKAGE
291
- $this->Version = DUPLICATOR_VERSION;
292
- $this->Name = $name;
293
- $this->Hash = $post['package-hash'];
294
- $this->NameHash = "{$this->Name}_{$this->Hash}";;
295
- $this->Notes = esc_html($post['package-notes']);
296
- //ARCHIVE
297
- $this->Archive->PackDir = rtrim(DUPLICATOR_WPROOTPATH, '/');
298
- $this->Archive->Format = 'ZIP';
299
- $this->Archive->FilterOn = isset($post['filter-on']) ? 1 : 0;
300
- $this->Archive->FilterDirs = esc_html($filter_dirs);
301
- $this->Archive->FilterExts = str_replace(array('.' ,' '), "", esc_html($filter_exts));
302
- //INSTALLER
303
- $this->Installer->OptsDBHost = esc_html($post['dbhost']);
304
- $this->Installer->OptsDBPort = esc_html($post['dbport']);
305
- $this->Installer->OptsDBName = esc_html($post['dbname']);
306
- $this->Installer->OptsDBUser = esc_html($post['dbuser']);
307
- $this->Installer->OptsSSLAdmin = isset($post['ssl-admin']) ? 1 : 0;
308
- $this->Installer->OptsSSLLogin = isset($post['ssl-login']) ? 1 : 0;
309
- $this->Installer->OptsCacheWP = isset($post['cache-wp']) ? 1 : 0;
310
- $this->Installer->OptsCachePath = isset($post['cache-path']) ? 1 : 0;
311
- $this->Installer->OptsURLNew = esc_html($post['url-new']);
312
- //DATABASE
313
- $this->Database->FilterOn = isset($post['dbfilter-on']) ? 1 : 0;
314
- $this->Database->FilterTables = esc_html($tablelist);
315
- $this->Database->Compatible = $compatlist;
316
-
317
- update_option(self::OPT_ACTIVE, $this);
318
- }
319
- }
320
-
321
- /**
322
- * Save any property of this class through reflection
323
- * @param $property A valid public property in this class
324
- * @param $value The value for the new dynamic property
325
- * @return void */
326
- public function SaveActiveItem($property, $value) {
327
- $package = self::GetActive();
328
-
329
- $reflectionClass = new ReflectionClass($package);
330
- $reflectionClass->getProperty($property)->setValue($package, $value);
331
- update_option(self::OPT_ACTIVE, $package);
332
- }
333
-
334
- /**
335
- * Sets the status to log the state of the build
336
- * @param $status The status level for where the package is
337
- * @return void */
338
- public function SetStatus($status) {
339
- global $wpdb;
340
-
341
- $packageObj = serialize($this);
342
-
343
- if (! isset($status)) {
344
- DUP_Log::Error("Package SetStatus did not receive a proper code.");
345
- }
346
-
347
- if (! $packageObj) {
348
- DUP_Log::Error("Package SetStatus was unable to serialize package object while updating record.");
349
- }
350
-
351
- $wpdb->flush();
352
- $table = $wpdb->prefix . "duplicator_packages";
353
- $sql = "UPDATE `{$table}` SET status = {$status}, package = '{$packageObj}' WHERE ID = {$this->ID}";
354
- $wpdb->query($sql);
355
- }
356
-
357
- /**
358
- * Does a hash already exisit
359
- * @return int Returns 0 if no has is found, if found returns the table ID
360
- */
361
- public function FindHashKey($hash) {
362
-
363
- global $wpdb;
364
-
365
- $table = $wpdb->prefix . "duplicator_packages";
366
- $qry = $wpdb->get_row("SELECT ID, hash FROM `{$table}` WHERE hash = '{$hash}'" );
367
- if ( strlen($qry->hash) == 0) {
368
- return 0;
369
- } else {
370
- return $qry->ID;
371
- }
372
-
373
- }
374
-
375
- /**
376
- * Makes the hashkey for the package files
377
- * @return string A unique hashkey */
378
- public function MakeHash() {
379
- return uniqid() . mt_rand(1000, 9999) . date("ymdHis");
380
- }
381
-
382
- /**
383
- * Gets the active package. The active package is defined as the package that was lasted saved.
384
- * Do to cache issues with the built in WP function get_option moved call to a direct DB call.
385
- * @see DUP_Package::SaveActive
386
- * @return DUP_Package
387
- */
388
- public static function GetActive() {
389
-
390
- global $wpdb;
391
- $obj = new DUP_Package();
392
- $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM `{$wpdb->options}` WHERE option_name = %s LIMIT 1", self::OPT_ACTIVE ) );
393
- if (is_object($row)) {
394
- $obj = @unserialize($row->option_value);
395
- }
396
- //Incase unserilaize fails
397
- $obj = (is_object($obj)) ? $obj : new DUP_Package();
398
- return $obj;
399
- }
400
-
401
- /**
402
- * Gets the Package by ID
403
- * @see DUP_Package::GetByID
404
- * @return DUP_Package
405
- */
406
- public static function GetByID($id) {
407
-
408
- global $wpdb;
409
- $obj = new DUP_Package();
410
-
411
- $row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM `{$wpdb->prefix}duplicator_packages` WHERE ID = %s", $id ) );
412
- if (is_object($row)) {
413
- $obj = @unserialize($row->package);
414
- $obj->Status = $row->status;
415
- }
416
- //Incase unserilaize fails
417
- $obj = (is_object($obj)) ? $obj : null;
418
- return $obj;
419
- }
420
-
421
- /**
422
- * Creates a default name
423
- * @return string A default packagename
424
- */
425
- public static function GetDefaultName() {
426
- //Remove specail_chars from final result
427
- $special_chars = array(".", "-");
428
- $name = date('Ymd') . '_' . sanitize_title(get_bloginfo( 'name', 'display' ));
429
- $name = substr(sanitize_file_name($name), 0 , 40);
430
- $name = str_replace($special_chars, '', $name);
431
- return $name;
432
-
433
- }
434
-
435
- /**
436
- * Cleanup all tmp files
437
- * @param all empty all contents
438
- * @return void
439
- */
440
- public static function TmpCleanup($all = false) {
441
-
442
- //Delete all files now
443
- if ($all){
444
- $dir = DUPLICATOR_SSDIR_PATH_TMP . "/*";
445
- foreach (glob($dir) as $file) {
446
- unlink($file);
447
- }
448
- }
449
- //Remove scan files that are 24 hours old
450
- else {
451
- $dir = DUPLICATOR_SSDIR_PATH_TMP . "/*_scan.json";
452
- foreach (glob($dir) as $file) {
453
- if (filemtime($file) <= time() - 86400) {
454
- unlink($file);
455
- }
456
- }
457
- }
458
- }
459
-
460
- private function buildCleanup() {
461
-
462
- $files = DUP_Util::ListFiles(DUPLICATOR_SSDIR_PATH_TMP);
463
- $newPath = DUPLICATOR_SSDIR_PATH;
464
-
465
- if (function_exists('rename')) {
466
- foreach($files as $file){
467
- $name = basename($file);
468
- if (strstr($name, $this->NameHash)) {
469
- rename($file,"{$newPath}/{$name}");
470
- }
471
- }
472
- } else {
473
- foreach($files as $file){
474
- $name = basename($file);
475
- if (strstr($name, $this->NameHash)) {
476
- copy($file,"{$newPath}/{$name}");
477
- unlink($file);
478
- }
479
- }
480
- }
481
- }
482
-
483
- private function parseDirectoryFilter($dirs = "") {
484
- $dirs = str_replace(array("\n", "\t", "\r"), '', $dirs);
485
- $filter_dirs = "";
486
- $dir_array = array_unique(explode(";", $dirs));
487
- foreach ($dir_array as $val) {
488
- if (strlen($val) >= 2) {
489
- $filter_dirs .= DUP_Util::SafePath(trim(rtrim($val, "/\\"))) . ";";
490
- }
491
- }
492
- return $filter_dirs;
493
- }
494
-
495
- private function parseExtensionFilter($extensions = "") {
496
- $filter_exts = "";
497
- if (strlen($extensions) >= 1 && $extensions != ";") {
498
- $filter_exts = str_replace(array(' ', '.'), '', $extensions);
499
- $filter_exts = str_replace(",", ";", $filter_exts);
500
- $filter_exts = DUP_Util::StringAppend($extensions, ";");
501
- }
502
- return $filter_exts;
503
- }
504
-
505
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
506
  ?>
1
+ <?php
2
+ if ( ! defined( 'DUPLICATOR_VERSION' ) ) exit; // Exit if accessed directly
3
+
4
+ require_once (DUPLICATOR_PLUGIN_PATH . 'classes/package.archive.php');
5
+ require_once (DUPLICATOR_PLUGIN_PATH . 'classes/package.installer.php');
6
+ require_once (DUPLICATOR_PLUGIN_PATH . 'classes/package.database.php');
7
+ require_once (DUPLICATOR_PLUGIN_PATH . 'classes/utility.php');
8
+
9
+ final class DUP_PackageStatus {
10
+ private function __construct() {}
11
+ const START = 10;
12
+ const DBSTART = 20;
13
+ const DBDONE = 30;
14
+ const ARCSTART = 40;
15
+ const ARCDONE = 50;
16
+ const COMPLETE = 100;
17
+ }
18
+
19
+ final class DUP_PackageType {
20
+ private function __construct() {}
21
+ const MANUAL = 0;
22
+ const SCHEDULED = 1;
23
+ }
24
+
25
+ /**
26
+ * Class used to store and process all Package logic
27
+ * @package Dupicator\classes
28
+ */
29
+ class DUP_Package {
30
+
31
+ const OPT_ACTIVE = 'duplicator_package_active';
32
+
33
+ //Properties
34
+ public $ID;
35
+ public $Name;
36
+ public $Hash;
37
+ public $NameHash;
38
+ public $Version;
39
+ public $VersionWP;
40
+ public $VersionDB;
41
+ public $VersionPHP;
42
+ public $Type;
43
+ public $Notes;
44
+ public $StorePath;
45
+ public $StoreURL;
46
+ public $ScanFile;
47
+ public $Runtime;
48
+ public $ExeSize;
49
+ public $ZipSize;
50
+ public $Status;
51
+ public $WPUser;
52
+ //Objects
53
+ public $Archive;
54
+ public $Installer;
55
+ public $Database;
56
+
57
+ /**
58
+ * Manages the Package Process
59
+ */
60
+ function __construct() {
61
+
62
+ $this->ID = null;
63
+ $this->Version = DUPLICATOR_VERSION;
64
+
65
+ $this->Type = DUP_PackageType::MANUAL;
66
+ $this->Name = self::GetDefaultName();
67
+ $this->Notes = null;
68
+ $this->StoreURL = DUP_Util::SSDirURL();
69
+ $this->StorePath = DUPLICATOR_SSDIR_PATH_TMP;
70
+ $this->Database = new DUP_Database($this);
71
+ $this->Archive = new DUP_Archive($this);
72
+ $this->Installer = new DUP_Installer($this);
73
+
74
+ }
75
+
76
+ /**
77
+ * Generates a scan report
78
+ * @return array of scan results
79
+ */
80
+ public function Scan() {
81
+
82
+ $timerStart = DUP_Util::GetMicrotime();
83
+ $report = array();
84
+ $this->ScanFile = "{$this->NameHash}_scan.json";
85
+
86
+ $report['RPT']['ScanTime'] = "0";
87
+ $report['RPT']['ScanFile'] = $this->ScanFile;
88
+
89
+ //SERVER
90
+ $srv = DUP_Server::GetChecks();
91
+ $report['SRV']['WEB']['ALL'] = $srv['SRV']['WEB']['ALL'];
92
+ $report['SRV']['WEB']['model'] = $srv['SRV']['WEB']['model'];
93
+
94
+ $report['SRV']['PHP']['ALL'] = $srv['SRV']['PHP']['ALL'];
95
+ $report['SRV']['PHP']['openbase'] = $srv['SRV']['PHP']['openbase'];
96
+ $report['SRV']['PHP']['maxtime'] = $srv['SRV']['PHP']['maxtime'];
97
+ $report['SRV']['PHP']['mysqli'] = $srv['SRV']['PHP']['mysqli'];
98
+
99
+ $report['SRV']['WP']['ALL'] = $srv['SRV']['WP']['ALL'];
100
+ $report['SRV']['WP']['version'] = $srv['SRV']['WP']['version'];
101
+ $report['SRV']['WP']['core'] = $srv['SRV']['WP']['core'];
102
+ $report['SRV']['WP']['cache'] = $srv['SRV']['WP']['cache'];
103
+
104
+ //FILES
105
+ $this->Archive->Stats();
106
+ $dirCount = count($this->Archive->Dirs);
107
+ $fileCount = count($this->Archive->Files);
108
+ $fullCount = $dirCount + $fileCount;
109
+
110
+ $report['ARC']['Size'] = DUP_Util::ByteSize($this->Archive->Size) or "unknown";
111
+ $report['ARC']['DirCount'] = number_format($dirCount);
112
+ $report['ARC']['FileCount'] = number_format($fileCount);
113
+ $report['ARC']['FullCount'] = number_format($fullCount);
114
+
115
+ $report['ARC']['FilterInfo']['Dirs'] = $this->Archive->FilterInfo->Dirs;
116
+ $report['ARC']['FilterInfo']['Files'] = $this->Archive->FilterInfo->Files;
117
+ $report['ARC']['FilterInfo']['Exts'] = $this->Archive->FilterInfo->Exts;
118
+
119
+ $report['ARC']['Status']['Size'] = ($this->Archive->Size > DUPLICATOR_SCAN_SITE) ? 'Warn' : 'Good';
120
+ $report['ARC']['Status']['Names'] = (count($this->Archive->FilterInfo->Files->Warning) + count($this->Archive->FilterInfo->Dirs->Warning)) ? 'Warn' : 'Good';
121
+ $report['ARC']['Status']['Big'] = count($this->Archive->FilterInfo->Files->Size) ? 'Warn' : 'Good';
122
+
123
+ $report['ARC']['Dirs'] = $this->Archive->Dirs;
124
+ $report['ARC']['Files'] = $this->Archive->Files;
125
+
126
+
127
+ //DATABASE
128
+ $db = $this->Database->Stats();
129
+ $report['DB']['Status'] = $db['Status'];
130
+ $report['DB']['Size'] = DUP_Util::ByteSize($db['Size']) or "unknown";
131
+ $report['DB']['Rows'] = number_format($db['Rows']) or "unknown";
132
+ $report['DB']['TableCount'] = $db['TableCount'] or "unknown";
133
+ $report['DB']['TableList'] = $db['TableList'] or "unknown";
134
+
135
+ $warnings = array($report['SRV']['WEB']['ALL'],
136
+ $report['SRV']['PHP']['ALL'],
137
+ $report['SRV']['WP']['ALL'],
138
+ $report['ARC']['Status']['Size'],
139
+ $report['ARC']['Status']['Names'],
140
+ $report['ARC']['Status']['Big'],
141
+ $db['Status']['Size'],
142
+ $db['Status']['Rows']);
143
+
144
+ $warn_counts = array_count_values($warnings);
145
+
146
+ $report['RPT']['Warnings'] = $warn_counts['Warn'];
147
+ $report['RPT']['Success'] = $warn_counts['Good'];
148
+ $report['RPT']['ScanTime'] = DUP_Util::ElapsedTime(DUP_Util::GetMicrotime(), $timerStart);
149
+ $fp = fopen(DUPLICATOR_SSDIR_PATH_TMP . "/{$this->ScanFile}", 'w');
150
+ fwrite($fp, json_encode($report));
151
+ fclose($fp);
152
+
153
+ return $report;
154
+ }
155
+
156
+ /**
157
+ * Starts the package build process
158
+ * @return DUP_Package
159
+ */
160
+ public function Build() {
161
+
162
+ global $wp_version;
163
+ global $wpdb;
164
+ global $current_user;
165
+
166
+ $timerStart = DUP_Util::GetMicrotime();
167
+
168
+ $this->Archive->File = "{$this->NameHash}_archive.zip";
169
+ $this->Installer->File = "{$this->NameHash}_installer.php";
170
+ $this->Database->File = "{$this->NameHash}_database.sql";
171
+ $this->WPUser = isset($current_user->user_login) ? $current_user->user_login : 'unknown';
172
+
173
+ //START LOGGING
174
+ DUP_Log::Open($this->NameHash);
175
+ $php_max_time = @ini_get("max_execution_time");
176
+ $php_max_memory = @ini_set('memory_limit', DUPLICATOR_PHP_MAX_MEMORY);
177
+ $php_max_time = ($php_max_time == 0) ? "(0) no time limit imposed" : "[{$php_max_time}] not allowed";
178
+ $php_max_memory = ($php_max_memory === false) ? "Unabled to set php memory_limit" : DUPLICATOR_PHP_MAX_MEMORY . " ({$php_max_memory} default)";
179
+
180
+ $info = "********************************************************************************\n";
181
+ $info .= "PACKAGE-LOG: " . @date("Y-m-d H:i:s") . "\n";
182
+ $info .= "NOTICE: Do NOT post to public sites or forums \n";
183
+ $info .= "********************************************************************************\n";
184
+ $info .= "VERSION:\t" . DUPLICATOR_VERSION . "\n";
185
+ $info .= "WORDPRESS:\t{$wp_version}\n";
186
+ $info .= "PHP INFO:\t" . phpversion() . ' | ' . 'SAPI: ' . php_sapi_name() . "\n";
187
+ $info .= "SERVER:\t\t{$_SERVER['SERVER_SOFTWARE']} \n";
188
+ $info .= "PHP TIME LIMIT: {$php_max_time} \n";
189
+ $info .= "PHP MAX MEMORY: {$php_max_memory} \n";
190
+ $info .= "MEMORY STACK: " . DUP_Server::GetPHPMemory();
191
+ DUP_Log::Info($info);
192
+ $info = null;
193
+
194
+ //CREATE DB RECORD
195
+ $packageObj = serialize($this);
196
+ if (! $packageObj) {
197
+ DUP_Log::Error("Unable to serialize pacakge object while building record.");
198
+ }
199
+
200
+ $this->ID = $this->FindHashKey($this->Hash);
201
+
202
+ if ($this->ID != 0){
203
+ $this->SetStatus(DUP_PackageStatus::START);
204
+ } else {
205
+ $results = $wpdb->insert($wpdb->prefix . "duplicator_packages", array(
206
+ 'name' => $this->Name,
207
+ 'hash' => $this->Hash,
208
+ 'status' => DUP_PackageStatus::START,
209
+ 'created' => current_time('mysql', get_option('gmt_offset', 1)),
210
+ 'owner' => isset($current_user->user_login) ? $current_user->user_login : 'unknown',
211
+ 'package' => $packageObj)
212
+ );
213
+ if ($results == false) {
214
+ $error_result = $wpdb->print_error();
215
+ DUP_Log::Error("Duplicator is unable to insert a package record into the database table.", "'{$error_result}'");
216
+ }
217
+ $this->ID = $wpdb->insert_id;
218
+ }
219
+
220
+ //START BUILD
221
+ //PHPs serialze method will return the object, but the ID above is not passed
222
+ //for one reason or another so passing the object back in seems to do the trick
223
+ $this->Database->Build($this);
224
+ $this->Archive->Build($this);
225
+ $this->Installer->Build($this);
226
+
227
+
228
+ //INTEGRITY CHECKS
229
+ DUP_Log::Info("\n********************************************************************************");
230
+ DUP_Log::Info("INTEGRITY CHECKS:");
231
+ DUP_Log::Info("********************************************************************************");
232
+ $dbSizeRead = DUP_Util::ByteSize($this->Database->Size);
233
+ $zipSizeRead = DUP_Util::ByteSize($this->Archive->Size);
234
+ $exeSizeRead = DUP_Util::ByteSize($this->Installer->Size);
235
+
236
+ DUP_Log::Info("SQL File: {$dbSizeRead}");
237
+ DUP_Log::Info("Installer File: {$exeSizeRead}");
238
+ DUP_Log::Info("Archive File: {$zipSizeRead} ");
239
+
240
+ if ( !($this->Archive->Size && $this->Database->Size && $this->Installer->Size)) {
241
+ DUP_Log::Error("A required file contains zero bytes.", "Archive Size: {$zipSizeRead} | SQL Size: {$dbSizeRead} | Installer Size: {$exeSizeRead}");
242
+ }
243
+
244
+ //Validate SQL files completed
245
+ $sql_tmp_path = DUP_UTIL::SafePath(DUPLICATOR_SSDIR_PATH_TMP . '/'. $this->Database->File);
246
+ $sql_complete_txt = DUP_Util::TailFile($sql_tmp_path, 3);
247
+ if (! strstr($sql_complete_txt, 'DUPLICATOR_MYSQLDUMP_EOF')) {
248
+ DUP_Log::Error("ERROR: SQL file not complete. The end of file marker was not found. Please try to re-create the package.");
249
+ }
250
+
251
+ $timerEnd = DUP_Util::GetMicrotime();
252
+ $timerSum = DUP_Util::ElapsedTime($timerEnd, $timerStart);
253
+
254
+ $this->Runtime = $timerSum;
255
+ $this->ExeSize = $exeSizeRead;
256
+ $this->ZipSize = $zipSizeRead;
257
+
258
+ $this->buildCleanup();
259
+
260
+ //FINAL REPORT
261
+ $info = "\n********************************************************************************\n";
262
+ $info .= "RECORD ID:[{$this->ID}]\n";
263
+ $info .= "TOTAL PROCESS RUNTIME: {$timerSum}\n";
264
+ $info .= "PEAK PHP MEMORY USED: " . DUP_Server::GetPHPMemory(true) . "\n";
265
+ $info .= "DONE PROCESSING => {$this->Name} " . @date("Y-m-d H:i:s") . "\n";
266
+
267
+ DUP_Log::Info($info);
268
+ DUP_Log::Close();
269
+
270
+ $this->SetStatus(DUP_PackageStatus::COMPLETE);
271
+ return $this;
272
+ }
273
+
274
+ /**
275
+ * Saves the active options associted with the active(latest) package.
276
+ * @param $_POST $post The Post server object
277
+ * @see DUP_Package::GetActive
278
+ * @return void */
279
+ public function SaveActive($post = null)
280
+ {
281
+ global $wp_version;
282
+
283
+ if (isset($post)) {
284
+ $post = stripslashes_deep($post);
285
+
286
+ $name_chars = array(".", "-");
287
+ $name = ( isset($post['package-name']) && ! empty($post['package-name'])) ? $post['package-name'] : self::GetDefaultName();
288
+ $name = substr(sanitize_file_name($name), 0 , 40);
289
+ $name = str_replace($name_chars, '', $name);
290
+
291
+ $filter_dirs = isset($post['filter-dirs']) ? $this->parseDirectoryFilter($post['filter-dirs']) : '';
292
+ $filter_exts = isset($post['filter-exts']) ? $this->parseExtensionFilter($post['filter-exts']) : '';
293
+ $tablelist = isset($post['dbtables']) ? implode(',', $post['dbtables']) : '';
294
+ $compatlist = isset($post['dbcompat']) ? implode(',', $post['dbcompat']) : '';
295
+ $dbversion = DUP_Util::MysqlVariableValue('version');
296
+ $dbversion = is_null($dbversion) ? '- unknown -' : $dbversion;
297
+
298
+ //PACKAGE
299
+ $this->Version = DUPLICATOR_VERSION;
300
+ $this->VersionWP = $wp_version;
301
+ $this->VersionPHP = phpversion();
302
+ $this->VersionDB = $dbversion;
303
+ $this->Name = $name;
304
+ $this->Hash = $this->MakeHash();// $post['package-hash'];
305
+ //RSR
306
+ //$this->Hash = $post['package-hash'];
307
+ $this->NameHash = "{$this->Name}_{$this->Hash}";;
308
+ $this->Notes = esc_html($post['package-notes']);
309
+ //ARCHIVE
310
+ $this->Archive->PackDir = rtrim(DUPLICATOR_WPROOTPATH, '/');
311
+ $this->Archive->Format = 'ZIP';
312
+ $this->Archive->FilterOn = isset($post['filter-on']) ? 1 : 0;
313
+ $this->Archive->FilterDirs = esc_html($filter_dirs);
314
+ $this->Archive->FilterExts = str_replace(array('.' ,' '), "", esc_html($filter_exts));
315
+ //INSTALLER
316
+ $this->Installer->OptsDBHost = esc_html($post['dbhost']);
317
+ $this->Installer->OptsDBPort = esc_html($post['dbport']);
318
+ $this->Installer->OptsDBName = esc_html($post['dbname']);
319
+ $this->Installer->OptsDBUser = esc_html($post['dbuser']);
320
+ $this->Installer->OptsSSLAdmin = isset($post['ssl-admin']) ? 1 : 0;
321
+ $this->Installer->OptsSSLLogin = isset($post['ssl-login']) ? 1 : 0;
322
+ $this->Installer->OptsCacheWP = isset($post['cache-wp']) ? 1 : 0;
323
+ $this->Installer->OptsCachePath = isset($post['cache-path']) ? 1 : 0;
324
+ $this->Installer->OptsURLNew = esc_html($post['url-new']);
325
+ //DATABASE
326
+ $this->Database->FilterOn = isset($post['dbfilter-on']) ? 1 : 0;
327
+ $this->Database->FilterTables = esc_html($tablelist);
328
+ $this->Database->Compatible = $compatlist;
329
+
330
+ update_option(self::OPT_ACTIVE, $this);
331
+ }
332
+ }
333
+
334
+ /**
335
+ * Save any property of this class through reflection
336
+ * @param $property A valid public property in this class
337
+ * @param $value The value for the new dynamic property
338
+ * @return void */
339
+ public function SaveActiveItem($property, $value) {
340
+ $package = self::GetActive();
341
+
342
+ $reflectionClass = new ReflectionClass($package);
343
+ $reflectionClass->getProperty($property)->setValue($package, $value);
344
+ update_option(self::OPT_ACTIVE, $package);
345
+ }
346
+
347
+ /**
348
+ * Sets the status to log the state of the build
349
+ * @param $status The status level for where the package is
350
+ * @return void */
351
+ public function SetStatus($status) {
352
+ global $wpdb;
353
+
354
+ $packageObj = serialize($this);
355
+
356
+ if (! isset($status)) {
357
+ DUP_Log::Error("Package SetStatus did not receive a proper code.");
358
+ }
359
+
360
+ if (! $packageObj) {
361
+ DUP_Log::Error("Package SetStatus was unable to serialize package object while updating record.");
362
+ }
363
+
364
+ $wpdb->flush();
365
+ $table = $wpdb->prefix . "duplicator_packages";
366
+ $sql = "UPDATE `{$table}` SET status = {$status}, package = '{$packageObj}' WHERE ID = {$this->ID}";
367
+ $wpdb->query($sql);
368
+ }
369
+
370
+ /**
371
+ * Does a hash already exisit
372
+ * @return int Returns 0 if no has is found, if found returns the table ID
373
+ */
374
+ public function FindHashKey($hash) {
375
+
376
+ global $wpdb;
377
+
378
+ $table = $wpdb->prefix . "duplicator_packages";
379
+ $qry = $wpdb->get_row("SELECT ID, hash FROM `{$table}` WHERE hash = '{$hash}'" );
380
+ if ( strlen($qry->hash) == 0) {
381
+ return 0;
382
+ } else {
383
+ return $qry->ID;
384
+ }
385
+
386
+ }
387
+
388
+ /**
389
+ * Makes the hashkey for the package files
390
+ * @return string A unique hashkey */
391
+ public function MakeHash() {
392
+ return uniqid() . mt_rand(1000, 9999) . date("ymdHis");
393
+ }
394
+
395
+ /**
396
+ * Gets the active package. The active package is defined as the package that was lasted saved.
397
+ * Do to cache issues with the built in WP function get_option moved call to a direct DB call.
398
+ * @see DUP_Package::SaveActive
399
+ * @return DUP_Package
400
+ */
401
+ public static function GetActive() {
402
+
403
+ global $wpdb;
404
+ $obj = new DUP_Package();
405
+ $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM `{$wpdb->options}` WHERE option_name = %s LIMIT 1", self::OPT_ACTIVE ) );
406
+ if (is_object($row)) {
407
+ $obj = @unserialize($row->option_value);
408
+ }
409
+ //Incase unserilaize fails
410
+ $obj = (is_object($obj)) ? $obj : new DUP_Package();
411
+ return $obj;
412
+ }
413
+
414
+ /**
415
+ * Gets the Package by ID
416
+ * @see DUP_Package::GetByID
417
+ * @return DUP_Package
418
+ */
419
+ public static function GetByID($id) {
420
+
421
+ global $wpdb;
422
+ $obj = new DUP_Package();
423
+
424
+ $row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM `{$wpdb->prefix}duplicator_packages` WHERE ID = %s", $id ) );
425
+ if (is_object($row)) {
426
+ $obj = @unserialize($row->package);
427
+ $obj->Status = $row->status;
428
+ }
429
+ //Incase unserilaize fails
430
+ $obj = (is_object($obj)) ? $obj : null;
431
+ return $obj;
432
+ }
433
+
434
+ /**
435
+ * Creates a default name
436
+ * @return string A default packagename
437
+ */
438
+ public static function GetDefaultName() {
439
+ //Remove specail_chars from final result
440
+ $special_chars = array(".", "-");
441
+ $name = date('Ymd') . '_' . sanitize_title(get_bloginfo( 'name', 'display' ));
442
+ $name = substr(sanitize_file_name($name), 0 , 40);
443
+ $name = str_replace($special_chars, '', $name);
444
+ return $name;
445
+
446
+ }
447
+
448
+ /**
449
+ * Cleanup all tmp files
450
+ * @param all empty all contents
451
+ * @return void
452
+ */
453
+ public static function TmpCleanup($all = false) {
454
+
455
+ //Delete all files now
456
+ if ($all){
457
+ $dir = DUPLICATOR_SSDIR_PATH_TMP . "/*";
458
+ foreach (glob($dir) as $file) {
459
+ unlink($file);
460
+ }
461
+ }
462
+ //Remove scan files that are 24 hours old
463
+ else {
464
+ $dir = DUPLICATOR_SSDIR_PATH_TMP . "/*_scan.json";
465
+ foreach (glob($dir) as $file) {
466
+ if (filemtime($file) <= time() - 86400) {
467
+ unlink($file);
468
+ }
469
+ }
470
+ }
471
+ }
472
+
473
+ private function buildCleanup() {
474
+
475
+ $files = DUP_Util::ListFiles(DUPLICATOR_SSDIR_PATH_TMP);
476
+ $newPath = DUPLICATOR_SSDIR_PATH;
477
+
478
+ if (function_exists('rename')) {
479
+ foreach($files as $file){
480
+ $name = basename($file);
481
+ if (strstr($name, $this->NameHash)) {
482
+ rename($file,"{$newPath}/{$name}");
483
+ }
484
+ }
485
+ } else {
486
+ foreach($files as $file){
487
+ $name = basename($file);
488
+ if (strstr($name, $this->NameHash)) {
489
+ copy($file,"{$newPath}/{$name}");
490
+ unlink($file);
491
+ }
492
+ }
493
+ }
494
+ }
495
+
496
+ private function parseDirectoryFilter($dirs = "") {
497
+ $dirs = str_replace(array("\n", "\t", "\r"), '', $dirs);
498
+ $filter_dirs = "";
499
+ $dir_array = array_unique(explode(";", $dirs));
500
+ foreach ($dir_array as $val) {
501
+ if (strlen($val) >= 2) {
502
+ $filter_dirs .= DUP_Util::SafePath(trim(rtrim($val, "/\\"))) . ";";
503
+ }
504
+ }
505
+ return $filter_dirs;
506
+ }
507
+
508
+ private function parseExtensionFilter($extensions = "") {
509
+ $filter_exts = "";
510
+ if (strlen($extensions) >= 1 && $extensions != ";") {
511
+ $filter_exts = str_replace(array(' ', '.'), '', $extensions);
512
+ $filter_exts = str_replace(",", ";", $filter_exts);
513
+ $filter_exts = DUP_Util::StringAppend($extensions, ";");
514
+ }
515
+ return $filter_exts;
516
+ }
517
+
518
+ }
519
  ?>
define.php CHANGED
@@ -3,7 +3,7 @@
3
  if (function_exists('plugin_dir_url')) {
4
 
5
 
6
- define('DUPLICATOR_VERSION', '1.1.2');
7
  define("DUPLICATOR_HOMEPAGE", "http://lifeinthegrid.com/labs/duplicator");
8
  define("DUPLICATOR_GIVELINK", "http://lifeinthegrid.com/partner");
9
  define("DUPLICATOR_HELPLINK", "http://lifeinthegrid.com/duplicator-docs");
3
  if (function_exists('plugin_dir_url')) {
4
 
5
 
6
+ define('DUPLICATOR_VERSION', '1.1.4');
7
  define("DUPLICATOR_HOMEPAGE", "http://lifeinthegrid.com/labs/duplicator");
8
  define("DUPLICATOR_GIVELINK", "http://lifeinthegrid.com/partner");
9
  define("DUPLICATOR_HELPLINK", "http://lifeinthegrid.com/duplicator-docs");
duplicator.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Duplicator
4
  Plugin URI: http://www.lifeinthegrid.com/duplicator/
5
  Description: Create a backup of your WordPress files and database. Duplicate and move an entire site from one location to another in a few steps. Create a full snapshot of your site at any point in time.
6
- Version: 1.1.2
7
  Author: LifeInTheGrid
8
  Author URI: http://www.lifeinthegrid.com
9
  Text Domain: duplicator
3
  Plugin Name: Duplicator
4
  Plugin URI: http://www.lifeinthegrid.com/duplicator/
5
  Description: Create a backup of your WordPress files and database. Duplicate and move an entire site from one location to another in a few steps. Create a full snapshot of your site at any point in time.
6
+ Version: 1.1.4
7
  Author: LifeInTheGrid
8
  Author URI: http://www.lifeinthegrid.com
9
  Text Domain: duplicator
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: corylamleorg, bobriley
3
  Donate link: www.lifeinthegrid.com/partner
4
  Tags: backup, restore, move, migrate, localhost, synchronize, duplicate, clone, automate, niche
5
  Requires at least: 3.9
6
- Tested up to: 4.4.1
7
- Stable tag: 1.1.2
8
  License: GPLv2
9
 
10
  Duplicate, clone, backup, move and transfer an entire site from one location to another.
3
  Donate link: www.lifeinthegrid.com/partner
4
  Tags: backup, restore, move, migrate, localhost, synchronize, duplicate, clone, automate, niche
5
  Requires at least: 3.9
6
+ Tested up to: 4.4.2
7
+ Stable tag: 1.1.4
8
  License: GPLv2
9
 
10
  Duplicate, clone, backup, move and transfer an entire site from one location to another.
views/actions.php CHANGED
@@ -1,142 +1,145 @@
1
- <?php
2
-
3
- /**
4
- * DUPLICATOR_PACKAGE_SCAN
5
- * Returns a json scan report object which contains data about the system
6
- *
7
- * @return json json report object
8
- * @example to test: /wp-admin/admin-ajax.php?action=duplicator_package_scan
9
- */
10
- function duplicator_package_scan() {
11
-
12
- header('Content-Type: application/json;');
13
- DUP_Util::CheckPermissions('export');
14
-
15
- @set_time_limit(0);
16
- $errLevel = error_reporting();
17
- error_reporting(E_ERROR);
18
- DUP_Util::InitSnapshotDirectory();
19
-
20
- $Package = DUP_Package::GetActive();
21
- $report = $Package->Scan();
22
-
23
- $Package->SaveActiveItem('ScanFile', $Package->ScanFile);
24
- $json_response = json_encode($report);
25
-
26
- DUP_Package::TmpCleanup();
27
- error_reporting($errLevel);
28
- die($json_response);
29
- }
30
-
31
- /**
32
- * duplicator_package_build
33
- * Returns the package result status
34
- *
35
- * @return json json object of package results
36
- */
37
- function duplicator_package_build() {
38
-
39
- header('Content-Type: application/json');
40
- DUP_Util::CheckPermissions('export');
41
-
42
- @set_time_limit(0);
43
- $errLevel = error_reporting();
44
- error_reporting(E_ERROR);
45
- DUP_Util::InitSnapshotDirectory();
46
-
47
- $Package = DUP_Package::GetActive();
48
-
49
- if (!is_readable(DUPLICATOR_SSDIR_PATH_TMP . "/{$Package->ScanFile}")) {
50
- die("The scan result file was not found. Please run the scan step before building the package.");
51
- }
52
-
53
- $Package->Build();
54
-
55
- //JSON:Debug Response
56
- //Pass = 1, Warn = 2, Fail = 3
57
- $json = array();
58
- $json['Status'] = 1;
59
- $json['Package'] = $Package;
60
- $json['Runtime'] = $Package->Runtime;
61
- $json['ExeSize'] = $Package->ExeSize;
62
- $json['ZipSize'] = $Package->ZipSize;
63
- $json_response = json_encode($json);
64
-
65
- error_reporting($errLevel);
66
- die($json_response);
67
- }
68
-
69
- /**
70
- * DUPLICATOR_PACKAGE_DELETE
71
- * Deletes the files and database record entries
72
- *
73
- * @return json A json message about the action.
74
- * Use console.log to debug from client
75
- */
76
- function duplicator_package_delete() {
77
-
78
- DUP_Util::CheckPermissions('export');
79
- check_ajax_referer( 'package_list', 'nonce' );
80
-
81
- try {
82
- global $wpdb;
83
- $json = array();
84
- $post = stripslashes_deep($_POST);
85
- $tblName = $wpdb->prefix . 'duplicator_packages';
86
- $postIDs = isset($post['duplicator_delid']) ? $post['duplicator_delid'] : null;
87
- $list = explode(",", $postIDs);
88
- $delCount = 0;
89
-
90
- if ($postIDs != null) {
91
-
92
- foreach ($list as $id) {
93
-
94
- $getResult = $wpdb->get_results($wpdb->prepare("SELECT name, hash FROM `{$tblName}` WHERE id = %d", $id), ARRAY_A);
95
-
96
- if ($getResult) {
97
- $row = $getResult[0];
98
- $nameHash = "{$row['name']}_{$row['hash']}";
99
- $delResult = $wpdb->query($wpdb->prepare( "DELETE FROM `{$tblName}` WHERE id = %d", $id ));
100
- if ($delResult != 0) {
101
- //Perms
102
- @chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_archive.zip"), 0644);
103
- @chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_database.sql"), 0644);
104
- @chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_installer.php"), 0644);
105
- @chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_archive.zip"), 0644);
106
- @chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_database.sql"), 0644);
107
- @chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_installer.php"), 0644);
108
- @chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_scan.json"), 0644);
109
- @chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}.log"), 0644);
110
- //Remove
111
- @unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_archive.zip"));
112
- @unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_database.sql"));
113
- @unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_installer.php"));
114
- @unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_archive.zip"));
115
- @unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_database.sql"));
116
- @unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_installer.php"));
117
- @unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_scan.json"));
118
- @unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}.log"));
119
- //Unfinished Zip files
120
- $tmpZip = DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_archive.zip.*";
121
- if ($tmpZip !== false) {
122
- array_map('unlink', glob($tmpZip));
123
- }
124
- @unlink(DUP_Util::SafePath());
125
- $delCount++;
126
- }
127
- }
128
- }
129
- }
130
-
131
- } catch (Exception $e) {
132
- $json['error'] = "{$e}";
133
- die(json_encode($json));
134
- }
135
-
136
- $json['ids'] = "{$postIDs}";
137
- $json['removed'] = $delCount;
138
- die(json_encode($json));
139
- }
140
-
141
- //DO NOT ADD A CARRIAGE RETURN BEYOND THIS POINT (headers issue)!!
 
 
 
142
  ?>
1
+ <?php
2
+
3
+ /**
4
+ * DUPLICATOR_PACKAGE_SCAN
5
+ * Returns a json scan report object which contains data about the system
6
+ *
7
+ * @return json json report object
8
+ * @example to test: /wp-admin/admin-ajax.php?action=duplicator_package_scan
9
+ */
10
+ function duplicator_package_scan() {
11
+
12
+ header('Content-Type: application/json;');
13
+ DUP_Util::CheckPermissions('export');
14
+
15
+ @set_time_limit(0);
16
+ $errLevel = error_reporting();
17
+ error_reporting(E_ERROR);
18
+ DUP_Util::InitSnapshotDirectory();
19
+
20
+ $Package = DUP_Package::GetActive();
21
+ $report = $Package->Scan();
22
+
23
+ $Package->SaveActiveItem('ScanFile', $Package->ScanFile);
24
+ $json_response = json_encode($report);
25
+
26
+ DUP_Package::TmpCleanup();
27
+ error_reporting($errLevel);
28
+ die($json_response);
29
+ }
30
+
31
+ /**
32
+ * duplicator_package_build
33
+ * Returns the package result status
34
+ *
35
+ * @return json json object of package results
36
+ */
37
+ function duplicator_package_build() {
38
+
39
+ DUP_Util::CheckPermissions('export');
40
+
41
+ check_ajax_referer( 'dup_package_build', 'nonce');
42
+
43
+ header('Content-Type: application/json');
44
+
45
+ @set_time_limit(0);
46
+ $errLevel = error_reporting();
47
+ error_reporting(E_ERROR);
48
+ DUP_Util::InitSnapshotDirectory();
49
+
50
+ $Package = DUP_Package::GetActive();
51
+
52
+ if (!is_readable(DUPLICATOR_SSDIR_PATH_TMP . "/{$Package->ScanFile}")) {
53
+ die("The scan result file was not found. Please run the scan step before building the package.");
54
+ }
55
+
56
+ $Package->Build();
57
+
58
+ //JSON:Debug Response
59
+ //Pass = 1, Warn = 2, Fail = 3
60
+ $json = array();
61
+ $json['Status'] = 1;
62
+ $json['Package'] = $Package;
63
+ $json['Runtime'] = $Package->Runtime;
64
+ $json['ExeSize'] = $Package->ExeSize;
65
+ $json['ZipSize'] = $Package->ZipSize;
66
+ $json_response = json_encode($json);
67
+
68
+ error_reporting($errLevel);
69
+ die($json_response);
70
+ }
71
+
72
+ /**
73
+ * DUPLICATOR_PACKAGE_DELETE
74
+ * Deletes the files and database record entries
75
+ *
76
+ * @return json A json message about the action.
77
+ * Use console.log to debug from client
78
+ */
79
+ function duplicator_package_delete() {
80
+
81
+ DUP_Util::CheckPermissions('export');
82
+ check_ajax_referer( 'package_list', 'nonce' );
83
+
84
+ try {
85
+ global $wpdb;
86
+ $json = array();
87
+ $post = stripslashes_deep($_POST);
88
+ $tblName = $wpdb->prefix . 'duplicator_packages';
89
+ $postIDs = isset($post['duplicator_delid']) ? $post['duplicator_delid'] : null;
90
+ $list = explode(",", $postIDs);
91
+ $delCount = 0;
92
+
93
+ if ($postIDs != null) {
94
+
95
+ foreach ($list as $id) {
96
+
97
+ $getResult = $wpdb->get_results($wpdb->prepare("SELECT name, hash FROM `{$tblName}` WHERE id = %d", $id), ARRAY_A);
98
+
99
+ if ($getResult) {
100
+ $row = $getResult[0];
101
+ $nameHash = "{$row['name']}_{$row['hash']}";
102
+ $delResult = $wpdb->query($wpdb->prepare( "DELETE FROM `{$tblName}` WHERE id = %d", $id ));
103
+ if ($delResult != 0) {
104
+ //Perms
105
+ @chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_archive.zip"), 0644);
106
+ @chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_database.sql"), 0644);
107
+ @chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_installer.php"), 0644);
108
+ @chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_archive.zip"), 0644);
109
+ @chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_database.sql"), 0644);
110
+ @chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_installer.php"), 0644);
111
+ @chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_scan.json"), 0644);
112
+ @chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}.log"), 0644);
113
+ //Remove
114
+ @unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_archive.zip"));
115
+ @unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_database.sql"));
116
+ @unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_installer.php"));
117
+ @unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_archive.zip"));
118
+ @unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_database.sql"));
119
+ @unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_installer.php"));
120
+ @unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_scan.json"));
121
+ @unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}.log"));
122
+ //Unfinished Zip files
123
+ $tmpZip = DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_archive.zip.*";
124
+ if ($tmpZip !== false) {
125
+ array_map('unlink', glob($tmpZip));
126
+ }
127
+ @unlink(DUP_Util::SafePath());
128
+ $delCount++;
129
+ }
130
+ }
131
+ }
132
+ }
133
+
134
+ } catch (Exception $e) {
135
+ $json['error'] = "{$e}";
136
+ die(json_encode($json));
137
+ }
138
+
139
+ $json['ids'] = "{$postIDs}";
140
+ $json['removed'] = $delCount;
141
+ die(json_encode($json));
142
+ }
143
+
144
+ //DO NOT ADD A CARRIAGE RETURN BEYOND THIS POINT (headers issue)!!
145
  ?>
views/packages/details/detail.php CHANGED
@@ -40,7 +40,7 @@ $dbbuild_mode = ($mysqldump_on) ? 'mysqldump (fast)' : 'PHP (slow)';
40
  div.dup-store-pro a {text-decoration: underline}
41
 
42
  /*GENERAL*/
43
- div#dup-name-info {display: none; font-size:11px; line-height:20px; margin:4px 0 0 0}
44
  div#dup-downloads-area {padding: 5px 0 5px 0; }
45
  div#dup-downloads-msg {margin-bottom:-5px; font-style: italic}
46
  </style>
@@ -78,10 +78,16 @@ GENERAL -->
78
  <td><?php DUP_Util::_e("Notes") ?>:</td>
79
  <td><?php echo strlen($package->Notes) ? $package->Notes : DUP_Util::__("- no notes -") ?></td>
80
  </tr>
81
-
82
  <tr>
83
- <td><?php DUP_Util::_e("Version") ?>:</td>
84
- <td><?php echo $package->Version ?></td>
 
 
 
 
 
 
 
85
  </tr>
86
  <tr>
87
  <td><?php DUP_Util::_e("Runtime") ?>:</td>
40
  div.dup-store-pro a {text-decoration: underline}
41
 
42
  /*GENERAL*/
43
+ div#dup-name-info, div#dup-version-info {display: none; font-size:11px; line-height:20px; margin:4px 0 0 0}
44
  div#dup-downloads-area {padding: 5px 0 5px 0; }
45
  div#dup-downloads-msg {margin-bottom:-5px; font-style: italic}
46
  </style>
78
  <td><?php DUP_Util::_e("Notes") ?>:</td>
79
  <td><?php echo strlen($package->Notes) ? $package->Notes : DUP_Util::__("- no notes -") ?></td>
80
  </tr>
 
81
  <tr>
82
+ <td><?php DUP_Util::_e("Versions") ?>:</td>
83
+ <td>
84
+ <a href="javascript:void(0);" onclick="jQuery('#dup-version-info').toggle()"><?php echo $package->Version ?></a>
85
+ <div id="dup-version-info">
86
+ <b><?php DUP_Util::_e("WordPress") ?>:</b> <?php echo strlen($package->VersionWP) ? $package->VersionWP : DUP_Util::__("- unknown -") ?><br/>
87
+ <b><?php DUP_Util::_e("Mysql") ?>:</b> <?php echo strlen($package->VersionDB) ? $package->VersionDB : DUP_Util::__("- unknown -") ?><br/>
88
+ <b><?php DUP_Util::_e("PHP") ?>:</b> <?php echo strlen($package->VersionPHP) ? $package->VersionPHP : DUP_Util::__("- unknown -") ?><br/>
89
+ </div>
90
+ </td>
91
  </tr>
92
  <tr>
93
  <td><?php DUP_Util::_e("Runtime") ?>:</td>
views/packages/main/new1.base.php CHANGED
@@ -18,7 +18,7 @@ if (isset($_POST['action']))
18
  DUP_Util::InitSnapshotDirectory();
19
 
20
  $Package = DUP_Package::GetActive();
21
- $package_hash = $Package->MakeHash();
22
 
23
  $dup_tests = array();
24
  $dup_tests = DUP_Server::GetRequirements();
18
  DUP_Util::InitSnapshotDirectory();
19
 
20
  $Package = DUP_Package::GetActive();
21
+ //RSR REMOVED $package_hash = $Package->MakeHash();
22
 
23
  $dup_tests = array();
24
  $dup_tests = DUP_Server::GetRequirements();
views/packages/main/new1.inc.form.php CHANGED
@@ -39,7 +39,8 @@
39
 
40
  <form id="dup-form-opts" method="post" action="?page=duplicator&tab=new2" data-validate="parsley">
41
  <input type="hidden" id="dup-form-opts-action" name="action" value="">
42
- <input type="hidden" id="dup-form-opts-hash" name="package-hash" value="<?php echo $package_hash; ?>">
 
43
  <div>
44
  <label for="package-name"><b><?php _e('Name', 'duplicator') ?>:</b> </label>
45
  <div class="dup-notes-add">
39
 
40
  <form id="dup-form-opts" method="post" action="?page=duplicator&tab=new2" data-validate="parsley">
41
  <input type="hidden" id="dup-form-opts-action" name="action" value="">
42
+ <!-- RSR Removed the following -->
43
+ <!-- <input type="hidden" id="dup-form-opts-hash" name="package-hash" value="<?php echo $package_hash; ?>">-->
44
  <div>
45
  <label for="package-name"><b><?php _e('Name', 'duplicator') ?>:</b> </label>
46
  <div class="dup-notes-add">
views/packages/main/new2.base.php CHANGED
@@ -1,642 +1,649 @@
1
- <?php
2
- require_once (DUPLICATOR_PLUGIN_PATH . 'classes/package.php');
3
- require_once (DUPLICATOR_PLUGIN_PATH . 'classes/utility.php');
4
-
5
- if(empty($_POST))
6
- {
7
- //F5 Refresh Check
8
- $redirect = admin_url('admin.php?page=duplicator&tab=new1');
9
- echo "<script>window.location.href = '{$redirect}'</script>";
10
- exit;
11
- }
12
-
13
- global $wp_version;
14
- $Package = new DUP_Package();
15
- $Package->SaveActive($_POST);
16
- $Package = DUP_Package::GetActive();
17
-
18
- $mysqldump_on = DUP_Settings::Get('package_mysqldump') && DUP_Database::GetMySqlDumpPath();
19
- $mysqlcompat_on = isset($Package->Database->Compatible) && strlen($Package->Database->Compatible);
20
- $mysqlcompat_on = ($mysqldump_on && $mysqlcompat_on) ? true : false;
21
- $dbbuild_mode = ($mysqldump_on) ? 'mysqldump (fast)' : 'PHP (slow)';
22
-
23
- $zip_check = DUP_Util::GetZipPath();
24
- ?>
25
-
26
- <style>
27
- /* ============----------
28
- PROGRESS ARES-CHECKS */
29
- div#dup-progress-area {text-align:center; max-width:650px; min-height:200px; margin:0px auto 0px auto; padding:0px;}
30
- div.dup-progress-title {font-size:22px;padding:5px 0 20px 0; font-weight: bold}
31
- div#dup-msg-success {color:#18592A; padding:5px; text-align: left}
32
- div#dup-msg-success-subtitle {font-style: italic; margin:7px 0px}
33
- div#dup-msg-error {color:#A62426; padding:5px; max-width: 790px;}
34
- div#dup-msg-error-response-text { max-height:350px; overflow-y:scroll; border:1px solid silver; border-radius: 3px; padding:8px;background:#fff}
35
-
36
- div.dup-panel {margin-bottom: 25px}
37
- div.dup-scan-filter-status {display:inline; float: right; font-size:11px; margin-right:10px; color:#AF0000; font-style: italic}
38
- /* SERVER-CHECKS */
39
- div.dup-scan-title {display:inline-block; padding:1px; font-weight: bold;}
40
- div.dup-scan-title a {display:inline-block; min-width:200px; padding:3px; }
41
- div.dup-scan-title a:focus {outline: 1px solid #fff; box-shadow: none}
42
- div.dup-scan-title div {display:inline-block; }
43
- div.dup-scan-info {display:none;}
44
- div.dup-scan-good {display:inline-block; color:green;font-weight: bold;}
45
- div.dup-scan-warn {display:inline-block; color:#AF0000;font-weight: bold;}
46
- span.dup-toggle {float:left; margin:0 2px 2px 0; }
47
- /*DATABASE*/
48
- table#dup-scan-db-details {line-height: 14px; margin:15px 0px 0px 5px; width:98%}
49
- table#dup-scan-db-details td {padding:0px;}
50
- table#dup-scan-db-details td:first-child {font-weight: bold; white-space: nowrap; width:90px}
51
- div#dup-scan-db-info {margin:0px 0px 0px 10px}
52
- div#data-db-tablelist {max-height: 300px; overflow-y: scroll}
53
- div#data-db-tablelist div{padding:0px 0px 0px 15px;}
54
- div#data-db-tablelist span{display:inline-block; min-width: 75px}
55
- div#data-db-size1 {display: inline-block; float:right; font-size:11px; margin-right: 15px; font-style: italic}
56
- /*FILES */
57
- div#data-arc-size1 {display: inline-block; float:right; font-size:11px; margin-right: 15px; font-style: italic}
58
- div#data-arc-names-data, div#data-arc-big-data
59
- {word-wrap: break-word;font-size:10px; border:1px dashed silver; padding:5px; display: none}
60
-
61
- div#dup-scan-warning-continue {display:none; text-align: center; padding: 0 0 15px 0}
62
- div#dup-scan-warning-continue div.msg1 label{font-size:16px; color:maroon}
63
- div#dup-scan-warning-continue div.msg2 {padding:2px}
64
- div#dup-scan-warning-continue div.msg2 label {font-size:11px !important}
65
-
66
- /*Footer*/
67
- div.dup-button-footer {text-align:center; margin:0}
68
- button.button {font-size:15px !important; height:30px !important; font-weight:bold; padding:3px 5px 5px 5px !important;}
69
- </style>
70
-
71
- <!-- =========================================
72
- TOOL BAR: STEPS -->
73
- <table id="dup-toolbar">
74
- <tr valign="top">
75
- <td style="white-space: nowrap">
76
- <div id="dup-wiz">
77
- <div id="dup-wiz-steps">
78
- <div class="completed-step"><a><span>1</span> <?php DUP_Util::_e('Setup'); ?></a></div>
79
- <div class="active-step"><a><span>2</span> <?php DUP_Util::_e('Scan'); ?> </a></div>
80
- <div><a><span>3</span> <?php DUP_Util::_e('Build'); ?> </a></div>
81
- </div>
82
- <div id="dup-wiz-title">
83
- <?php DUP_Util::_e('Step 2: System Scan'); ?>
84
- </div>
85
- </div>
86
- </td>
87
- <td class="dup-toolbar-btns">
88
- <a id="dup-pro-create-new" href="?page=duplicator" class="add-new-h2"><i class="fa fa-archive"></i> <?php DUP_Util::_e("All Packages"); ?></a> &nbsp;
89
- <span> <?php DUP_Util::_e("Create New"); ?></span>
90
- </td>
91
- </tr>
92
- </table>
93
- <hr style="margin-bottom:10px">
94
-
95
-
96
- <form id="form-duplicator" method="post" action="?page=duplicator&tab=new3">
97
- <div id="dup-progress-area">
98
- <!-- PROGRESS BAR -->
99
- <div id="dup-progress-bar-area">
100
- <div class="dup-progress-title"><i class="fa fa-spinner fa-spin"></i> <?php DUP_Util::_e('Scanning Site'); ?></div>
101
- <div id="dup-progress-bar"></div>
102
- <b><?php DUP_Util::_e('Please Wait...'); ?></b>
103
- </div>
104
-
105
- <!-- SUCCESS MESSAGE -->
106
- <div id="dup-msg-success" style="display:none">
107
- <div style="text-align:center">
108
- <div class="dup-hdr-success"><i class="fa fa-check-square-o fa-lg"></i> <?php DUP_Util::_e('Scan Complete'); ?></div>
109
- <div id="dup-msg-success-subtitle">
110
- <?php DUP_Util::_e("Process Time:"); ?> <span id="data-rpt-scantime"></span>
111
- </div>
112
- </div><br/>
113
-
114
- <!-- ================================================================
115
- META-BOX: SERVER
116
- ================================================================ -->
117
- <div class="dup-panel">
118
- <div class="dup-panel-title">
119
- <i class="fa fa-hdd-o"></i> <?php DUP_Util::_e("Server"); ?>
120
- <div style="float:right; margin:-1px 10px 0px 0px">
121
- <small><a href="?page=duplicator-tools&tab=diagnostics" target="_blank"><?php DUP_Util::_e('Diagnostics');?></a></small>
122
- </div>
123
-
124
- </div>
125
- <div class="dup-panel-panel">
126
- <!-- ============
127
- WEB SERVER -->
128
- <div>
129
- <div class='dup-scan-title'>
130
- <a><?php DUP_Util::_e('Web Server');?></a> <div id="data-srv-web-all"></div>
131
- </div>
132
- <div class='dup-scan-info dup-info-box'>
133
- <?php
134
- $web_servers = implode(', ', $GLOBALS['DUPLICATOR_SERVER_LIST']);
135
- echo '<span id="data-srv-web-model"></span>&nbsp;<b>' . DUP_Util::__('Web Server') . ":</b>&nbsp; '{$_SERVER['SERVER_SOFTWARE']}'";
136
- echo '<small>';
137
- DUP_Util::_e("Supported web servers:");
138
- echo "{$web_servers}";
139
- echo '</small>';
140
- ?>
141
- </div>
142
- </div>
143
- <!-- ============
144
- PHP SETTINGS -->
145
- <div>
146
- <div class='dup-scan-title'>
147
- <a><?php DUP_Util::_e('PHP Setup');?></a> <div id="data-srv-php-all"></div>
148
- </div>
149
- <div class='dup-scan-info dup-info-box'>
150
- <?php
151
- //OPEN_BASEDIR
152
- $test = ini_get("open_basedir");
153
- echo '<span id="data-srv-php-openbase"></span>&nbsp;<b>' . DUP_Util::__('Open Base Dir') . ":</b>&nbsp; '{$test}' <br/>";
154
- echo '<small>';
155
- DUP_Util::_e('Issues might occur when [open_basedir] is enabled. Work with your server admin to disable this value in the php.ini file if you’re having issues building a package.');
156
- echo "&nbsp;<i><a href='http://www.php.net/manual/en/ini.core.php#ini.open-basedir' target='_blank'>[" . DUP_Util::__('details') . "]</a></i><br/>";
157
- echo '</small>';
158
-
159
- //MAX_EXECUTION_TIME
160
- $test = (set_time_limit(0)) ? 0 : ini_get("max_execution_time");
161
- echo '<hr size="1" /><span id="data-srv-php-maxtime"></span>&nbsp;<b>' . DUP_Util::__('Max Execution Time') . ":</b>&nbsp; '{$test}' <br/>";
162
- echo '<small>';
163
- printf(DUP_Util::__('Issues might occur for larger packages when the [max_execution_time] value in the php.ini is too low. The minimum recommended timeout is "%1$s" seconds or higher. An attempt is made to override this value if the server allows it. A value of 0 (recommended) indicates that PHP has no time limits.'), DUPLICATOR_SCAN_TIMEOUT);
164
- echo '<br/><br/>';
165
- DUP_Util::_e('Note: Timeouts can also be set at the web server layer, so if the PHP max timeout passes and you still see a build interrupt messages, then your web server could be killing the process. If you are limited on processing time, consider using the database or file filters to shrink the size of your overall package. However use caution as excluding the wrong resources can cause your install to not work properly.');
166
- echo "&nbsp;<i><a href='http://www.php.net/manual/en/info.configuration.php#ini.max-execution-time' target='_blank'>[" .DUP_Util::__('details') . "]</a></i>";
167
-
168
- if ($zip_check != null) {
169
- echo '<br/><br/>';
170
- echo '<span style="font-weight:bold">';
171
- DUP_Util::_e('Get faster builds with Duplicator Pro.');
172
- echo '</span>';
173
- echo "&nbsp;<i><a href='http://snapcreek.com/duplicator?free-max-execution-time-warn' target='_blank'>[" . DUP_Util::__('details') . "]</a></i>";
174
- }
175
-
176
- echo '</small>';
177
-
178
- //MYSQLI
179
- echo '<hr size="1" /><span id="data-srv-php-mysqli"></span>&nbsp;<b>' . DUP_Util::__('MySQLi') . "</b> <br/>";
180
- echo '<small>';
181
- DUP_Util::_e('Creating the package does not require the mysqli module. However the installer.php file requires that the PHP module mysqli be installed on the server it is deployed on.');
182
- echo "&nbsp;<i><a href='http://php.net/manual/en/mysqli.installation.php' target='_blank'>[" . DUP_Util::__('details') . "]</a></i>";
183
- echo '</small>';
184
- ?>
185
- </div>
186
- </div>
187
- <!-- ============
188
- WORDPRESS SETTINGS -->
189
- <div>
190
- <div class='dup-scan-title'>
191
- <a><?php DUP_Util::_e('WordPress');?></a> <div id="data-srv-wp-all"></div>
192
- </div>
193
- <div class='dup-scan-info dup-info-box'>
194
- <?php
195
- //VERSION CHECK
196
- echo '<span id="data-srv-wp-version"></span>&nbsp;<b>' . DUP_Util::__('WordPress Version') . ":</b>&nbsp; '{$wp_version}' <br/>";
197
- echo '<small>';
198
- printf(DUP_Util::__('It is recommended to have a version of WordPress that is greater than %1$s'), DUPLICATOR_SCAN_MIN_WP);
199
- echo '</small>';
200
-
201
- //CORE FILES
202
- echo '<hr size="1" /><span id="data-srv-wp-core"></span>&nbsp;<b>' . DUP_Util::__('Core Files') . "</b> <br/>";
203
- echo '<small>';
204
- DUP_Util::_e("If the scanner is unable to locate the wp-config.php file in the root directory, then you will need to manually copy it to its new location.");
205
- echo '</small>';
206
-
207
- //CACHE DIR
208
- $cache_path = $cache_path = DUP_Util::SafePath(WP_CONTENT_DIR) . '/cache';
209
- $cache_size = DUP_Util::ByteSize(DUP_Util::GetDirectorySize($cache_path));
210
- echo '<hr size="1" /><span id="data-srv-wp-cache"></span>&nbsp;<b>' . DUP_Util::__('Cache Path') . ":</b>&nbsp; '{$cache_path}' ({$cache_size}) <br/>";
211
- echo '<small>';
212
- DUP_Util::_e("Cached data will lead to issues at install time and increases your archive size. It is recommended to empty your cache directory at build time. Use caution when removing data from the cache directory. If you have a cache plugin review the documentation for how to empty it; simply removing files might cause errors on your site. The cache size minimum threshold is currently set at ");
213
- echo DUP_Util::ByteSize(DUPLICATOR_SCAN_CACHESIZE) . '.';
214
- echo '</small>';
215
-
216
- ?>
217
- </div>
218
- </div>
219
- </div><!-- end .dup-panel -->
220
- </div><!-- end .dup-panel-panel -->
221
-
222
- <h2 style="font-size:18px; font-weight:bold; margin:-15px 0 0 10px"><i class="fa fa-file-archive-o"></i>&nbsp;<?php DUP_Util::_e('Archive');?> </h2>
223
-
224
- <!-- ================================================================
225
- FILES
226
- ================================================================ -->
227
- <div class="dup-panel">
228
- <div class="dup-panel-title">
229
- <i class="fa fa-files-o"></i>
230
- <?php DUP_Util::_e("Files"); ?>
231
- <div id="data-arc-size1"></div>
232
- <div class="dup-scan-filter-status">
233
- <?php
234
- if ($Package->Archive->FilterOn) {
235
- echo '<i class="fa fa-filter"></i> '; DUP_Util::_e('Enabled');
236
- }
237
- ?>
238
- </div>
239
- </div>
240
- <div class="dup-panel-panel">
241
-
242
- <!-- ============
243
- TOTAL SIZE -->
244
- <div>
245
- <div class='dup-scan-title'>
246
- <a><?php DUP_Util::_e('Total Size');?></a> <div id="data-arc-status-size"></div>
247
- </div>
248
- <div class='dup-scan-info dup-info-box'>
249
- <b><?php DUP_Util::_e('Size');?>:</b> <span id="data-arc-size2"></span> &nbsp; | &nbsp;
250
- <b><?php DUP_Util::_e('File Count');?>:</b> <span id="data-arc-files"></span> &nbsp; | &nbsp;
251
- <b><?php DUP_Util::_e('Directory Count');?>:</b> <span id="data-arc-dirs"></span>
252
- <small>
253
- <?php
254
- printf(DUP_Util::__('Total size represents all files minus any filters that have been setup. The current thresholds that triggers a warning is %1$s for the total size. Some budget hosts limit the amount of time a PHP/Web request process can run. When working with larger sites this can cause timeout issues. Consider using a file filter in step 1 to shrink and filter the overall size of your package.'),
255
- DUP_Util::ByteSize(DUPLICATOR_SCAN_SITE),
256
- DUP_Util::ByteSize(DUPLICATOR_SCAN_WARNFILESIZE));
257
-
258
- if ($zip_check != null) {
259
- echo '<br/><br/>';
260
- echo '<span style="font-weight:bold">';
261
- DUP_Util::_e('Package support up to 2GB available in Duplicator Pro.');
262
- echo '</span>';
263
- echo "&nbsp;<i><a href='http://snapcreek.com/duplicator?free-size-warn' target='_blank'>[" . DUP_Util::__('details') . "]</a></i>";
264
- }
265
-
266
- ?>
267
- </small>
268
- </div>
269
- </div>
270
-
271
- <!-- ============
272
- FILE NAME LENGTHS -->
273
- <div>
274
- <div class='dup-scan-title'>
275
- <a><?php DUP_Util::_e('Name Checks');?></a> <div id="data-arc-status-names"></div>
276
- </div>
277
- <div class='dup-scan-info dup-info-box'>
278
- <small>
279
- <?php
280
- DUP_Util::_e('File or directory names may cause issues when working across different environments and servers. Names that are over 250 characters, contain special characters (such as * ? > < : / \ |) or are unicode might cause issues in a remote enviroment. It is recommended to remove or filter these files before building the archive if you have issues at install time.');
281
- ?>
282
- </small><br/>
283
- <a href="javascript:void(0)" onclick="jQuery('#data-arc-names-data').toggle()">[<?php DUP_Util::_e('Show Paths');?>]</a>
284
- <div id="data-arc-names-data"></div>
285
- </div>
286
- </div>
287
-
288
- <!-- ============
289
- LARGE FILES -->
290
- <div>
291
- <div class='dup-scan-title'>
292
- <a><?php DUP_Util::_e('Large Files');?></a> <div id="data-arc-status-big"></div>
293
- </div>
294
- <div class='dup-scan-info dup-info-box'>
295
- <small>
296
- <?php
297
- printf(DUP_Util::__('Large files such as movies or other backuped data can cause issues with timeouts. The current check for large files is %1$s per file. If your having issues creating a package consider excluding these files with the files filter and manually moving them to your new location.'),
298
- DUP_Util::ByteSize(DUPLICATOR_SCAN_WARNFILESIZE));
299
- ?>
300
- </small><br/>
301
- <a href="javascript:void(0)" onclick="jQuery('#data-arc-big-data').toggle()">[<?php DUP_Util::_e('Show Paths');?>]</a>
302
- <div id="data-arc-big-data"></div>
303
- </div>
304
- </div>
305
-
306
- <!-- ============
307
- VIEW FILTERS -->
308
- <?php if ($Package->Archive->FilterOn) : ?>
309
- <div>
310
- <div class='dup-scan-title'>
311
- <a style='font-weight: normal'><?php DUP_Util::_e('Archive Details');?></a>
312
- </div>
313
- <div class='dup-scan-info dup-info-box'>
314
- <b>[<?php DUP_Util::_e('Root Directory');?>]</b><br/>
315
- <?php echo DUPLICATOR_WPROOTPATH;?>
316
- <br/><br/>
317
-
318
- <b>[<?php DUP_Util::_e('Excluded Directories');?>]</b><br/>
319
- <?php
320
- if (strlen( $Package->Archive->FilterDirs)) {
321
- echo str_replace(";", "<br/>", $Package->Archive->FilterDirs);
322
- } else {
323
- DUP_Util::_e('No directory filters have been set.');
324
- }
325
- ?>
326
- <br/>
327
-
328
- <b>[<?php DUP_Util::_e('Excluded File Extensions');?>]</b><br/>
329
- <?php
330
- if (strlen( $Package->Archive->FilterExts)) {
331
- echo $Package->Archive->FilterExts;
332
- } else {
333
- DUP_Util::_e('No file extension filters have been set.');
334
- }
335
- ?>
336
- <small>
337
- <?php
338
- DUP_Util::_e('The root directory is where Duplicator starts archiving files. The excluded sections will be skipped during the archive process. ');
339
- DUP_Util::_e('All results are stored in a json file. ');
340
- ?>
341
- <a href="<?php echo DUPLICATOR_SITE_URL ?>/wp-admin/admin-ajax.php?action=duplicator_package_scan" target="dup_report"><?php DUP_Util::_e('[view json report]');?></a>
342
- </small><br/>
343
- </div>
344
- </div>
345
- <?php endif; ?>
346
- </div><!-- end .dup-panel -->
347
- <br/>
348
-
349
- <!-- ================================================================
350
- DATABASE
351
- ================================================================ -->
352
- <div class="dup-panel-title">
353
- <i class="fa fa-table"></i>
354
- <?php DUP_Util::_e("Database"); ?>
355
- <div id="data-db-size1"></div>
356
- <div class="dup-scan-filter-status">
357
- <?php
358
- if ($Package->Database->FilterOn) {
359
- echo '<i class="fa fa-filter"></i> '; DUP_Util::_e('Enabled');
360
- }
361
- ?>
362
- </div>
363
- </div>
364
- <div class="dup-panel-panel" id="dup-scan-db">
365
-
366
- <!-- ============
367
- TOTAL SIZE -->
368
- <div>
369
- <div class='dup-scan-title'>
370
- <a><?php DUP_Util::_e('Total Size');?></a>
371
- <div id="data-db-status-size1"></div>
372
- </div>
373
- <div class='dup-scan-info dup-info-box'>
374
- <b><?php DUP_Util::_e('Tables');?>:</b> <span id="data-db-tablecount"></span> &nbsp; | &nbsp;
375
- <b><?php DUP_Util::_e('Records');?>:</b> <span id="data-db-rows"></span> &nbsp; | &nbsp;
376
- <b><?php DUP_Util::_e('Size');?>:</b> <span id="data-db-size2"></span> <br/><br/>
377
- <?php
378
- $lnk = '<a href="maint/repair.php" target="_blank">' . DUP_Util::__('repair and optimization') . '</a>';
379
- printf(DUP_Util::__('Total size and row count for all database tables are approximate values. The thresholds that trigger warnings are %1$s and %2$s records. Large databases take time to process and can cause issues with server timeout and memory settings. Running a %3$s on your database can also help improve the overall size and performance. If your server supports shell_exec and mysqldump you can try to enable this option from the settings menu.'),
380
- DUP_Util::ByteSize(DUPLICATOR_SCAN_DBSIZE),
381
- number_format(DUPLICATOR_SCAN_DBROWS),
382
- $lnk);
383
- ?>
384
- </div>
385
- </div>
386
-
387
- <!-- ============
388
- TABLE DETAILS -->
389
- <div>
390
- <div class='dup-scan-title'>
391
- <a><?php DUP_Util::_e('Table Details');?></a>
392
- <div id="data-db-status-size2"></div>
393
- </div>
394
- <div class='dup-scan-info dup-info-box'>
395
- <div id="dup-scan-db-info">
396
- <div id="data-db-tablelist"></div>
397
- </div>
398
- </div>
399
- </div>
400
-
401
- <table id="dup-scan-db-details">
402
- <tr><td><b><?php DUP_Util::_e('Name:');?></b></td><td><?php echo DB_NAME ;?> </td></tr>
403
- <tr><td><b><?php DUP_Util::_e('Host:');?></b></td><td><?php echo DB_HOST ;?> </td></tr>
404
- <tr>
405
- <td style="vertical-align: top"><b><?php DUP_Util::_e('Build Mode:');?></b></td>
406
- <td style="line-height:18px">
407
- <a href="?page=duplicator-settings" target="_blank"><?php echo $dbbuild_mode ;?></a>
408
- <?php if ($mysqlcompat_on) :?>
409
- <br/>
410
- <small style="font-style:italic; color:maroon">
411
- <i class="fa fa-exclamation-circle"></i> <?php DUP_Util::_e('MySQL Compatibility Mode Enabled'); ?>
412
- <a href="https://dev.mysql.com/doc/refman/5.7/en/mysqldump.html#option_mysqldump_compatible" target="_blank">[<?php DUP_Util::_e('details'); ?>]</a>
413
- </small>
414
- <?php endif;?>
415
- </td>
416
- </tr>
417
- </table>
418
-
419
- </div><!-- end .dup-panel -->
420
- </div><!-- end .dup-panel-panel -->
421
-
422
- <!-- WARNING CONTINUE -->
423
- <div id="dup-scan-warning-continue">
424
- <div class="msg1">
425
- <input type="checkbox" id="dup-scan-warning-continue-checkbox" onclick="Duplicator.Pack.WarningContinue(this)"/>
426
- <label for="dup-scan-warning-continue-checkbox"><?php DUP_Util::_e('A warning status was detected, are you sure you want to continue?');?></label>
427
- </div>
428
- <div class="msg2">
429
- <label for="dup-scan-warning-continue-checkbox">
430
- <?php
431
- DUP_Util::_e("Scan checks are not required to pass, however they could cause issues on some systems.");
432
- echo '<br/>';
433
- DUP_Util::_e("Please review the details for each warning by clicking on the detail link.");
434
- ?>
435
- </label>
436
- </div>
437
- </div>
438
-
439
- </div>
440
-
441
-
442
-
443
- <!-- ERROR MESSAGE -->
444
- <div id="dup-msg-error" style="display:none">
445
- <div class="dup-hdr-error"><i class="fa fa-exclamation-circle"></i> <?php DUP_Util::_e('Scan Error'); ?></div>
446
- <i><?php DUP_Util::_e('Please try again!'); ?></i><br/>
447
- <div style="text-align:left">
448
- <b><?php DUP_Util::_e("Server Status:"); ?></b> &nbsp;
449
- <div id="dup-msg-error-response-status" style="display:inline-block"></div><br/>
450
-
451
- <b><?php DUP_Util::_e("Error Message:"); ?></b>
452
- <div id="dup-msg-error-response-text"></div>
453
- </div>
454
- </div>
455
- </div> <!-- end #dup-progress-area -->
456
-
457
- <div class="dup-button-footer" style="display:none">
458
- <input type="button" value="&#9668; <?php DUP_Util::_e("Back") ?>" onclick="window.location.assign('?page=duplicator&tab=new1')" class="button button-large" />
459
- <input type="button" value="<?php DUP_Util::_e("Rescan") ?>" onclick="Duplicator.Pack.Rescan()" class="button button-large" />
460
- <input type="submit" value="<?php DUP_Util::_e("Build") ?> &#9658" class="button button-primary button-large" id="dup-build-button" />
461
- <!-- Used for iMacros testing do not remove -->
462
- <div id="dup-automation-imacros"></div>
463
- </div>
464
- </form>
465
-
466
- <script type="text/javascript">
467
- jQuery(document).ready(function($) {
468
-
469
- /* Performs Ajax post to create check system */
470
- Duplicator.Pack.Scan = function() {
471
- var data = {action : 'duplicator_package_scan'}
472
-
473
- $.ajax({
474
- type: "POST",
475
- url: ajaxurl,
476
- dataType: "json",
477
- timeout: 10000000,
478
- data: data,
479
- complete: function() {$('.dup-button-footer').show()},
480
- success: function(data) {
481
- Duplicator.Pack.LoadScanData(data)
482
- //Imacros testing required
483
- $('#dup-automation-imacros').html('<input type="hidden" id="dup-finished" value="done" />');
484
- },
485
- error: function(data) {
486
- $('#dup-progress-bar-area').hide();
487
- var status = data.status + ' -' + data.statusText;
488
- $('#dup-msg-error-response-status').html(status)
489
- $('#dup-msg-error-response-text').html(data.responseText);
490
- $('#dup-msg-error').show(200);
491
- console.log(data);
492
- }
493
- });
494
- }
495
-
496
- Duplicator.Pack.Rescan = function() {
497
- $('#dup-msg-success,#dup-msg-error,.dup-button-footer').hide();
498
- $('#dup-progress-bar-area').show();
499
- Duplicator.Pack.Scan();
500
- }
501
-
502
- Duplicator.Pack.WarningContinue = function(checkbox) {
503
- ($(checkbox).is(':checked'))
504
- ? $('#dup-build-button').prop('disabled',false).addClass('button-primary')
505
- : $('#dup-build-button').prop('disabled',true).removeClass('button-primary');
506
-
507
- }
508
-
509
- Duplicator.Pack.LoadScanStatus = function(status) {
510
- var result;
511
- switch (status) {
512
- case false : result = '<div class="dup-scan-warn"><i class="fa fa-exclamation-triangle"></i></div>'; break;
513
- case 'Warn' : result = '<div class="dup-scan-warn"><i class="fa fa-exclamation-triangle"></i> Warn</div>'; break;
514
- case true : result = '<div class="dup-scan-good"><i class="fa fa-check"></i></div>'; break;
515
- case 'Good' : result = '<div class="dup-scan-good"><i class="fa fa-check"></i> Good</div>'; break;
516
- default :
517
- result = 'unable to read';
518
- }
519
- return result;
520
- }
521
-
522
- /* Load Scan Data */
523
- Duplicator.Pack.LoadScanData = function(data) {
524
-
525
- var errMsg = "unable to read";
526
- $('#dup-progress-bar-area').hide();
527
-
528
- //****************
529
- //REPORT
530
- var base = $('#data-rpt-scanfile').attr('href');
531
- $('#data-rpt-scanfile').attr('href', base + '&scanfile=' + data.RPT.ScanFile);
532
- $('#data-rpt-scantime').text(data.RPT.ScanTime || 0);
533
-
534
-
535
- //****************
536
- //SERVER
537
- $('#data-srv-web-model').html(Duplicator.Pack.LoadScanStatus(data.SRV.WEB.model));
538
- $('#data-srv-web-all').html(Duplicator.Pack.LoadScanStatus(data.SRV.WEB.ALL));
539
-
540
- $('#data-srv-php-openbase').html(Duplicator.Pack.LoadScanStatus(data.SRV.PHP.openbase));
541
- $('#data-srv-php-maxtime').html(Duplicator.Pack.LoadScanStatus(data.SRV.PHP.maxtime));
542
- $('#data-srv-php-mysqli').html(Duplicator.Pack.LoadScanStatus(data.SRV.PHP.mysqli));
543
- $('#data-srv-php-openssl').html(Duplicator.Pack.LoadScanStatus(data.SRV.PHP.openssl));
544
- $('#data-srv-php-all').html(Duplicator.Pack.LoadScanStatus(data.SRV.PHP.ALL));
545
-
546
- $('#data-srv-wp-version').html(Duplicator.Pack.LoadScanStatus(data.SRV.WP.version));
547
- $('#data-srv-wp-core').html(Duplicator.Pack.LoadScanStatus(data.SRV.WP.core));
548
- $('#data-srv-wp-cache').html(Duplicator.Pack.LoadScanStatus(data.SRV.WP.cache));
549
- $('#data-srv-wp-all').html(Duplicator.Pack.LoadScanStatus(data.SRV.WP.ALL));
550
-
551
- //****************
552
- //DATABASE
553
- var html = "";
554
- if (data.DB.Status.Success) {
555
- $('#data-db-status-size1').html(Duplicator.Pack.LoadScanStatus(data.DB.Status.Size));
556
- $('#data-db-status-size2').html(Duplicator.Pack.LoadScanStatus(data.DB.Status.Size));
557
- $('#data-db-size1').text(data.DB.Size || errMsg);
558
- $('#data-db-size2').text(data.DB.Size || errMsg);
559
- $('#data-db-rows').text(data.DB.Rows || errMsg);
560
- $('#data-db-tablecount').text(data.DB.TableCount || errMsg);
561
- //Table Details
562
- if (data.DB.TableList == undefined || data.DB.TableList.length == 0) {
563
- html = '<?php DUP_Util::_e("Unable to report on any tables") ?>';
564
- } else {
565
- $.each(data.DB.TableList, function(i) {
566
- html += '<b>' + i + '</b><br/>';
567
- $.each(data.DB.TableList[i], function(key,val) {html += '<div><span>' + key + ':</span>' + val + '</div>'; })
568
- });
569
- }
570
- $('#data-db-tablelist').append(html);
571
- } else {
572
- html = '<?php DUP_Util::_e("Unable to report on database stats") ?>';
573
- $('#dup-scan-db').html(html);
574
- }
575
-
576
- //****************
577
- //ARCHIVE
578
- $('#data-arc-status-size').html(Duplicator.Pack.LoadScanStatus(data.ARC.Status.Size));
579
- $('#data-arc-status-names').html(Duplicator.Pack.LoadScanStatus(data.ARC.Status.Names));
580
- $('#data-arc-status-big').html(Duplicator.Pack.LoadScanStatus(data.ARC.Status.Big));
581
- $('#data-arc-size1').text(data.ARC.Size || errMsg);
582
- $('#data-arc-size2').text(data.ARC.Size || errMsg);
583
- $('#data-arc-files').text(data.ARC.FileCount || errMsg);
584
- $('#data-arc-dirs').text(data.ARC.DirCount || errMsg);
585
-
586
-
587
-
588
- //Name Checks
589
- html = '';
590
- //Dirs
591
- if (data.ARC.FilterInfo.Dirs.Warning !== undefined && data.ARC.FilterInfo.Dirs.Warning.length > 0) {
592
- $.each(data.ARC.FilterInfo.Dirs.Warning, function (key, val) {
593
- html += '<?php DUP_Util::_e("DIR") ?> ' + key + ':<br/>[' + val + ']<br/>';
594
- });
595
- }
596
- //Files
597
- if (data.ARC.FilterInfo.Files.Warning !== undefined && data.ARC.FilterInfo.Files.Warning.length > 0) {
598
- $.each(data.ARC.FilterInfo.Files.Warning, function (key, val) {
599
- html += '<?php DUP_Util::_e("FILE") ?> ' + key + ':<br/>[' + val + ']<br/>';
600
- });
601
- }
602
- html = (html.length == 0) ? '<?php DUP_Util::_e("No name warning issues found.") ?>' : html;
603
-
604
-
605
- $('#data-arc-names-data').html(html);
606
-
607
- //Large Files
608
- html = '<?php DUP_Util::_e("No large files found.") ?>';
609
- if (data.ARC.FilterInfo.Files.Size !== undefined && data.ARC.FilterInfo.Files.Size.length > 0) {
610
- html = '';
611
- $.each(data.ARC.FilterInfo.Files.Size, function (key, val) {
612
- html += '<?php DUP_Util::_e("FILE") ?> ' + key + ':<br/>' + val + '<br/>';
613
- });
614
- }
615
- $('#data-arc-big-data').html(html);
616
- $('#dup-msg-success').show();
617
-
618
- //Waring Check
619
- var warnCount = data.RPT.Warnings || 0;
620
- if (warnCount > 0) {
621
- $('#dup-scan-warning-continue').show();
622
- $('#dup-build-button').prop("disabled",true).removeClass('button-primary');
623
- } else {
624
- $('#dup-scan-warning-continue').hide();
625
- $('#dup-build-button').prop("disabled",false).addClass('button-primary');
626
- }
627
-
628
- }
629
-
630
- //Page Init:
631
- Duplicator.UI.AnimateProgressBar('dup-progress-bar');
632
- Duplicator.Pack.Scan();
633
-
634
- //Init: Toogle for system requirment detial links
635
- $('.dup-scan-title a').each(function() {
636
- $(this).attr('href', 'javascript:void(0)');
637
- $(this).click({selector : '.dup-scan-info'}, Duplicator.Pack.ToggleSystemDetails);
638
- $(this).prepend("<span class='ui-icon ui-icon-triangle-1-e dup-toggle' />");
639
- });
640
-
641
- });
 
 
 
 
 
 
 
642
  </script>
1
+ <?php
2
+ require_once (DUPLICATOR_PLUGIN_PATH . 'classes/package.php');
3
+ require_once (DUPLICATOR_PLUGIN_PATH . 'classes/utility.php');
4
+
5
+ if(empty($_POST))
6
+ {
7
+ //F5 Refresh Check
8
+ $redirect = admin_url('admin.php?page=duplicator&tab=new1');
9
+ echo "<script>window.location.href = '{$redirect}'</script>";
10
+ exit;
11
+ }
12
+
13
+ global $wp_version;
14
+ $Package = new DUP_Package();
15
+
16
+ if(isset($_POST['package-hash']))
17
+ {
18
+ // If someone is trying to pass the hasn into us that is illegal so stop it immediately.
19
+ die('Unauthorized');
20
+ }
21
+
22
+ $Package->SaveActive($_POST);
23
+ $Package = DUP_Package::GetActive();
24
+
25
+ $mysqldump_on = DUP_Settings::Get('package_mysqldump') && DUP_Database::GetMySqlDumpPath();
26
+ $mysqlcompat_on = isset($Package->Database->Compatible) && strlen($Package->Database->Compatible);
27
+ $mysqlcompat_on = ($mysqldump_on && $mysqlcompat_on) ? true : false;
28
+ $dbbuild_mode = ($mysqldump_on) ? 'mysqldump (fast)' : 'PHP (slow)';
29
+
30
+ $zip_check = DUP_Util::GetZipPath();
31
+ ?>
32
+
33
+ <style>
34
+ /* ============----------
35
+ PROGRESS ARES-CHECKS */
36
+ div#dup-progress-area {text-align:center; max-width:650px; min-height:200px; margin:0px auto 0px auto; padding:0px;}
37
+ div.dup-progress-title {font-size:22px;padding:5px 0 20px 0; font-weight: bold}
38
+ div#dup-msg-success {color:#18592A; padding:5px; text-align: left}
39
+ div#dup-msg-success-subtitle {font-style: italic; margin:7px 0px}
40
+ div#dup-msg-error {color:#A62426; padding:5px; max-width: 790px;}
41
+ div#dup-msg-error-response-text { max-height:350px; overflow-y:scroll; border:1px solid silver; border-radius: 3px; padding:8px;background:#fff}
42
+
43
+ div.dup-panel {margin-bottom: 25px}
44
+ div.dup-scan-filter-status {display:inline; float: right; font-size:11px; margin-right:10px; color:#AF0000; font-style: italic}
45
+ /* SERVER-CHECKS */
46
+ div.dup-scan-title {display:inline-block; padding:1px; font-weight: bold;}
47
+ div.dup-scan-title a {display:inline-block; min-width:200px; padding:3px; }
48
+ div.dup-scan-title a:focus {outline: 1px solid #fff; box-shadow: none}
49
+ div.dup-scan-title div {display:inline-block; }
50
+ div.dup-scan-info {display:none;}
51
+ div.dup-scan-good {display:inline-block; color:green;font-weight: bold;}
52
+ div.dup-scan-warn {display:inline-block; color:#AF0000;font-weight: bold;}
53
+ span.dup-toggle {float:left; margin:0 2px 2px 0; }
54
+ /*DATABASE*/
55
+ table#dup-scan-db-details {line-height: 14px; margin:15px 0px 0px 5px; width:98%}
56
+ table#dup-scan-db-details td {padding:0px;}
57
+ table#dup-scan-db-details td:first-child {font-weight: bold; white-space: nowrap; width:90px}
58
+ div#dup-scan-db-info {margin:0px 0px 0px 10px}
59
+ div#data-db-tablelist {max-height: 300px; overflow-y: scroll}
60
+ div#data-db-tablelist div{padding:0px 0px 0px 15px;}
61
+ div#data-db-tablelist span{display:inline-block; min-width: 75px}
62
+ div#data-db-size1 {display: inline-block; float:right; font-size:11px; margin-right: 15px; font-style: italic}
63
+ /*FILES */
64
+ div#data-arc-size1 {display: inline-block; float:right; font-size:11px; margin-right: 15px; font-style: italic}
65
+ div#data-arc-names-data, div#data-arc-big-data
66
+ {word-wrap: break-word;font-size:10px; border:1px dashed silver; padding:5px; display: none}
67
+
68
+ div#dup-scan-warning-continue {display:none; text-align: center; padding: 0 0 15px 0}
69
+ div#dup-scan-warning-continue div.msg1 label{font-size:16px; color:maroon}
70
+ div#dup-scan-warning-continue div.msg2 {padding:2px}
71
+ div#dup-scan-warning-continue div.msg2 label {font-size:11px !important}
72
+
73
+ /*Footer*/
74
+ div.dup-button-footer {text-align:center; margin:0}
75
+ button.button {font-size:15px !important; height:30px !important; font-weight:bold; padding:3px 5px 5px 5px !important;}
76
+ </style>
77
+
78
+ <!-- =========================================
79
+ TOOL BAR: STEPS -->
80
+ <table id="dup-toolbar">
81
+ <tr valign="top">
82
+ <td style="white-space: nowrap">
83
+ <div id="dup-wiz">
84
+ <div id="dup-wiz-steps">
85
+ <div class="completed-step"><a><span>1</span> <?php DUP_Util::_e('Setup'); ?></a></div>
86
+ <div class="active-step"><a><span>2</span> <?php DUP_Util::_e('Scan'); ?> </a></div>
87
+ <div><a><span>3</span> <?php DUP_Util::_e('Build'); ?> </a></div>
88
+ </div>
89
+ <div id="dup-wiz-title">
90
+ <?php DUP_Util::_e('Step 2: System Scan'); ?>
91
+ </div>
92
+ </div>
93
+ </td>
94
+ <td class="dup-toolbar-btns">
95
+ <a id="dup-pro-create-new" href="?page=duplicator" class="add-new-h2"><i class="fa fa-archive"></i> <?php DUP_Util::_e("All Packages"); ?></a> &nbsp;
96
+ <span> <?php DUP_Util::_e("Create New"); ?></span>
97
+ </td>
98
+ </tr>
99
+ </table>
100
+ <hr style="margin-bottom:10px">
101
+
102
+
103
+ <form id="form-duplicator" method="post" action="?page=duplicator&tab=new3">
104
+ <div id="dup-progress-area">
105
+ <!-- PROGRESS BAR -->
106
+ <div id="dup-progress-bar-area">
107
+ <div class="dup-progress-title"><i class="fa fa-spinner fa-spin"></i> <?php DUP_Util::_e('Scanning Site'); ?></div>
108
+ <div id="dup-progress-bar"></div>
109
+ <b><?php DUP_Util::_e('Please Wait...'); ?></b>
110
+ </div>
111
+
112
+ <!-- SUCCESS MESSAGE -->
113
+ <div id="dup-msg-success" style="display:none">
114
+ <div style="text-align:center">
115
+ <div class="dup-hdr-success"><i class="fa fa-check-square-o fa-lg"></i> <?php DUP_Util::_e('Scan Complete'); ?></div>
116
+ <div id="dup-msg-success-subtitle">
117
+ <?php DUP_Util::_e("Process Time:"); ?> <span id="data-rpt-scantime"></span>
118
+ </div>
119
+ </div><br/>
120
+
121
+ <!-- ================================================================
122
+ META-BOX: SERVER
123
+ ================================================================ -->
124
+ <div class="dup-panel">
125
+ <div class="dup-panel-title">
126
+ <i class="fa fa-hdd-o"></i> <?php DUP_Util::_e("Server"); ?>
127
+ <div style="float:right; margin:-1px 10px 0px 0px">
128
+ <small><a href="?page=duplicator-tools&tab=diagnostics" target="_blank"><?php DUP_Util::_e('Diagnostics');?></a></small>
129
+ </div>
130
+
131
+ </div>
132
+ <div class="dup-panel-panel">
133
+ <!-- ============
134
+ WEB SERVER -->
135
+ <div>
136
+ <div class='dup-scan-title'>
137
+ <a><?php DUP_Util::_e('Web Server');?></a> <div id="data-srv-web-all"></div>
138
+ </div>
139
+ <div class='dup-scan-info dup-info-box'>
140
+ <?php
141
+ $web_servers = implode(', ', $GLOBALS['DUPLICATOR_SERVER_LIST']);
142
+ echo '<span id="data-srv-web-model"></span>&nbsp;<b>' . DUP_Util::__('Web Server') . ":</b>&nbsp; '{$_SERVER['SERVER_SOFTWARE']}'";
143
+ echo '<small>';
144
+ DUP_Util::_e("Supported web servers:");
145
+ echo "{$web_servers}";
146
+ echo '</small>';
147
+ ?>
148
+ </div>
149
+ </div>
150
+ <!-- ============
151
+ PHP SETTINGS -->
152
+ <div>
153
+ <div class='dup-scan-title'>
154
+ <a><?php DUP_Util::_e('PHP Setup');?></a> <div id="data-srv-php-all"></div>
155
+ </div>
156
+ <div class='dup-scan-info dup-info-box'>
157
+ <?php
158
+ //OPEN_BASEDIR
159
+ $test = ini_get("open_basedir");
160
+ echo '<span id="data-srv-php-openbase"></span>&nbsp;<b>' . DUP_Util::__('Open Base Dir') . ":</b>&nbsp; '{$test}' <br/>";
161
+ echo '<small>';
162
+ DUP_Util::_e('Issues might occur when [open_basedir] is enabled. Work with your server admin to disable this value in the php.ini file if you’re having issues building a package.');
163
+ echo "&nbsp;<i><a href='http://www.php.net/manual/en/ini.core.php#ini.open-basedir' target='_blank'>[" . DUP_Util::__('details') . "]</a></i><br/>";
164
+ echo '</small>';
165
+
166
+ //MAX_EXECUTION_TIME
167
+ $test = (set_time_limit(0)) ? 0 : ini_get("max_execution_time");
168
+ echo '<hr size="1" /><span id="data-srv-php-maxtime"></span>&nbsp;<b>' . DUP_Util::__('Max Execution Time') . ":</b>&nbsp; '{$test}' <br/>";
169
+ echo '<small>';
170
+ printf(DUP_Util::__('Issues might occur for larger packages when the [max_execution_time] value in the php.ini is too low. The minimum recommended timeout is "%1$s" seconds or higher. An attempt is made to override this value if the server allows it. A value of 0 (recommended) indicates that PHP has no time limits.'), DUPLICATOR_SCAN_TIMEOUT);
171
+ echo '<br/><br/>';
172
+ DUP_Util::_e('Note: Timeouts can also be set at the web server layer, so if the PHP max timeout passes and you still see a build interrupt messages, then your web server could be killing the process. If you are limited on processing time, consider using the database or file filters to shrink the size of your overall package. However use caution as excluding the wrong resources can cause your install to not work properly.');
173
+ echo "&nbsp;<i><a href='http://www.php.net/manual/en/info.configuration.php#ini.max-execution-time' target='_blank'>[" .DUP_Util::__('details') . "]</a></i>";
174
+
175
+ if ($zip_check != null) {
176
+ echo '<br/><br/>';
177
+ echo '<span style="font-weight:bold">';
178
+ DUP_Util::_e('Get faster builds with Duplicator Pro.');
179
+ echo '</span>';
180
+ echo "&nbsp;<i><a href='http://snapcreek.com/duplicator?free-max-execution-time-warn' target='_blank'>[" . DUP_Util::__('details') . "]</a></i>";
181
+ }
182
+
183
+ echo '</small>';
184
+
185
+ //MYSQLI
186
+ echo '<hr size="1" /><span id="data-srv-php-mysqli"></span>&nbsp;<b>' . DUP_Util::__('MySQLi') . "</b> <br/>";
187
+ echo '<small>';
188
+ DUP_Util::_e('Creating the package does not require the mysqli module. However the installer.php file requires that the PHP module mysqli be installed on the server it is deployed on.');
189
+ echo "&nbsp;<i><a href='http://php.net/manual/en/mysqli.installation.php' target='_blank'>[" . DUP_Util::__('details') . "]</a></i>";
190
+ echo '</small>';
191
+ ?>
192
+ </div>
193
+ </div>
194
+ <!-- ============
195
+ WORDPRESS SETTINGS -->
196
+ <div>
197
+ <div class='dup-scan-title'>
198
+ <a><?php DUP_Util::_e('WordPress');?></a> <div id="data-srv-wp-all"></div>
199
+ </div>
200
+ <div class='dup-scan-info dup-info-box'>
201
+ <?php
202
+ //VERSION CHECK
203
+ echo '<span id="data-srv-wp-version"></span>&nbsp;<b>' . DUP_Util::__('WordPress Version') . ":</b>&nbsp; '{$wp_version}' <br/>";
204
+ echo '<small>';
205
+ printf(DUP_Util::__('It is recommended to have a version of WordPress that is greater than %1$s'), DUPLICATOR_SCAN_MIN_WP);
206
+ echo '</small>';
207
+
208
+ //CORE FILES
209
+ echo '<hr size="1" /><span id="data-srv-wp-core"></span>&nbsp;<b>' . DUP_Util::__('Core Files') . "</b> <br/>";
210
+ echo '<small>';
211
+ DUP_Util::_e("If the scanner is unable to locate the wp-config.php file in the root directory, then you will need to manually copy it to its new location.");
212
+ echo '</small>';
213
+
214
+ //CACHE DIR
215
+ $cache_path = $cache_path = DUP_Util::SafePath(WP_CONTENT_DIR) . '/cache';
216
+ $cache_size = DUP_Util::ByteSize(DUP_Util::GetDirectorySize($cache_path));
217
+ echo '<hr size="1" /><span id="data-srv-wp-cache"></span>&nbsp;<b>' . DUP_Util::__('Cache Path') . ":</b>&nbsp; '{$cache_path}' ({$cache_size}) <br/>";
218
+ echo '<small>';
219
+ DUP_Util::_e("Cached data will lead to issues at install time and increases your archive size. It is recommended to empty your cache directory at build time. Use caution when removing data from the cache directory. If you have a cache plugin review the documentation for how to empty it; simply removing files might cause errors on your site. The cache size minimum threshold is currently set at ");
220
+ echo DUP_Util::ByteSize(DUPLICATOR_SCAN_CACHESIZE) . '.';
221
+ echo '</small>';
222
+
223
+ ?>
224
+ </div>
225
+ </div>
226
+ </div><!-- end .dup-panel -->
227
+ </div><!-- end .dup-panel-panel -->
228
+
229
+ <h2 style="font-size:18px; font-weight:bold; margin:-15px 0 0 10px"><i class="fa fa-file-archive-o"></i>&nbsp;<?php DUP_Util::_e('Archive');?> </h2>
230
+
231
+ <!-- ================================================================
232
+ FILES
233
+ ================================================================ -->
234
+ <div class="dup-panel">
235
+ <div class="dup-panel-title">
236
+ <i class="fa fa-files-o"></i>
237
+ <?php DUP_Util::_e("Files"); ?>
238
+ <div id="data-arc-size1"></div>
239
+ <div class="dup-scan-filter-status">
240
+ <?php
241
+ if ($Package->Archive->FilterOn) {
242
+ echo '<i class="fa fa-filter"></i> '; DUP_Util::_e('Enabled');
243
+ }
244
+ ?>
245
+ </div>
246
+ </div>
247
+ <div class="dup-panel-panel">
248
+
249
+ <!-- ============
250
+ TOTAL SIZE -->
251
+ <div>
252
+ <div class='dup-scan-title'>
253
+ <a><?php DUP_Util::_e('Total Size');?></a> <div id="data-arc-status-size"></div>
254
+ </div>
255
+ <div class='dup-scan-info dup-info-box'>
256
+ <b><?php DUP_Util::_e('Size');?>:</b> <span id="data-arc-size2"></span> &nbsp; | &nbsp;
257
+ <b><?php DUP_Util::_e('File Count');?>:</b> <span id="data-arc-files"></span> &nbsp; | &nbsp;
258
+ <b><?php DUP_Util::_e('Directory Count');?>:</b> <span id="data-arc-dirs"></span>
259
+ <small>
260
+ <?php
261
+ printf(DUP_Util::__('Total size represents all files minus any filters that have been setup. The current thresholds that triggers a warning is %1$s for the total size. Some budget hosts limit the amount of time a PHP/Web request process can run. When working with larger sites this can cause timeout issues. Consider using a file filter in step 1 to shrink and filter the overall size of your package.'),
262
+ DUP_Util::ByteSize(DUPLICATOR_SCAN_SITE),
263
+ DUP_Util::ByteSize(DUPLICATOR_SCAN_WARNFILESIZE));
264
+
265
+ if ($zip_check != null) {
266
+ echo '<br/><br/>';
267
+ echo '<span style="font-weight:bold">';
268
+ DUP_Util::_e('Package support up to 2GB available in Duplicator Pro.');
269
+ echo '</span>';
270
+ echo "&nbsp;<i><a href='http://snapcreek.com/duplicator?free-size-warn' target='_blank'>[" . DUP_Util::__('details') . "]</a></i>";
271
+ }
272
+
273
+ ?>
274
+ </small>
275
+ </div>
276
+ </div>
277
+
278
+ <!-- ============
279
+ FILE NAME LENGTHS -->
280
+ <div>
281
+ <div class='dup-scan-title'>
282
+ <a><?php DUP_Util::_e('Name Checks');?></a> <div id="data-arc-status-names"></div>
283
+ </div>
284
+ <div class='dup-scan-info dup-info-box'>
285
+ <small>
286
+ <?php
287
+ DUP_Util::_e('File or directory names may cause issues when working across different environments and servers. Names that are over 250 characters, contain special characters (such as * ? > < : / \ |) or are unicode might cause issues in a remote enviroment. It is recommended to remove or filter these files before building the archive if you have issues at install time.');
288
+ ?>
289
+ </small><br/>
290
+ <a href="javascript:void(0)" onclick="jQuery('#data-arc-names-data').toggle()">[<?php DUP_Util::_e('Show Paths');?>]</a>
291
+ <div id="data-arc-names-data"></div>
292
+ </div>
293
+ </div>
294
+
295
+ <!-- ============
296
+ LARGE FILES -->
297
+ <div>
298
+ <div class='dup-scan-title'>
299
+ <a><?php DUP_Util::_e('Large Files');?></a> <div id="data-arc-status-big"></div>
300
+ </div>
301
+ <div class='dup-scan-info dup-info-box'>
302
+ <small>
303
+ <?php
304
+ printf(DUP_Util::__('Large files such as movies or other backuped data can cause issues with timeouts. The current check for large files is %1$s per file. If your having issues creating a package consider excluding these files with the files filter and manually moving them to your new location.'),
305
+ DUP_Util::ByteSize(DUPLICATOR_SCAN_WARNFILESIZE));
306
+ ?>
307
+ </small><br/>
308
+ <a href="javascript:void(0)" onclick="jQuery('#data-arc-big-data').toggle()">[<?php DUP_Util::_e('Show Paths');?>]</a>
309
+ <div id="data-arc-big-data"></div>
310
+ </div>
311
+ </div>
312
+
313
+ <!-- ============
314
+ VIEW FILTERS -->
315
+ <?php if ($Package->Archive->FilterOn) : ?>
316
+ <div>
317
+ <div class='dup-scan-title'>
318
+ <a style='font-weight: normal'><?php DUP_Util::_e('Archive Details');?></a>
319
+ </div>
320
+ <div class='dup-scan-info dup-info-box'>
321
+ <b>[<?php DUP_Util::_e('Root Directory');?>]</b><br/>
322
+ <?php echo DUPLICATOR_WPROOTPATH;?>
323
+ <br/><br/>
324
+
325
+ <b>[<?php DUP_Util::_e('Excluded Directories');?>]</b><br/>
326
+ <?php
327
+ if (strlen( $Package->Archive->FilterDirs)) {
328
+ echo str_replace(";", "<br/>", $Package->Archive->FilterDirs);
329
+ } else {
330
+ DUP_Util::_e('No directory filters have been set.');
331
+ }
332
+ ?>
333
+ <br/>
334
+
335
+ <b>[<?php DUP_Util::_e('Excluded File Extensions');?>]</b><br/>
336
+ <?php
337
+ if (strlen( $Package->Archive->FilterExts)) {
338
+ echo $Package->Archive->FilterExts;
339
+ } else {
340
+ DUP_Util::_e('No file extension filters have been set.');
341
+ }
342
+ ?>
343
+ <small>
344
+ <?php
345
+ DUP_Util::_e('The root directory is where Duplicator starts archiving files. The excluded sections will be skipped during the archive process. ');
346
+ DUP_Util::_e('All results are stored in a json file. ');
347
+ ?>
348
+ <a href="<?php echo DUPLICATOR_SITE_URL ?>/wp-admin/admin-ajax.php?action=duplicator_package_scan" target="dup_report"><?php DUP_Util::_e('[view json report]');?></a>
349
+ </small><br/>
350
+ </div>
351
+ </div>
352
+ <?php endif; ?>
353
+ </div><!-- end .dup-panel -->
354
+ <br/>
355
+
356
+ <!-- ================================================================
357
+ DATABASE
358
+ ================================================================ -->
359
+ <div class="dup-panel-title">
360
+ <i class="fa fa-table"></i>
361
+ <?php DUP_Util::_e("Database"); ?>
362
+ <div id="data-db-size1"></div>
363
+ <div class="dup-scan-filter-status">
364
+ <?php
365
+ if ($Package->Database->FilterOn) {
366
+ echo '<i class="fa fa-filter"></i> '; DUP_Util::_e('Enabled');
367
+ }
368
+ ?>
369
+ </div>
370
+ </div>
371
+ <div class="dup-panel-panel" id="dup-scan-db">
372
+
373
+ <!-- ============
374
+ TOTAL SIZE -->
375
+ <div>
376
+ <div class='dup-scan-title'>
377
+ <a><?php DUP_Util::_e('Total Size');?></a>
378
+ <div id="data-db-status-size1"></div>
379
+ </div>
380
+ <div class='dup-scan-info dup-info-box'>
381
+ <b><?php DUP_Util::_e('Tables');?>:</b> <span id="data-db-tablecount"></span> &nbsp; | &nbsp;
382
+ <b><?php DUP_Util::_e('Records');?>:</b> <span id="data-db-rows"></span> &nbsp; | &nbsp;
383
+ <b><?php DUP_Util::_e('Size');?>:</b> <span id="data-db-size2"></span> <br/><br/>
384
+ <?php
385
+ $lnk = '<a href="maint/repair.php" target="_blank">' . DUP_Util::__('repair and optimization') . '</a>';
386
+ printf(DUP_Util::__('Total size and row count for all database tables are approximate values. The thresholds that trigger warnings are %1$s and %2$s records. Large databases take time to process and can cause issues with server timeout and memory settings. Running a %3$s on your database can also help improve the overall size and performance. If your server supports shell_exec and mysqldump you can try to enable this option from the settings menu.'),
387
+ DUP_Util::ByteSize(DUPLICATOR_SCAN_DBSIZE),
388
+ number_format(DUPLICATOR_SCAN_DBROWS),
389
+ $lnk);
390
+ ?>
391
+ </div>
392
+ </div>
393
+
394
+ <!-- ============
395
+ TABLE DETAILS -->
396
+ <div>
397
+ <div class='dup-scan-title'>
398
+ <a><?php DUP_Util::_e('Table Details');?></a>
399
+ <div id="data-db-status-size2"></div>
400
+ </div>
401
+ <div class='dup-scan-info dup-info-box'>
402
+ <div id="dup-scan-db-info">
403
+ <div id="data-db-tablelist"></div>
404
+ </div>
405
+ </div>
406
+ </div>
407
+
408
+ <table id="dup-scan-db-details">
409
+ <tr><td><b><?php DUP_Util::_e('Name:');?></b></td><td><?php echo DB_NAME ;?> </td></tr>
410
+ <tr><td><b><?php DUP_Util::_e('Host:');?></b></td><td><?php echo DB_HOST ;?> </td></tr>
411
+ <tr>
412
+ <td style="vertical-align: top"><b><?php DUP_Util::_e('Build Mode:');?></b></td>
413
+ <td style="line-height:18px">
414
+ <a href="?page=duplicator-settings" target="_blank"><?php echo $dbbuild_mode ;?></a>
415
+ <?php if ($mysqlcompat_on) :?>
416
+ <br/>
417
+ <small style="font-style:italic; color:maroon">
418
+ <i class="fa fa-exclamation-circle"></i> <?php DUP_Util::_e('MySQL Compatibility Mode Enabled'); ?>
419
+ <a href="https://dev.mysql.com/doc/refman/5.7/en/mysqldump.html#option_mysqldump_compatible" target="_blank">[<?php DUP_Util::_e('details'); ?>]</a>
420
+ </small>
421
+ <?php endif;?>
422
+ </td>
423
+ </tr>
424
+ </table>
425
+
426
+ </div><!-- end .dup-panel -->
427
+ </div><!-- end .dup-panel-panel -->
428
+
429
+ <!-- WARNING CONTINUE -->
430
+ <div id="dup-scan-warning-continue">
431
+ <div class="msg1">
432
+ <input type="checkbox" id="dup-scan-warning-continue-checkbox" onclick="Duplicator.Pack.WarningContinue(this)"/>
433
+ <label for="dup-scan-warning-continue-checkbox"><?php DUP_Util::_e('A warning status was detected, are you sure you want to continue?');?></label>
434
+ </div>
435
+ <div class="msg2">
436
+ <label for="dup-scan-warning-continue-checkbox">
437
+ <?php
438
+ DUP_Util::_e("Scan checks are not required to pass, however they could cause issues on some systems.");
439
+ echo '<br/>';
440
+ DUP_Util::_e("Please review the details for each warning by clicking on the detail link.");
441
+ ?>
442
+ </label>
443
+ </div>
444
+ </div>
445
+
446
+ </div>
447
+
448
+
449
+
450
+ <!-- ERROR MESSAGE -->
451
+ <div id="dup-msg-error" style="display:none">
452
+ <div class="dup-hdr-error"><i class="fa fa-exclamation-circle"></i> <?php DUP_Util::_e('Scan Error'); ?></div>
453
+ <i><?php DUP_Util::_e('Please try again!'); ?></i><br/>
454
+ <div style="text-align:left">
455
+ <b><?php DUP_Util::_e("Server Status:"); ?></b> &nbsp;
456
+ <div id="dup-msg-error-response-status" style="display:inline-block"></div><br/>
457
+
458
+ <b><?php DUP_Util::_e("Error Message:"); ?></b>
459
+ <div id="dup-msg-error-response-text"></div>
460
+ </div>
461
+ </div>
462
+ </div> <!-- end #dup-progress-area -->
463
+
464
+ <div class="dup-button-footer" style="display:none">
465
+ <input type="button" value="&#9668; <?php DUP_Util::_e("Back") ?>" onclick="window.location.assign('?page=duplicator&tab=new1')" class="button button-large" />
466
+ <input type="button" value="<?php DUP_Util::_e("Rescan") ?>" onclick="Duplicator.Pack.Rescan()" class="button button-large" />
467
+ <input type="submit" value="<?php DUP_Util::_e("Build") ?> &#9658" class="button button-primary button-large" id="dup-build-button" />
468
+ <!-- Used for iMacros testing do not remove -->
469
+ <div id="dup-automation-imacros"></div>
470
+ </div>
471
+ </form>
472
+
473
+ <script type="text/javascript">
474
+ jQuery(document).ready(function($) {
475
+
476
+ /* Performs Ajax post to create check system */
477
+ Duplicator.Pack.Scan = function() {
478
+ var data = {action : 'duplicator_package_scan'}
479
+
480
+ $.ajax({
481
+ type: "POST",
482
+ url: ajaxurl,
483
+ dataType: "json",
484
+ timeout: 10000000,
485
+ data: data,
486
+ complete: function() {$('.dup-button-footer').show()},
487
+ success: function(data) {
488
+ Duplicator.Pack.LoadScanData(data)
489
+ //Imacros testing required
490
+ $('#dup-automation-imacros').html('<input type="hidden" id="dup-finished" value="done" />');
491
+ },
492
+ error: function(data) {
493
+ $('#dup-progress-bar-area').hide();
494
+ var status = data.status + ' -' + data.statusText;
495
+ $('#dup-msg-error-response-status').html(status)
496
+ $('#dup-msg-error-response-text').html(data.responseText);
497
+ $('#dup-msg-error').show(200);
498
+ console.log(data);
499
+ }
500
+ });
501
+ }
502
+
503
+ Duplicator.Pack.Rescan = function() {
504
+ $('#dup-msg-success,#dup-msg-error,.dup-button-footer').hide();
505
+ $('#dup-progress-bar-area').show();
506
+ Duplicator.Pack.Scan();
507
+ }
508
+
509
+ Duplicator.Pack.WarningContinue = function(checkbox) {
510
+ ($(checkbox).is(':checked'))
511
+ ? $('#dup-build-button').prop('disabled',false).addClass('button-primary')
512
+ : $('#dup-build-button').prop('disabled',true).removeClass('button-primary');
513
+
514
+ }
515
+
516
+ Duplicator.Pack.LoadScanStatus = function(status) {
517
+ var result;
518
+ switch (status) {
519
+ case false : result = '<div class="dup-scan-warn"><i class="fa fa-exclamation-triangle"></i></div>'; break;
520
+ case 'Warn' : result = '<div class="dup-scan-warn"><i class="fa fa-exclamation-triangle"></i> Warn</div>'; break;
521
+ case true : result = '<div class="dup-scan-good"><i class="fa fa-check"></i></div>'; break;
522
+ case 'Good' : result = '<div class="dup-scan-good"><i class="fa fa-check"></i> Good</div>'; break;
523
+ default :
524
+ result = 'unable to read';
525
+ }
526
+ return result;
527
+ }
528
+
529
+ /* Load Scan Data */
530
+ Duplicator.Pack.LoadScanData = function(data) {
531
+
532
+ var errMsg = "unable to read";
533
+ $('#dup-progress-bar-area').hide();
534
+
535
+ //****************
536
+ //REPORT
537
+ var base = $('#data-rpt-scanfile').attr('href');
538
+ $('#data-rpt-scanfile').attr('href', base + '&scanfile=' + data.RPT.ScanFile);
539
+ $('#data-rpt-scantime').text(data.RPT.ScanTime || 0);
540
+
541
+
542
+ //****************
543
+ //SERVER
544
+ $('#data-srv-web-model').html(Duplicator.Pack.LoadScanStatus(data.SRV.WEB.model));
545
+ $('#data-srv-web-all').html(Duplicator.Pack.LoadScanStatus(data.SRV.WEB.ALL));
546
+
547
+ $('#data-srv-php-openbase').html(Duplicator.Pack.LoadScanStatus(data.SRV.PHP.openbase));
548
+ $('#data-srv-php-maxtime').html(Duplicator.Pack.LoadScanStatus(data.SRV.PHP.maxtime));
549
+ $('#data-srv-php-mysqli').html(Duplicator.Pack.LoadScanStatus(data.SRV.PHP.mysqli));
550
+ $('#data-srv-php-openssl').html(Duplicator.Pack.LoadScanStatus(data.SRV.PHP.openssl));
551
+ $('#data-srv-php-all').html(Duplicator.Pack.LoadScanStatus(data.SRV.PHP.ALL));
552
+
553
+ $('#data-srv-wp-version').html(Duplicator.Pack.LoadScanStatus(data.SRV.WP.version));
554
+ $('#data-srv-wp-core').html(Duplicator.Pack.LoadScanStatus(data.SRV.WP.core));
555
+ $('#data-srv-wp-cache').html(Duplicator.Pack.LoadScanStatus(data.SRV.WP.cache));
556
+ $('#data-srv-wp-all').html(Duplicator.Pack.LoadScanStatus(data.SRV.WP.ALL));
557
+
558
+ //****************
559
+ //DATABASE
560
+ var html = "";
561
+ if (data.DB.Status.Success) {
562
+ $('#data-db-status-size1').html(Duplicator.Pack.LoadScanStatus(data.DB.Status.Size));
563
+ $('#data-db-status-size2').html(Duplicator.Pack.LoadScanStatus(data.DB.Status.Size));
564
+ $('#data-db-size1').text(data.DB.Size || errMsg);
565
+ $('#data-db-size2').text(data.DB.Size || errMsg);
566
+ $('#data-db-rows').text(data.DB.Rows || errMsg);
567
+ $('#data-db-tablecount').text(data.DB.TableCount || errMsg);
568
+ //Table Details
569
+ if (data.DB.TableList == undefined || data.DB.TableList.length == 0) {
570
+ html = '<?php DUP_Util::_e("Unable to report on any tables") ?>';
571
+ } else {
572
+ $.each(data.DB.TableList, function(i) {
573
+ html += '<b>' + i + '</b><br/>';
574
+ $.each(data.DB.TableList[i], function(key,val) {html += '<div><span>' + key + ':</span>' + val + '</div>'; })
575
+ });
576
+ }
577
+ $('#data-db-tablelist').append(html);
578
+ } else {
579
+ html = '<?php DUP_Util::_e("Unable to report on database stats") ?>';
580
+ $('#dup-scan-db').html(html);
581
+ }
582
+
583
+ //****************
584
+ //ARCHIVE
585
+ $('#data-arc-status-size').html(Duplicator.Pack.LoadScanStatus(data.ARC.Status.Size));
586
+ $('#data-arc-status-names').html(Duplicator.Pack.LoadScanStatus(data.ARC.Status.Names));
587
+ $('#data-arc-status-big').html(Duplicator.Pack.LoadScanStatus(data.ARC.Status.Big));
588
+ $('#data-arc-size1').text(data.ARC.Size || errMsg);
589
+ $('#data-arc-size2').text(data.ARC.Size || errMsg);
590
+ $('#data-arc-files').text(data.ARC.FileCount || errMsg);
591
+ $('#data-arc-dirs').text(data.ARC.DirCount || errMsg);
592
+
593
+
594
+
595
+ //Name Checks
596
+ html = '';
597
+ //Dirs
598
+ if (data.ARC.FilterInfo.Dirs.Warning !== undefined && data.ARC.FilterInfo.Dirs.Warning.length > 0) {
599
+ $.each(data.ARC.FilterInfo.Dirs.Warning, function (key, val) {
600
+ html += '<?php DUP_Util::_e("DIR") ?> ' + key + ':<br/>[' + val + ']<br/>';
601
+ });
602
+ }
603
+ //Files
604
+ if (data.ARC.FilterInfo.Files.Warning !== undefined && data.ARC.FilterInfo.Files.Warning.length > 0) {
605
+ $.each(data.ARC.FilterInfo.Files.Warning, function (key, val) {
606
+ html += '<?php DUP_Util::_e("FILE") ?> ' + key + ':<br/>[' + val + ']<br/>';
607
+ });
608
+ }
609
+ html = (html.length == 0) ? '<?php DUP_Util::_e("No name warning issues found.") ?>' : html;
610
+
611
+
612
+ $('#data-arc-names-data').html(html);
613
+
614
+ //Large Files
615
+ html = '<?php DUP_Util::_e("No large files found.") ?>';
616
+ if (data.ARC.FilterInfo.Files.Size !== undefined && data.ARC.FilterInfo.Files.Size.length > 0) {
617
+ html = '';
618
+ $.each(data.ARC.FilterInfo.Files.Size, function (key, val) {
619
+ html += '<?php DUP_Util::_e("FILE") ?> ' + key + ':<br/>' + val + '<br/>';
620
+ });
621
+ }
622
+ $('#data-arc-big-data').html(html);
623
+ $('#dup-msg-success').show();
624
+
625
+ //Waring Check
626
+ var warnCount = data.RPT.Warnings || 0;
627
+ if (warnCount > 0) {
628
+ $('#dup-scan-warning-continue').show();
629
+ $('#dup-build-button').prop("disabled",true).removeClass('button-primary');
630
+ } else {
631
+ $('#dup-scan-warning-continue').hide();
632
+ $('#dup-build-button').prop("disabled",false).addClass('button-primary');
633
+ }
634
+
635
+ }
636
+
637
+ //Page Init:
638
+ Duplicator.UI.AnimateProgressBar('dup-progress-bar');
639
+ Duplicator.Pack.Scan();
640
+
641
+ //Init: Toogle for system requirment detial links
642
+ $('.dup-scan-title a').each(function() {
643
+ $(this).attr('href', 'javascript:void(0)');
644
+ $(this).click({selector : '.dup-scan-info'}, Duplicator.Pack.ToggleSystemDetails);
645
+ $(this).prepend("<span class='ui-icon ui-icon-triangle-1-e dup-toggle' />");
646
+ });
647
+
648
+ });
649
  </script>
views/packages/main/new3.base.php CHANGED
@@ -1,205 +1,204 @@
1
- <?php
2
- require_once (DUPLICATOR_PLUGIN_PATH . 'classes/package.php');
3
- $Package = DUP_Package::GetActive();
4
-
5
-
6
-
7
- ?>
8
-
9
- <style>
10
- div#dup-progress-area {text-align:center; max-width:800px; min-height:200px; border:1px solid silver; border-radius:5px; margin:25px auto 10px auto; padding:0px; box-shadow: 0 8px 6px -6px #999;}
11
- div.dup-progress-title {font-size:22px;padding:5px 0 20px 0; font-weight: bold}
12
- div#dup-progress-area div.inner {padding:10px; line-height:22px}
13
- div#dup-progress-area h2.title {background-color:#efefef; margin:0px}
14
- div#dup-progress-area span.label {font-weight:bold}
15
- div#dup-msg-success {color:#18592A; padding:5px;}
16
- div#dup-msg-success fieldset,
17
- div#dup-msg-error fieldset {text-align:left; width:95%; border:1px solid #dfdfdf; border-radius:5px;}
18
- div.dup-msg-error-area {overflow-y: scroll; padding:5px 15px 5px 15px; max-height:150px; max-width: 700px}
19
- div.dup-msg-success-stats{color:#999;margin:10px 0px 0px 0px}
20
- div.dup-msg-success-links {margin:20px 5px 5px 5px; font-size: 14px; font-weight: bold}
21
- div#dup-msg-error {color:#A62426; padding:5px;}
22
- div#dup-progress-area div.done-title {font-size:22px; font-weight:bold; margin:0px 0px 10px 0px}
23
- div#dup-logs {text-align:center; margin:auto; padding:5px; width:350px;}
24
- div#dup-logs a {font-size:15px; text-decoration:none !important; display:inline-block; margin:20px 0px 5px 0px}
25
- div.dup-button-footer {text-align:right; margin:20px 10px 0px 0px}
26
- button.button {font-size:16px !important; height:30px !important; font-weight:bold; padding:0px 10px 5px 10px !important; min-width: 150px }
27
- span.dup-btn-size {font-size:11px;font-weight: normal}
28
- </style>
29
-
30
- <!-- =========================================
31
- TOOL BAR: STEPS -->
32
- <table id="dup-toolbar">
33
- <tr valign="top">
34
- <td style="white-space: nowrap">
35
- <div id="dup-wiz">
36
- <div id="dup-wiz-steps">
37
- <div class="completed-step"><a><span>1</span> <?php _e('Setup', 'duplicator'); ?></a></div>
38
- <div class="completed-step"><a><span>2</span> <?php _e('Scan', 'duplicator'); ?> </a></div>
39
- <div class="active-step"><a><span>3</span> <?php _e('Build', 'duplicator'); ?> </a></div>
40
- </div>
41
- <div id="dup-wiz-title">
42
- <?php _e('Step 3: Build Package', 'duplicator'); ?>
43
- </div>
44
- </div>
45
- </td>
46
- <td class="dup-toolbar-btns">
47
- <a id="dup-pro-create-new" href="?page=duplicator" class="add-new-h2"><i class="fa fa-archive"></i> <?php _e("All Packages", 'duplicator'); ?></a> &nbsp;
48
- <span> <?php _e("Create New", 'duplicator'); ?></span>
49
- </td>
50
- </tr>
51
- </table>
52
- <hr style="margin-bottom:10px">
53
-
54
-
55
- <form id="form-duplicator" method="post" action="?page=duplicator">
56
-
57
- <!-- PROGRESS BAR -->
58
- <div id="dup-progress-bar-area">
59
- <div class="dup-progress-title"><i class="fa fa-cog fa-spin"></i> <?php _e('Building Package', 'duplicator'); ?></div>
60
- <div id="dup-progress-bar"></div>
61
- <b><?php _e('Please Wait...', 'duplicator'); ?></b><br/><br/>
62
- <i><?php _e('Keep this window open during the build process.', 'duplicator'); ?></i><br/>
63
- <i><?php _e('This may take several minutes.', 'duplicator'); ?></i><br/>
64
- </div>
65
-
66
- <div id="dup-progress-area" class="dup-panel" style="display:none">
67
- <div class="dup-panel-title dup-box-title-fancy"><b style="font-size:18px"><?php _e('Build Status', 'duplicator'); ?></b></div>
68
- <div class="dup-panel-panel">
69
-
70
- <!-- =========================
71
- SUCCESS MESSAGE -->
72
- <div id="dup-msg-success" style="display:none">
73
- <div class="dup-hdr-success">
74
- <i class="fa fa-check-square-o fa-lg"></i> <?php _e('Package Completed', 'duplicator'); ?>
75
- </div>
76
-
77
- <div class="dup-msg-success-stats">
78
- <b><?php _e('Name', 'duplicator'); ?>:</b> <span id="data-name-hash"></span><br/>
79
- <b><?php _e('Process Time', 'duplicator'); ?>:</b> <span id="data-time"></span><br/>
80
- </div><br/>
81
-
82
- <button id="dup-btn-installer" class="button button-primary button-large">
83
- <i class="fa fa-bolt"></i> <?php _e("Installer", 'duplicator') ?>
84
- <span id="dup-btn-installer-size" class="dup-btn-size"></span>
85
- </button> &nbsp;
86
- <button id="dup-btn-archive" class="button button-primary button-large">
87
- <i class="fa fa-file-archive-o"></i> <?php _e("Archive", 'duplicator') ?>
88
- <span id="dup-btn-archive-size" class="dup-btn-size"></span>
89
- </button>
90
- <div style='margin: 7px 0 20px 0'>
91
- <small><i><?php _e("click buttons to download", 'duplicator') ?></i></small>
92
- </div>
93
- <div class="dup-msg-success-links">
94
- <?php printf("<a href='?page=duplicator'>[ %s ]</a>", __('All Packages', 'duplicator'));?>
95
- </div><br/>
96
-
97
- <!-- Used for iMacros testing do not remove -->
98
- <div id="dup-automation-imacros"></div>
99
- </div>
100
-
101
- <!-- =========================
102
- ERROR MESSAGE -->
103
- <div id="dup-msg-error" style="display:none">
104
- <div class="done-title"><i class="fa fa-chain-broken"></i> <?php _e('Build Interrupt', 'duplicator'); ?></div>
105
- <b><?php _e('The current build has experienced an issue.', 'duplicator'); ?></b><br/>
106
-
107
- <i><?php _e('Please try the process again.', 'duplicator'); ?></i><br/><br/>
108
-
109
- <input type="button" style="margin-right:10px;" class="button" value="<?php _e('Diagnose', 'duplicator'); ?>" onclick="window.open('http://lifeinthegrid.com/support/knowledgebase.php?article=12#faq-trouble-timeout', '_blank');return false;" />
110
- <input type="button" class="button" value="<?php _e('Try Again', 'duplicator'); ?>" onclick="window.location = 'admin.php?page=duplicator&tab=new1'" />
111
- <fieldset>
112
- <legend><b><i class="fa fa-exclamation"></i> <?php _e('Details', 'duplicator'); ?></b></legend>
113
- <div class="dup-msg-error-area">
114
- <div id="dup-msg-error-response-status">
115
- <span class="label"><?php _e("Server Status:", 'duplicator'); ?></span>
116
- <span class="data"></span>
117
- </div>
118
- <div id="dup-msg-error-response-text">
119
- <span class="label"><?php _e("Error Message:", 'duplicator'); ?></span><br/>
120
- <span class="data"></span>
121
- </div>
122
- </div>
123
- </fieldset><br/>
124
-
125
- <fieldset style="color:#777">
126
- <legend><b> <?php _e('Notice', 'duplicator'); ?></b></legend>
127
- <div class="dup-msg-error-area">
128
- <?php printf('<b><i class="fa fa-folder-o"></i> %s %s</b> <br/> %s',
129
- __('Build Folder:'),
130
- DUPLICATOR_SSDIR_PATH_TMP,
131
- __("Some servers close connections quickly; yet the build can continue to run in the background. To validate if a build is still running; open the 'tmp' folder above and see if the archive file is growing in size. If it is not then your server has strict timeout constraints. Please visit the support page for additional resources.", 'duplicator')
132
- );
133
- ?> <br/>
134
- </div>
135
- </fieldset>
136
-
137
- <!-- LOGS -->
138
- <div id="dup-logs">
139
- <div style="font-weight:bold">
140
- <i class="fa fa-list-alt"></i> <a href='javascript:void(0)' style="color:#A62426" onclick='Duplicator.OpenLogWindow()'> <?php _e('Package Log', 'duplicator');?> </a>
141
- </div>
142
- <br/>
143
- </div>
144
-
145
- </div>
146
-
147
- </div>
148
- </div>
149
- </form>
150
-
151
- <script type="text/javascript">
152
- jQuery(document).ready(function($) {
153
- /* ----------------------------------------
154
- * METHOD: Performs Ajax post to create a new package
155
- * Timeout (10000000 = 166 minutes) */
156
- Duplicator.Pack.Create = function() {
157
-
158
- var data = {action : 'duplicator_package_build'}
159
-
160
- $.ajax({
161
- type: "POST",
162
- url: ajaxurl,
163
- dataType: "json",
164
- timeout: 10000000,
165
- data: data,
166
- beforeSend: function() {},
167
- complete: function() {},
168
- success: function(data) {
169
- $('#dup-progress-bar-area').hide();
170
- $('#dup-progress-area, #dup-msg-success').show(300);
171
-
172
- var Pack = data.Package;
173
- var InstallURL = Pack.StoreURL + Pack.Installer.File + "?get=1&file=" + Pack.Installer.File;
174
- var ArchiveURL = Pack.StoreURL + Pack.Archive.File + "?get=1";
175
-
176
- $('#dup-btn-archive-size').append('&nbsp; (' + data.ZipSize + ')')
177
- $('#data-name-hash').text(Pack.NameHash || 'error read');
178
- $('#data-time').text(data.Runtime || 'unable to read time');
179
-
180
- //Wire Up Downloads
181
- $('#dup-btn-installer').on("click", {name: InstallURL }, Duplicator.Pack.DownloadFile );
182
- $('#dup-btn-archive').on("click", {name: ArchiveURL }, Duplicator.Pack.DownloadFile );
183
- //Imacros testing required
184
- $('#dup-automation-imacros').html('<input type="hidden" id="dup-finished" value="done" />');
185
-
186
- },
187
- error: function(data) {
188
- $('#dup-progress-bar-area').hide();
189
- $('#dup-progress-area, #dup-msg-error').show(200);
190
- var status = data.status + ' -' + data.statusText;
191
- var response = (data.responseText != undefined && data.responseText.length > 1) ? data.responseText : 'Unknown Error - See Log File';
192
- $('#dup-msg-error-response-status span.data').html(status)
193
- $('#dup-msg-error-response-text span.data').html(response);
194
- console.log(data);
195
- }
196
- });
197
- return false;
198
- }
199
-
200
- //Page Init:
201
- Duplicator.UI.AnimateProgressBar('dup-progress-bar');
202
- Duplicator.Pack.Create();
203
-
204
- });
205
  </script>
1
+ <?php
2
+ require_once (DUPLICATOR_PLUGIN_PATH . 'classes/package.php');
3
+ $Package = DUP_Package::GetActive();
4
+ $ajax_nonce = wp_create_nonce('dup_package_build');
5
+
6
+ ?>
7
+
8
+ <style>
9
+ div#dup-progress-area {text-align:center; max-width:800px; min-height:200px; border:1px solid silver; border-radius:5px; margin:25px auto 10px auto; padding:0px; box-shadow: 0 8px 6px -6px #999;}
10
+ div.dup-progress-title {font-size:22px;padding:5px 0 20px 0; font-weight: bold}
11
+ div#dup-progress-area div.inner {padding:10px; line-height:22px}
12
+ div#dup-progress-area h2.title {background-color:#efefef; margin:0px}
13
+ div#dup-progress-area span.label {font-weight:bold}
14
+ div#dup-msg-success {color:#18592A; padding:5px;}
15
+ div#dup-msg-success fieldset,
16
+ div#dup-msg-error fieldset {text-align:left; width:95%; border:1px solid #dfdfdf; border-radius:5px;}
17
+ div.dup-msg-error-area {overflow-y: scroll; padding:5px 15px 5px 15px; max-height:150px; max-width: 700px}
18
+ div.dup-msg-success-stats{color:#999;margin:10px 0px 0px 0px}
19
+ div.dup-msg-success-links {margin:20px 5px 5px 5px; font-size: 14px; font-weight: bold}
20
+ div#dup-msg-error {color:#A62426; padding:5px;}
21
+ div#dup-progress-area div.done-title {font-size:22px; font-weight:bold; margin:0px 0px 10px 0px}
22
+ div#dup-logs {text-align:center; margin:auto; padding:5px; width:350px;}
23
+ div#dup-logs a {font-size:15px; text-decoration:none !important; display:inline-block; margin:20px 0px 5px 0px}
24
+ div.dup-button-footer {text-align:right; margin:20px 10px 0px 0px}
25
+ button.button {font-size:16px !important; height:30px !important; font-weight:bold; padding:0px 10px 5px 10px !important; min-width: 150px }
26
+ span.dup-btn-size {font-size:11px;font-weight: normal}
27
+ </style>
28
+
29
+ <!-- =========================================
30
+ TOOL BAR: STEPS -->
31
+ <table id="dup-toolbar">
32
+ <tr valign="top">
33
+ <td style="white-space: nowrap">
34
+ <div id="dup-wiz">
35
+ <div id="dup-wiz-steps">
36
+ <div class="completed-step"><a><span>1</span> <?php _e('Setup', 'duplicator'); ?></a></div>
37
+ <div class="completed-step"><a><span>2</span> <?php _e('Scan', 'duplicator'); ?> </a></div>
38
+ <div class="active-step"><a><span>3</span> <?php _e('Build', 'duplicator'); ?> </a></div>
39
+ </div>
40
+ <div id="dup-wiz-title">
41
+ <?php _e('Step 3: Build Package', 'duplicator'); ?>
42
+ </div>
43
+ </div>
44
+ </td>
45
+ <td class="dup-toolbar-btns">
46
+ <a id="dup-pro-create-new" href="?page=duplicator" class="add-new-h2"><i class="fa fa-archive"></i> <?php _e("All Packages", 'duplicator'); ?></a> &nbsp;
47
+ <span> <?php _e("Create New", 'duplicator'); ?></span>
48
+ </td>
49
+ </tr>
50
+ </table>
51
+ <hr style="margin-bottom:10px">
52
+
53
+
54
+ <form id="form-duplicator" method="post" action="?page=duplicator">
55
+
56
+ <!-- PROGRESS BAR -->
57
+ <div id="dup-progress-bar-area">
58
+ <div class="dup-progress-title"><i class="fa fa-cog fa-spin"></i> <?php _e('Building Package', 'duplicator'); ?></div>
59
+ <div id="dup-progress-bar"></div>
60
+ <b><?php _e('Please Wait...', 'duplicator'); ?></b><br/><br/>
61
+ <i><?php _e('Keep this window open during the build process.', 'duplicator'); ?></i><br/>
62
+ <i><?php _e('This may take several minutes.', 'duplicator'); ?></i><br/>
63
+ </div>
64
+
65
+ <div id="dup-progress-area" class="dup-panel" style="display:none">
66
+ <div class="dup-panel-title dup-box-title-fancy"><b style="font-size:18px"><?php _e('Build Status', 'duplicator'); ?></b></div>
67
+ <div class="dup-panel-panel">
68
+
69
+ <!-- =========================
70
+ SUCCESS MESSAGE -->
71
+ <div id="dup-msg-success" style="display:none">
72
+ <div class="dup-hdr-success">
73
+ <i class="fa fa-check-square-o fa-lg"></i> <?php _e('Package Completed', 'duplicator'); ?>
74
+ </div>
75
+
76
+ <div class="dup-msg-success-stats">
77
+ <b><?php _e('Name', 'duplicator'); ?>:</b> <span id="data-name-hash"></span><br/>
78
+ <b><?php _e('Process Time', 'duplicator'); ?>:</b> <span id="data-time"></span><br/>
79
+ </div><br/>
80
+
81
+ <button id="dup-btn-installer" class="button button-primary button-large">
82
+ <i class="fa fa-bolt"></i> <?php _e("Installer", 'duplicator') ?>
83
+ <span id="dup-btn-installer-size" class="dup-btn-size"></span>
84
+ </button> &nbsp;
85
+ <button id="dup-btn-archive" class="button button-primary button-large">
86
+ <i class="fa fa-file-archive-o"></i> <?php _e("Archive", 'duplicator') ?>
87
+ <span id="dup-btn-archive-size" class="dup-btn-size"></span>
88
+ </button>
89
+ <div style='margin: 7px 0 20px 0'>
90
+ <small><i><?php _e("click buttons to download", 'duplicator') ?></i></small>
91
+ </div>
92
+ <div class="dup-msg-success-links">
93
+ <?php printf("<a href='?page=duplicator'>[ %s ]</a>", __('All Packages', 'duplicator'));?>
94
+ </div><br/>
95
+
96
+ <!-- Used for iMacros testing do not remove -->
97
+ <div id="dup-automation-imacros"></div>
98
+ </div>
99
+
100
+ <!-- =========================
101
+ ERROR MESSAGE -->
102
+ <div id="dup-msg-error" style="display:none">
103
+ <div class="done-title"><i class="fa fa-chain-broken"></i> <?php _e('Build Interrupt', 'duplicator'); ?></div>
104
+ <b><?php _e('The current build has experienced an issue.', 'duplicator'); ?></b><br/>
105
+
106
+ <i><?php _e('Please try the process again.', 'duplicator'); ?></i><br/><br/>
107
+
108
+ <input type="button" style="margin-right:10px;" class="button" value="<?php _e('Diagnose', 'duplicator'); ?>" onclick="window.open('http://lifeinthegrid.com/support/knowledgebase.php?article=12#faq-trouble-timeout', '_blank');return false;" />
109
+ <input type="button" class="button" value="<?php _e('Try Again', 'duplicator'); ?>" onclick="window.location = 'admin.php?page=duplicator&tab=new1'" />
110
+ <fieldset>
111
+ <legend><b><i class="fa fa-exclamation"></i> <?php _e('Details', 'duplicator'); ?></b></legend>
112
+ <div class="dup-msg-error-area">
113
+ <div id="dup-msg-error-response-status">
114
+ <span class="label"><?php _e("Server Status:", 'duplicator'); ?></span>
115
+ <span class="data"></span>
116
+ </div>
117
+ <div id="dup-msg-error-response-text">
118
+ <span class="label"><?php _e("Error Message:", 'duplicator'); ?></span><br/>
119
+ <span class="data"></span>
120
+ </div>
121
+ </div>
122
+ </fieldset><br/>
123
+
124
+ <fieldset style="color:#777">
125
+ <legend><b> <?php _e('Notice', 'duplicator'); ?></b></legend>
126
+ <div class="dup-msg-error-area">
127
+ <?php printf('<b><i class="fa fa-folder-o"></i> %s %s</b> <br/> %s',
128
+ __('Build Folder:'),
129
+ DUPLICATOR_SSDIR_PATH_TMP,
130
+ __("Some servers close connections quickly; yet the build can continue to run in the background. To validate if a build is still running; open the 'tmp' folder above and see if the archive file is growing in size. If it is not then your server has strict timeout constraints. Please visit the support page for additional resources.", 'duplicator')
131
+ );
132
+ ?> <br/>
133
+ </div>
134
+ </fieldset>
135
+
136
+ <!-- LOGS -->
137
+ <div id="dup-logs">
138
+ <div style="font-weight:bold">
139
+ <i class="fa fa-list-alt"></i> <a href='javascript:void(0)' style="color:#A62426" onclick='Duplicator.OpenLogWindow()'> <?php _e('Package Log', 'duplicator');?> </a>
140
+ </div>
141
+ <br/>
142
+ </div>
143
+
144
+ </div>
145
+
146
+ </div>
147
+ </div>
148
+ </form>
149
+
150
+ <script type="text/javascript">
151
+ jQuery(document).ready(function($) {
152
+ /* ----------------------------------------
153
+ * METHOD: Performs Ajax post to create a new package
154
+ * Timeout (10000000 = 166 minutes) */
155
+ Duplicator.Pack.Create = function() {
156
+
157
+ var data = {action : 'duplicator_package_build', nonce: '<?php echo $ajax_nonce; ?>'}
158
+
159
+ $.ajax({
160
+ type: "POST",
161
+ url: ajaxurl,
162
+ dataType: "json",
163
+ timeout: 10000000,
164
+ data: data,
165
+ beforeSend: function() {},
166
+ complete: function() {},
167
+ success: function(data) {
168
+ $('#dup-progress-bar-area').hide();
169
+ $('#dup-progress-area, #dup-msg-success').show(300);
170
+
171
+ var Pack = data.Package;
172
+ var InstallURL = Pack.StoreURL + Pack.Installer.File + "?get=1&file=" + Pack.Installer.File;
173
+ var ArchiveURL = Pack.StoreURL + Pack.Archive.File + "?get=1";
174
+
175
+ $('#dup-btn-archive-size').append('&nbsp; (' + data.ZipSize + ')')
176
+ $('#data-name-hash').text(Pack.NameHash || 'error read');
177
+ $('#data-time').text(data.Runtime || 'unable to read time');
178
+
179
+ //Wire Up Downloads
180
+ $('#dup-btn-installer').on("click", {name: InstallURL }, Duplicator.Pack.DownloadFile );
181
+ $('#dup-btn-archive').on("click", {name: ArchiveURL }, Duplicator.Pack.DownloadFile );
182
+ //Imacros testing required
183
+ $('#dup-automation-imacros').html('<input type="hidden" id="dup-finished" value="done" />');
184
+
185
+ },
186
+ error: function(data) {
187
+ $('#dup-progress-bar-area').hide();
188
+ $('#dup-progress-area, #dup-msg-error').show(200);
189
+ var status = data.status + ' -' + data.statusText;
190
+ var response = (data.responseText != undefined && data.responseText.length > 1) ? data.responseText : 'Unknown Error - See Log File';
191
+ $('#dup-msg-error-response-status span.data').html(status)
192
+ $('#dup-msg-error-response-text span.data').html(response);
193
+ console.log(data);
194
+ }
195
+ });
196
+ return false;
197
+ }
198
+
199
+ //Page Init:
200
+ Duplicator.UI.AnimateProgressBar('dup-progress-bar');
201
+ Duplicator.Pack.Create();
202
+
203
+ });
 
204
  </script>