WordPress Backup and Migrate Plugin – Backup Guard - Version 1.2.7

Version Description

  • Backup log improvements
Download this release

Release Info

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

Code changes from version 1.2.6 to 1.2.7

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
9
- Stable tag: 1.2.6
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.2.6 =
161
  * Bug fixed related to restore.
162
  * Admin side design improvement.
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
9
+ Stable tag: 1.2.7
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.2.7 =
161
+ * Backup log improvements
162
+
163
  = 1.2.6 =
164
  * Bug fixed related to restore.
165
  * Admin side design improvement.
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.2.6
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.2.6');
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.2.7
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.2.7');
20
  }
21
 
22
  if (!defined('SG_BACKUP_GUARD_MAIN_FILE')) {
com/core/backup/SGBackup.php CHANGED
@@ -21,6 +21,7 @@ class SGBackup implements SGIBackupDelegate
21
  private $actionId = null;
22
  private $filesBackupAvailable = false;
23
  private $databaseBackupAvailable = false;
 
24
  private $actionStartTs = 0;
25
  private $fileName = '';
26
  private $filesBackupPath = '';
@@ -376,7 +377,7 @@ class SGBackup implements SGIBackupDelegate
376
 
377
  $rootDirectory = rtrim(SGConfig::get('SG_APP_ROOT_DIRECTORY'), '/').'/';
378
  $path = substr($this->databaseBackupPath, strlen($rootDirectory));
379
- $this->backupFiles->addDontExclude($this->databaseBackupPath);
380
  $backupItems = $options['SG_BACKUP_FILE_PATHS'];
381
  $allItems = $backupItems?explode(',', $backupItems):array();
382
  $allItems[] = $path;
@@ -568,6 +569,19 @@ class SGBackup implements SGIBackupDelegate
568
  $this->prepareBackupLogFile($backupPath);
569
  }
570
 
 
 
 
 
 
 
 
 
 
 
 
 
 
571
  private function prepareBackupLogFile($backupPath, $exists = false)
572
  {
573
  $file = $backupPath.'/'.$this->fileName.'_backup.log';
@@ -576,6 +590,7 @@ class SGBackup implements SGIBackupDelegate
576
  if (!$exists)
577
  {
578
  $content = self::getLogFileHeader(SG_ACTION_TYPE_BACKUP, $this->fileName);
 
579
 
580
  $types = array();
581
  if ($this->filesBackupAvailable)
@@ -694,8 +709,10 @@ class SGBackup implements SGIBackupDelegate
694
  'archiveName' => $this->fileName
695
  ));
696
  }
697
-
698
  SGBackupLog::write('Total duration: '.backupGuardFormattedDuration($this->actionStartTs, time()));
 
 
699
 
700
  $archiveSizeInBytes = backupGuardRealFilesize($this->filesBackupPath);
701
  $archiveSize = convertToReadableSize($archiveSizeInBytes);
@@ -856,6 +873,8 @@ class SGBackup implements SGIBackupDelegate
856
  SGBackupMailNotification::sendRestoreNotification(true);
857
  }
858
 
 
 
859
  SGBackupLog::write('Total duration: '.backupGuardFormattedDuration($this->actionStartTs, time()));
860
 
861
  $this->cleanUp();
@@ -917,7 +936,7 @@ class SGBackup implements SGIBackupDelegate
917
  $confs['sapi'] = PHP_SAPI;
918
  $confs['mysql_version'] = SG_MYSQL_VERSION;
919
  $confs['int_size'] = PHP_INT_SIZE;
920
- $confs['method'] = backupGuardIsReloadEnabled()?'reload':'standard';
921
 
922
  $confs['dbprefix'] = SG_ENV_DB_PREFIX;
923
  $confs['siteurl'] = SG_SITE_URL;
@@ -926,6 +945,10 @@ class SGBackup implements SGIBackupDelegate
926
  $confs['installation'] = SG_SITE_TYPE;
927
  $freeSpace = convertToReadableSize(@disk_free_space(SG_APP_ROOT_DIRECTORY));
928
  $confs['free_space'] = $freeSpace==false?'unknown':$freeSpace;
 
 
 
 
929
 
930
  if (extension_loaded('gmp')) $lib = 'gmp';
931
  else if (extension_loaded('bcmath')) $lib = 'bcmath';
@@ -937,15 +960,15 @@ class SGBackup implements SGIBackupDelegate
937
  $confs['env'] = SG_ENV_ADAPTER.' '.SG_ENV_VERSION;
938
 
939
  $content = '';
940
- $content .= 'Date: '.backupGuardConvertDateTimezone(@date('Y-m-d H:i')).PHP_EOL;
941
- $content .= 'Backup Method: '.$confs['method'].PHP_EOL;
942
 
943
  if ($actionType == SG_ACTION_TYPE_RESTORE) {
944
  $confs['restore_method'] = SGExternalRestore::isEnabled()?'external':'standard';
945
  $content .= 'Restore Method: '.$confs['restore_method'].PHP_EOL;
946
  }
947
 
948
- $content .= 'User Mode: '.$confs['sg_user_mode'].PHP_EOL;
949
  $content .= 'BackupGuard version: '.$confs['sg_backup_guard_version'].PHP_EOL;
950
  $content .= 'Supported archive version: '.$confs['sg_archive_version'].PHP_EOL;
951
 
@@ -959,14 +982,26 @@ class SGBackup implements SGIBackupDelegate
959
  $content .= 'Server: '.$confs['server'].PHP_EOL;
960
  $content .= 'User agent: '.@$_SERVER['HTTP_USER_AGENT'].PHP_EOL;
961
  $content .= 'PHP version: '.$confs['php_version'].PHP_EOL;
962
- $content .= 'SAPI: '.$confs['sapi'].PHP_EOL;
963
  $content .= 'MySQL version: '.$confs['mysql_version'].PHP_EOL;
964
  $content .= 'Int size: '.$confs['int_size'].PHP_EOL;
965
  $content .= 'Int lib: '.$confs['int_lib'].PHP_EOL;
966
  $content .= 'Memory limit: '.$confs['memory_limit'].PHP_EOL;
967
  $content .= 'Max execution time: '.$confs['max_execution_time'].PHP_EOL;
968
  $content .= 'Disk free space: '.$confs['free_space'].PHP_EOL;
969
-
 
 
 
 
 
 
 
 
 
 
 
 
 
970
  if ($actionType == SG_ACTION_TYPE_RESTORE) {
971
  $archivePath = SG_BACKUP_DIRECTORY.$fileName.'/'.$fileName.'.sgbp';
972
  $archiveSizeInBytes = backupGuardRealFilesize($archivePath);
@@ -1424,4 +1459,14 @@ class SGBackup implements SGIBackupDelegate
1424
  {
1425
  return $this->backgroundMode;
1426
  }
 
 
 
 
 
 
 
 
 
 
1427
  }
21
  private $actionId = null;
22
  private $filesBackupAvailable = false;
23
  private $databaseBackupAvailable = false;
24
+ private $isManual = true;
25
  private $actionStartTs = 0;
26
  private $fileName = '';
27
  private $filesBackupPath = '';
377
 
378
  $rootDirectory = rtrim(SGConfig::get('SG_APP_ROOT_DIRECTORY'), '/').'/';
379
  $path = substr($this->databaseBackupPath, strlen($rootDirectory));
380
+ $this->backupFiles->addDontExclude($this->databaseBackupPath);
381
  $backupItems = $options['SG_BACKUP_FILE_PATHS'];
382
  $allItems = $backupItems?explode(',', $backupItems):array();
383
  $allItems[] = $path;
569
  $this->prepareBackupLogFile($backupPath);
570
  }
571
 
572
+ private function extendLogFileHeader($content)
573
+ {
574
+ $isManual = $this->getIsManual();
575
+ if ($isManual) {
576
+ $content .= 'Backup mode: Manual'.PHP_EOL;
577
+ }
578
+ else {
579
+ $content .= 'Backup mode: Schedule'.PHP_EOL;
580
+ }
581
+
582
+ return $content;
583
+ }
584
+
585
  private function prepareBackupLogFile($backupPath, $exists = false)
586
  {
587
  $file = $backupPath.'/'.$this->fileName.'_backup.log';
590
  if (!$exists)
591
  {
592
  $content = self::getLogFileHeader(SG_ACTION_TYPE_BACKUP, $this->fileName);
593
+ $content = $this->extendLogFileHeader($content);
594
 
595
  $types = array();
596
  if ($this->filesBackupAvailable)
709
  'archiveName' => $this->fileName
710
  ));
711
  }
712
+
713
  SGBackupLog::write('Total duration: '.backupGuardFormattedDuration($this->actionStartTs, time()));
714
+ SGBackupLog::write('Memory pick usage: '.(memory_get_peak_usage(true)/1024/1024).'MB');
715
+ SGBackupLog::write('CPU usage: '.implode(' / ', sys_getloadavg()));
716
 
717
  $archiveSizeInBytes = backupGuardRealFilesize($this->filesBackupPath);
718
  $archiveSize = convertToReadableSize($archiveSizeInBytes);
873
  SGBackupMailNotification::sendRestoreNotification(true);
874
  }
875
 
876
+ SGBackupLog::write('Memory pick usage: '.(memory_get_peak_usage(true)/1024/1024).'MB');
877
+ SGBackupLog::write('CPU usage: '.implode(' / ', sys_getloadavg()));
878
  SGBackupLog::write('Total duration: '.backupGuardFormattedDuration($this->actionStartTs, time()));
879
 
880
  $this->cleanUp();
936
  $confs['sapi'] = PHP_SAPI;
937
  $confs['mysql_version'] = SG_MYSQL_VERSION;
938
  $confs['int_size'] = PHP_INT_SIZE;
939
+ $confs['method'] = backupGuardIsReloadEnabled()?'ON':'OFF';
940
 
941
  $confs['dbprefix'] = SG_ENV_DB_PREFIX;
942
  $confs['siteurl'] = SG_SITE_URL;
945
  $confs['installation'] = SG_SITE_TYPE;
946
  $freeSpace = convertToReadableSize(@disk_free_space(SG_APP_ROOT_DIRECTORY));
947
  $confs['free_space'] = $freeSpace==false?'unknown':$freeSpace;
948
+ $isCurlAvailable = function_exists('curl_version');
949
+ $confs['curl_available'] = $isCurlAvailable ? 'Yes': 'No';
950
+ $confs['email_notifications'] = SGConfig::get('SG_NOTIFICATIONS_ENABLED') ? 'ON': 'OFF';
951
+ $confs['ftp_passive_mode'] = SGConfig::get('SG_FTP_PASSIVE_MODE') ? 'ON': 'OFF';
952
 
953
  if (extension_loaded('gmp')) $lib = 'gmp';
954
  else if (extension_loaded('bcmath')) $lib = 'bcmath';
960
  $confs['env'] = SG_ENV_ADAPTER.' '.SG_ENV_VERSION;
961
 
962
  $content = '';
963
+ $content .= 'Date: '.backupGuardConvertDateTimezone(@date('Y-m-d H:i')).' '.date_default_timezone_get().PHP_EOL;
964
+ $content .= 'Reloads: '.$confs['method'].PHP_EOL;
965
 
966
  if ($actionType == SG_ACTION_TYPE_RESTORE) {
967
  $confs['restore_method'] = SGExternalRestore::isEnabled()?'external':'standard';
968
  $content .= 'Restore Method: '.$confs['restore_method'].PHP_EOL;
969
  }
970
 
971
+ $content .= 'User mode: '.backupGuardGetProductName().PHP_EOL;
972
  $content .= 'BackupGuard version: '.$confs['sg_backup_guard_version'].PHP_EOL;
973
  $content .= 'Supported archive version: '.$confs['sg_archive_version'].PHP_EOL;
974
 
982
  $content .= 'Server: '.$confs['server'].PHP_EOL;
983
  $content .= 'User agent: '.@$_SERVER['HTTP_USER_AGENT'].PHP_EOL;
984
  $content .= 'PHP version: '.$confs['php_version'].PHP_EOL;
 
985
  $content .= 'MySQL version: '.$confs['mysql_version'].PHP_EOL;
986
  $content .= 'Int size: '.$confs['int_size'].PHP_EOL;
987
  $content .= 'Int lib: '.$confs['int_lib'].PHP_EOL;
988
  $content .= 'Memory limit: '.$confs['memory_limit'].PHP_EOL;
989
  $content .= 'Max execution time: '.$confs['max_execution_time'].PHP_EOL;
990
  $content .= 'Disk free space: '.$confs['free_space'].PHP_EOL;
991
+ $content .= 'CURL available: '.$confs['curl_available'].PHP_EOL;
992
+ $content .= 'Openssl version: '.OPENSSL_VERSION_TEXT.PHP_EOL;
993
+ if ($isCurlAvailable) {
994
+ $cv = curl_version();
995
+ $curlVersionText = $cv['version'].' / SSL: '.$cv['ssl_version'].' / libz: '.$cv['libz_version'];
996
+ $content .= 'CURL version: '.$curlVersionText.PHP_EOL;
997
+ }
998
+ $content .= 'Email notifications: '.$confs['email_notifications'].PHP_EOL;
999
+ $content .= 'FTP passive mode: '.$confs['ftp_passive_mode'].PHP_EOL;
1000
+ $content .= 'Exclude paths: '.SGConfig::get('SG_PATHS_TO_EXCLUDE').PHP_EOL;
1001
+ $content .= 'Tables to exclude: '.SGConfig::get('SG_TABLES_TO_EXCLUDE').PHP_EOL;
1002
+ $content .= 'Number of rows to backup: '.(int)SGConfig::get('SG_BACKUP_DATABASE_INSERT_LIMIT').PHP_EOL;
1003
+ $content .= 'AJAX request frequency: '.SGConfig::get('SG_AJAX_REQUEST_FREQUENCY').PHP_EOL;
1004
+
1005
  if ($actionType == SG_ACTION_TYPE_RESTORE) {
1006
  $archivePath = SG_BACKUP_DIRECTORY.$fileName.'/'.$fileName.'.sgbp';
1007
  $archiveSizeInBytes = backupGuardRealFilesize($archivePath);
1459
  {
1460
  return $this->backgroundMode;
1461
  }
1462
+
1463
+ public function setIsManual($isManual)
1464
+ {
1465
+ $this->isManual = $isManual;
1466
+ }
1467
+
1468
+ public function getIsManual()
1469
+ {
1470
+ return $this->isManual;
1471
+ }
1472
  }
com/core/backup/SGBackupDatabase.php CHANGED
@@ -13,6 +13,7 @@ class SGBackupDatabase implements SGIMysqldumpDelegate
13
  private $delegate = null;
14
  private $cancelled = false;
15
  private $nextProgressUpdate = 0;
 
16
  private $totalRowCount = 0;
17
  private $currentRowCount = 0;
18
  private $warningsFound = false;
@@ -168,6 +169,7 @@ class SGBackupDatabase implements SGIMysqldumpDelegate
168
  $this->state = $this->delegate->getState();
169
 
170
  if ($this->state && $this->state->getAction() == SG_STATE_ACTION_PREPARING_STATE_FILE) {
 
171
  SGBackupLog::writeAction('backup database', SG_BACKUP_LOG_POS_START);
172
  $this->resetBackupProgress();
173
  }
@@ -181,6 +183,7 @@ class SGBackupDatabase implements SGIMysqldumpDelegate
181
  $this->export();
182
 
183
  SGBackupLog::writeAction('backup database', SG_BACKUP_LOG_POS_END);
 
184
  }
185
 
186
  public function restore($filePath)
@@ -192,6 +195,7 @@ class SGBackupDatabase implements SGIMysqldumpDelegate
192
  if ($sgDBState && $sgDBState->getType() == SG_STATE_TYPE_DB) {
193
  if ($sgDBState->getAction() != SG_STATE_ACTION_RESTORING_DATABASE) {
194
  SGBackupLog::writeAction('restore database', SG_BACKUP_LOG_POS_START);
 
195
  //prepare for restore (reset variables)
196
  $this->resetRestoreProgress();
197
  }
@@ -216,6 +220,7 @@ class SGBackupDatabase implements SGIMysqldumpDelegate
216
  }
217
 
218
  SGBackupLog::writeAction('restore database', SG_BACKUP_LOG_POS_END);
 
219
  }
220
 
221
  private function processMigration()
13
  private $delegate = null;
14
  private $cancelled = false;
15
  private $nextProgressUpdate = 0;
16
+ private $actionStartTs = 0;
17
  private $totalRowCount = 0;
18
  private $currentRowCount = 0;
19
  private $warningsFound = false;
169
  $this->state = $this->delegate->getState();
170
 
171
  if ($this->state && $this->state->getAction() == SG_STATE_ACTION_PREPARING_STATE_FILE) {
172
+ $this->actionStartTs = time();
173
  SGBackupLog::writeAction('backup database', SG_BACKUP_LOG_POS_START);
174
  $this->resetBackupProgress();
175
  }
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
  }
188
 
189
  public function restore($filePath)
195
  if ($sgDBState && $sgDBState->getType() == SG_STATE_TYPE_DB) {
196
  if ($sgDBState->getAction() != SG_STATE_ACTION_RESTORING_DATABASE) {
197
  SGBackupLog::writeAction('restore database', SG_BACKUP_LOG_POS_START);
198
+ $this->actionStartTs = time();
199
  //prepare for restore (reset variables)
200
  $this->resetRestoreProgress();
201
  }
220
  }
221
 
222
  SGBackupLog::writeAction('restore database', SG_BACKUP_LOG_POS_END);
223
+ SGBackupLog::write('restore database total duration: '.backupGuardFormattedDuration($this->actionStartTs, time()));
224
  }
225
 
226
  private function processMigration()
com/core/backup/SGBackupFiles.php CHANGED
@@ -16,6 +16,7 @@ class SGBackupFiles implements SGArchiveDelegate
16
  private $filePath = '';
17
  private $sgbp = null;
18
  private $delegate = null;
 
19
  private $nextProgressUpdate = 0;
20
  private $progressUpdateInterval = 0;
21
  private $warningsFound = false;
@@ -114,6 +115,7 @@ class SGBackupFiles implements SGArchiveDelegate
114
  {
115
  $this->reloadStartTs = time();
116
  if ($state->getAction() == SG_STATE_ACTION_PREPARING_STATE_FILE) {
 
117
  SGBackupLog::writeAction('backup files', SG_BACKUP_LOG_POS_START);
118
  }
119
 
@@ -139,7 +141,6 @@ class SGBackupFiles implements SGArchiveDelegate
139
  }
140
 
141
  if ($state->getAction() == SG_STATE_ACTION_PREPARING_STATE_FILE) {
142
- SGBackupLog::write('Backup files: '.$backupItems);
143
 
144
  $this->resetProgress();
145
  $this->prepareFileTree($allItems);
@@ -147,6 +148,7 @@ class SGBackupFiles implements SGArchiveDelegate
147
  $this->saveStateData(SG_STATE_ACTION_LISTING_FILES, array(), 0, 0, false, 0);
148
 
149
  SGBackupLog::write('Number of files to backup: '.$this->numberOfEntries);
 
150
 
151
  if (backupGuardIsReloadEnabled()) {
152
  $this->reload();
@@ -154,10 +156,10 @@ class SGBackupFiles implements SGArchiveDelegate
154
  }
155
  else {
156
  $this->nextProgressUpdate = $state->getProgress();
157
- $this->warningsFound = $state->getWarningsFound();
158
 
159
- $this->numberOfEntries = $state->getNumberOfEntries();
160
- $this->progressCursor = $state->getProgressCursor();
161
  }
162
 
163
  $this->cdrSize = $state->getCdrSize();
@@ -172,14 +174,14 @@ class SGBackupFiles implements SGArchiveDelegate
172
  fseek($fileTreeHandle, $this->cursor);
173
  while (($fileTreeLine = fgets($fileTreeHandle)) !== false) {
174
  $file = unserialize($fileTreeLine);
175
-
176
  if (!$state->getInprogress()) {
177
- SGBackupLog::writeAction('backup file: '.$file['path'], SG_BACKUP_LOG_POS_START);
178
  }
179
 
180
  $path = $file['path'];
181
  $this->addFileToArchive($path);
182
- SGBackupLog::writeAction('backup file: '.$file['path'], SG_BACKUP_LOG_POS_END);
183
 
184
  $this->cursor = ftell($fileTreeHandle);
185
  $this->cdrSize = $this->sgbp->getCdrFilesCount();
@@ -192,6 +194,7 @@ class SGBackupFiles implements SGArchiveDelegate
192
  $this->clear();
193
 
194
  SGBackupLog::writeAction('backup files', SG_BACKUP_LOG_POS_END);
 
195
  }
196
 
197
  private function clear()
@@ -242,6 +245,7 @@ class SGBackupFiles implements SGArchiveDelegate
242
  //start logging
243
  SGBackupLog::writeAction('restore', SG_BACKUP_LOG_POS_START);
244
  SGBackupLog::writeAction('restore files', SG_BACKUP_LOG_POS_START);
 
245
  }
246
 
247
  public function restore($filePath)
@@ -261,6 +265,7 @@ class SGBackupFiles implements SGArchiveDelegate
261
 
262
  $this->extractArchive($filePath);
263
  SGBackupLog::writeAction('restore files', SG_BACKUP_LOG_POS_END);
 
264
  }
265
 
266
  private function extractArchive($filePath)
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
  {
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
 
141
  }
142
 
143
  if ($state->getAction() == SG_STATE_ACTION_PREPARING_STATE_FILE) {
 
144
 
145
  $this->resetProgress();
146
  $this->prepareFileTree($allItems);
148
  $this->saveStateData(SG_STATE_ACTION_LISTING_FILES, array(), 0, 0, false, 0);
149
 
150
  SGBackupLog::write('Number of files to backup: '.$this->numberOfEntries);
151
+ SGBackupLog::write('Root path: '.$this->filePath.'/');
152
 
153
  if (backupGuardIsReloadEnabled()) {
154
  $this->reload();
156
  }
157
  else {
158
  $this->nextProgressUpdate = $state->getProgress();
159
+ $this->warningsFound = $state->getWarningsFound();
160
 
161
+ $this->numberOfEntries = $state->getNumberOfEntries();
162
+ $this->progressCursor = $state->getProgressCursor();
163
  }
164
 
165
  $this->cdrSize = $state->getCdrSize();
174
  fseek($fileTreeHandle, $this->cursor);
175
  while (($fileTreeLine = fgets($fileTreeHandle)) !== false) {
176
  $file = unserialize($fileTreeLine);
177
+ $filePath = str_replace(ABSPATH, '', $file['path']);
178
  if (!$state->getInprogress()) {
179
+ SGBackupLog::writeAction('backup file: '.$filePath, SG_BACKUP_LOG_POS_START);
180
  }
181
 
182
  $path = $file['path'];
183
  $this->addFileToArchive($path);
184
+ SGBackupLog::writeAction('backup file: '.$filePath, SG_BACKUP_LOG_POS_END);
185
 
186
  $this->cursor = ftell($fileTreeHandle);
187
  $this->cdrSize = $this->sgbp->getCdrFilesCount();
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
  //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)
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)
public/cron/sg_backup.php CHANGED
@@ -9,6 +9,7 @@ if ($id) {
9
  }
10
 
11
  $b = new SGBackup();
 
12
  $options = $b->getScheduleParamsById($id);
13
 
14
  if ($options) {
9
  }
10
 
11
  $b = new SGBackup();
12
+ $b->setIsManual(false);
13
  $options = $b->getScheduleParamsById($id);
14
 
15
  if ($options) {