Bladeren bron

added sqlite db to backup check
changed logging for backup

CauseFX 4 jaren geleden
bovenliggende
commit
b890326019
1 gewijzigde bestanden met toevoegingen van 5 en 4 verwijderingen
  1. 5 4
      api/functions/backup-functions.php

+ 5 - 4
api/functions/backup-functions.php

@@ -63,12 +63,13 @@ trait BackupFunctions
 				break;
 			default:
 		}
-
-		$this->writeLog('success', 'BACKUP: backup process started', 'SYSTEM');
+		$this->setLoggerChannel('Backup')->notice('Backing up Organizr');
 		$zipname = $directory . 'backup[' . date('Y-m-d_H-i') . ' - ' . $this->random_ascii_string(2) . '][' . $this->version . '].zip';
 		$zip = new ZipArchive;
 		$zip->open($zipname, ZipArchive::CREATE);
-		$zip->addFile($this->config['dbLocation'] . $this->config['dbName'], basename($this->config['dbLocation'] . $this->config['dbName']));
+		if ($this->config['driver'] == 'sqlite3') {
+			$zip->addFile($this->config['dbLocation'] . $this->config['dbName'], basename($this->config['dbLocation'] . $this->config['dbName']));
+		}
 		$rootPath = $this->root . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR;
 		$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($rootPath), RecursiveIteratorIterator::LEAVES_ONLY);
 
@@ -87,7 +88,7 @@ trait BackupFunctions
 
 
 		$zip->close();
-		$this->writeLog('success', 'BACKUP: backup process finished', 'SYSTEM');
+		$this->setLoggerChannel('Backup')->notice('Backup process finished');
 		$this->setAPIResponse('success', 'Backup has been created', 200);
 		return true;
 	}