diff --git a/changelog.md b/changelog.md index 6fd0a97..baeb9a4 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,6 @@ +# 0.10.1 (23 March, 2024) +* Fix warning when creating the first snapshot + # 0.10.0 (07 October, 2023) * Fix warning generated during normal operation * Fix support for target that is mounted as a subvolume by ignoring extra mount options diff --git a/just-backup-btrfs b/just-backup-btrfs index 5c93f0a..33b346b 100755 --- a/just-backup-btrfs +++ b/just-backup-btrfs @@ -10,7 +10,7 @@ use * @author Nazar Mokrynskyi * @copyright Copyright (c) 2014-2023, Nazar Mokrynskyi * @license http://opensource.org/licenses/MIT - * @version 0.10.0 + * @version 0.10.1 */ class Just_backup_btrfs { /** @@ -329,7 +329,7 @@ class Just_backup_btrfs { * @param string $destination * @param string $destination_external * - * @return bool + * @return bool|string */ protected function get_last_common_snapshot ($history_db, $history_db_external, $destination, $destination_external) { $snapshots = $history_db_external->query( @@ -337,8 +337,9 @@ class Just_backup_btrfs { FROM `history` ORDER BY `date` DESC" ); - while ($snapshot = $snapshots->fetchArray(SQLITE3_ASSOC)['snapshot_name']) { - $snapshot_escaped = $history_db::escapeString($snapshot); + while ($snapshot = $snapshots->fetchArray(SQLITE3_ASSOC)) { + $snapshot_name = $snapshot['snapshot_name']; + $snapshot_escaped = $history_db::escapeString($snapshot_name); $snapshot_found = $history_db ->query( "SELECT `snapshot_name` @@ -348,10 +349,10 @@ class Just_backup_btrfs { ->fetchArray(); if ( $snapshot_found && - file_exists("$destination/$snapshot") && - file_exists("$destination_external/$snapshot") + file_exists("$destination/$snapshot_name") && + file_exists("$destination_external/$snapshot_name") ) { - return $snapshot; + return $snapshot_name; } } return false;