mirror of
https://github.com/KuJoe/kontrolvm.git
synced 2025-04-20 03:53:40 +00:00

This is just an initial pass of retrofitting the code to handle better logging and reporting (issue #3), but more work may be required.
24 lines
No EOL
518 B
PHP
24 lines
No EOL
518 B
PHP
<?php
|
|
|
|
require_once('config.php');
|
|
$backup_file_path = $db_file_path.".bak";
|
|
|
|
try {
|
|
$conn = new SQLite3($db_file_path, SQLITE3_OPEN_READONLY);
|
|
$backup_db = new SQLite3($backup_file_path);
|
|
$result = $conn->backup($backup_db);
|
|
if($result) {
|
|
updateLastRunTime('dbBackup.php');
|
|
return;
|
|
} else {
|
|
error_log("Error creating DB backup: ". $conn->lastErrorMsg());
|
|
return;
|
|
}
|
|
$conn->close();
|
|
$backup_db->close();
|
|
} catch (Exception $e) {
|
|
error_log("Error creating DB backup: ". $e->getMessage());
|
|
return;
|
|
}
|
|
|
|
?>
|