WordPress Backup and Migrate Plugin – Backup Guard - Version 1.3.8

Version Description

  • Bug fixed inside log files
Download this release

Release Info

Developer BackupGuard
Plugin Icon 128x128 WordPress Backup and Migrate Plugin – Backup Guard
Version 1.3.8
Comparing to
See all releases

Code changes from version 1.3.7 to 1.3.8

README.txt CHANGED
@@ -6,7 +6,7 @@ Donate link: https://backup-guard.com/products/backup-wordpress
6
  Tags: backup, wordpress backup plugin, backup plugin, database backup, migrate, back up
7
  Requires at least: 3.8
8
  Tested up to: 5.4.2
9
- Stable tag: 1.3.7
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -157,6 +157,9 @@ When you are facing an issue of any kind with any of our products, the first thi
157
  6. Site backup customization
158
 
159
  == Changelog ==
 
 
 
160
  = 1.3.7 =
161
  * Download button improvement
162
 
6
  Tags: backup, wordpress backup plugin, backup plugin, database backup, migrate, back up
7
  Requires at least: 3.8
8
  Tested up to: 5.4.2
9
+ Stable tag: 1.3.8
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
157
  6. Site backup customization
158
 
159
  == Changelog ==
160
+ = 1.3.8 =
161
+ * Bug fixed inside log files
162
+
163
  = 1.3.7 =
164
  * Download button improvement
165
 
backup.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Backup
5
  * Plugin URI: https://backup-guard.com/products/backup-wordpress
6
  * Description: Backup Guard is the most complete site backup and restore plugin. We offer the easiest way to backup, restore or migrate your site. You can backup your files, database or both.
7
- * Version: 1.3.7
8
  * Author: BackupGuard
9
  * Author URI: https://backup-guard.com/products/backup-wordpress
10
  * License: GPL-2.0+
@@ -16,7 +16,7 @@ if (function_exists('activate_backup_guard')) {
16
  }
17
 
18
  if (!defined('SG_BACKUP_GUARD_VERSION')) {
19
- define('SG_BACKUP_GUARD_VERSION', '1.3.7');
20
  }
21
 
22
  if (!defined('SG_BACKUP_GUARD_MAIN_FILE')) {
4
  * Plugin Name: Backup
5
  * Plugin URI: https://backup-guard.com/products/backup-wordpress
6
  * Description: Backup Guard is the most complete site backup and restore plugin. We offer the easiest way to backup, restore or migrate your site. You can backup your files, database or both.
7
+ * Version: 1.3.8
8
  * Author: BackupGuard
9
  * Author URI: https://backup-guard.com/products/backup-wordpress
10
  * License: GPL-2.0+
16
  }
17
 
18
  if (!defined('SG_BACKUP_GUARD_VERSION')) {
19
+ define('SG_BACKUP_GUARD_VERSION', '1.3.8');
20
  }
21
 
22
  if (!defined('SG_BACKUP_GUARD_MAIN_FILE')) {
com/core/backup/SGBackupDatabase.php CHANGED
@@ -181,7 +181,7 @@ class SGBackupDatabase implements SGIMysqldumpDelegate
181
  $this->backupFilePath = $filePath;
182
 
183
  $this->export();
184
-
185
  SGBackupLog::writeAction('backup database', SG_BACKUP_LOG_POS_END);
186
  SGBackupLog::write('backup database total duration: '.backupGuardFormattedDuration($this->actionStartTs, time()));
187
  }
181
  $this->backupFilePath = $filePath;
182
 
183
  $this->export();
184
+
185
  SGBackupLog::writeAction('backup database', SG_BACKUP_LOG_POS_END);
186
  SGBackupLog::write('backup database total duration: '.backupGuardFormattedDuration($this->actionStartTs, time()));
187
  }
com/core/backup/SGBackupFiles.php CHANGED
@@ -16,7 +16,7 @@ class SGBackupFiles implements SGArchiveDelegate
16
  private $filePath = '';
17
  private $sgbp = null;
18
  private $delegate = null;
19
- private $actionStartTs = 0;
20
  private $nextProgressUpdate = 0;
21
  private $progressUpdateInterval = 0;
22
  private $warningsFound = false;
@@ -115,7 +115,8 @@ class SGBackupFiles implements SGArchiveDelegate
115
  {
116
  $this->reloadStartTs = time();
117
  if ($state->getAction() == SG_STATE_ACTION_PREPARING_STATE_FILE) {
118
- $this->actionStartTs = time();
 
119
  SGBackupLog::writeAction('backup files', SG_BACKUP_LOG_POS_START);
120
  }
121
 
@@ -160,6 +161,7 @@ class SGBackupFiles implements SGArchiveDelegate
160
 
161
  $this->numberOfEntries = $state->getNumberOfEntries();
162
  $this->progressCursor = $state->getProgressCursor();
 
163
  }
164
 
165
  $this->cdrSize = $state->getCdrSize();
@@ -194,7 +196,7 @@ class SGBackupFiles implements SGArchiveDelegate
194
  $this->clear();
195
 
196
  SGBackupLog::writeAction('backup files', SG_BACKUP_LOG_POS_END);
197
- SGBackupLog::write('backup files total duration: '.backupGuardFormattedDuration($this->actionStartTs, time()));
198
  }
199
 
200
  private function clear()
@@ -245,7 +247,7 @@ class SGBackupFiles implements SGArchiveDelegate
245
  //start logging
246
  SGBackupLog::writeAction('restore', SG_BACKUP_LOG_POS_START);
247
  SGBackupLog::writeAction('restore files', SG_BACKUP_LOG_POS_START);
248
- $this->actionStartTs = time();
249
  }
250
 
251
  public function restore($filePath)
@@ -261,11 +263,12 @@ class SGBackupFiles implements SGArchiveDelegate
261
  $this->warningsFound = $state->getWarningsFound();
262
  $this->progressCursor = $state->getCursor();
263
  $this->numberOfEntries = $state->getCdrSize();
 
264
  }
265
 
266
  $this->extractArchive($filePath);
267
  SGBackupLog::writeAction('restore files', SG_BACKUP_LOG_POS_END);
268
- SGBackupLog::write('restore files total duration: '.backupGuardFormattedDuration($this->actionStartTs, time()));
269
  }
270
 
271
  private function extractArchive($filePath)
@@ -315,6 +318,9 @@ class SGBackupFiles implements SGArchiveDelegate
315
  {
316
  $this->numberOfEntries = $count;
317
  SGBackupLog::write('Number of files to restore: '.$count);
 
 
 
318
  }
319
 
320
  private function prepareFileTree($allItems)
16
  private $filePath = '';
17
  private $sgbp = null;
18
  private $delegate = null;
19
+ private $filesActionStartTs = 0;
20
  private $nextProgressUpdate = 0;
21
  private $progressUpdateInterval = 0;
22
  private $warningsFound = false;
115
  {
116
  $this->reloadStartTs = time();
117
  if ($state->getAction() == SG_STATE_ACTION_PREPARING_STATE_FILE) {
118
+ $this->filesActionStartTs = time();
119
+ $state->setFilesActionStartTs($this->filesActionStartTs);
120
  SGBackupLog::writeAction('backup files', SG_BACKUP_LOG_POS_START);
121
  }
122
 
161
 
162
  $this->numberOfEntries = $state->getNumberOfEntries();
163
  $this->progressCursor = $state->getProgressCursor();
164
+ $this->filesActionStartTs = $state->getFilesActionStartTs();
165
  }
166
 
167
  $this->cdrSize = $state->getCdrSize();
196
  $this->clear();
197
 
198
  SGBackupLog::writeAction('backup files', SG_BACKUP_LOG_POS_END);
199
+ SGBackupLog::write('backup files total duration: '.backupGuardFormattedDuration($this->filesActionStartTs, time()));
200
  }
201
 
202
  private function clear()
247
  //start logging
248
  SGBackupLog::writeAction('restore', SG_BACKUP_LOG_POS_START);
249
  SGBackupLog::writeAction('restore files', SG_BACKUP_LOG_POS_START);
250
+ $this->filesActionStartTs = time();
251
  }
252
 
253
  public function restore($filePath)
263
  $this->warningsFound = $state->getWarningsFound();
264
  $this->progressCursor = $state->getCursor();
265
  $this->numberOfEntries = $state->getCdrSize();
266
+ $this->filesActionStartTs = $state->getFilesActionStartTs();
267
  }
268
 
269
  $this->extractArchive($filePath);
270
  SGBackupLog::writeAction('restore files', SG_BACKUP_LOG_POS_END);
271
+ SGBackupLog::write('restore files total duration: '.backupGuardFormattedDuration($this->filesActionStartTs, time()));
272
  }
273
 
274
  private function extractArchive($filePath)
318
  {
319
  $this->numberOfEntries = $count;
320
  SGBackupLog::write('Number of files to restore: '.$count);
321
+ $state = $this->getState();
322
+ $this->filesActionStartTs = time();
323
+ $state->setFilesActionStartTs($this->filesActionStartTs);
324
  }
325
 
326
  private function prepareFileTree($allItems)
com/lib/SGArchiveToZip.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SGArchiveToZip
4
+ {
5
+ public function __construct()
6
+ {
7
+ $this->backupFiles = new SGBackupFiles();
8
+ }
9
+
10
+ private $filePath;
11
+ private $fileName;
12
+
13
+ public function setFilePath($filePath)
14
+ {
15
+ $this->filePath = $filePath;
16
+ }
17
+
18
+ public function getFilePath()
19
+ {
20
+ return $this->filePath;
21
+ }
22
+
23
+ public function setFileName($fileName)
24
+ {
25
+ $this->fileName = $fileName;
26
+ }
27
+
28
+ public function getFileName()
29
+ {
30
+ return $this->fileName;
31
+ }
32
+
33
+ public function convert()
34
+ {
35
+ $this->extract();
36
+ }
37
+
38
+ private function extract()
39
+ {
40
+ $backupName = $this->getFileName();
41
+ $backupName = backupGuardRemoveSlashes($backupName);
42
+ $backupPath = SG_BACKUP_DIRECTORY.$backupName;
43
+ $filePath = $backupPath.'/'.$backupName.'.sgbp';
44
+
45
+ $files = new SGBackup();
46
+ $files->extractForZip($filePath, $backupPath, $backupName);
47
+ //$files->extractBackupByPath($backupPath.'/'.$backupName.'.sgbp', $backupName);
48
+ }
49
+ }
com/lib/SGFileState.php CHANGED
@@ -15,6 +15,7 @@ class SGFileState extends SGState
15
 
16
  private $progressCursor = 0;
17
  private $cdrCursor = 0;
 
18
 
19
  function __construct()
20
  {
@@ -115,6 +116,16 @@ class SGFileState extends SGState
115
  {
116
  return $this->fileOffsetInArchive;
117
  }
 
 
 
 
 
 
 
 
 
 
118
 
119
  public function setFileOffsetInArchive($fileOffsetInArchive)
120
  {
@@ -145,6 +156,7 @@ class SGFileState extends SGState
145
  $this->cdrCursor = $stateJson['cdrCursor'];
146
  $this->restoreMode = $stateJson['restoreMode'];
147
  $this->restoreFiles = $stateJson['restoreFiles'];
 
148
 
149
  return $this;
150
  }
@@ -175,7 +187,8 @@ class SGFileState extends SGState
175
  'progressCursor' => $this->progressCursor,
176
  'cdrCursor' => $this->cdrCursor,
177
  'restoreMode' => $this->restoreMode,
178
- 'restoreFiles' => $this->restoreFiles
 
179
  )));
180
  }
181
  }
15
 
16
  private $progressCursor = 0;
17
  private $cdrCursor = 0;
18
+ private $filesActionStartTs = 0;
19
 
20
  function __construct()
21
  {
116
  {
117
  return $this->fileOffsetInArchive;
118
  }
119
+
120
+ public function setFilesActionStartTs($filesActionStartTs)
121
+ {
122
+ $this->filesActionStartTs = $filesActionStartTs;
123
+ }
124
+
125
+ public function getFilesActionStartTs()
126
+ {
127
+ return $this->filesActionStartTs;
128
+ }
129
 
130
  public function setFileOffsetInArchive($fileOffsetInArchive)
131
  {
156
  $this->cdrCursor = $stateJson['cdrCursor'];
157
  $this->restoreMode = $stateJson['restoreMode'];
158
  $this->restoreFiles = $stateJson['restoreFiles'];
159
+ $this->filesActionStartTs = $stateJson['filesActionStartTs'];
160
 
161
  return $this;
162
  }
187
  'progressCursor' => $this->progressCursor,
188
  'cdrCursor' => $this->cdrCursor,
189
  'restoreMode' => $this->restoreMode,
190
+ 'restoreFiles' => $this->restoreFiles,
191
+ 'filesActionStartTs' => $this->filesActionStartTs
192
  )));
193
  }
194
  }
com/lib/test.txt ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Array
2
+ (
3
+ [siteUrl] => http://localhost:8888/wordpress
4
+ [home] => http://localhost:8888/wordpress
5
+ [dbPrefix] => wp_
6
+ [tables] => ["wp_options","wp_commentmeta","wp_comments","wp_custom","wp_links","wp_postmeta","wp_posts","wp_term_relationships","wp_term_taxonomy","wp_termmeta","wp_terms","wp_usermeta","wp_users","wp_wfblockediplog"]
7
+ [method] => 2
8
+ [multisitePath] =>
9
+ [multisiteDomain] =>
10
+ [selectivRestoreable] => 1
11
+ [phpVersion] => 7.0.31
12
+ [version] => 5
13
+ )
14
+ Array
15
+ (
16
+ [siteUrl] => http://localhost:8888/wordpress
17
+ [home] => http://localhost:8888/wordpress
18
+ [dbPrefix] => wp_
19
+ [tables] => ["wp_options","wp_commentmeta","wp_comments","wp_custom","wp_links","wp_postmeta","wp_posts","wp_term_relationships","wp_term_taxonomy","wp_termmeta","wp_terms","wp_usermeta","wp_users","wp_wfblockediplog"]
20
+ [method] => 2
21
+ [multisitePath] =>
22
+ [multisiteDomain] =>
23
+ [selectivRestoreable] => 1
24
+ [phpVersion] => 7.0.31
25
+ [version] => 5
26
+ )