From eb04386d68a726923834a4b064231744f8b82d8e Mon Sep 17 00:00:00 2001 From: Junior Date: Mon, 2 Dec 2024 07:42:13 -0500 Subject: [PATCH] Fix path+filename checking in database when comparing to filesystem contents --- install/parsebooks.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/install/parsebooks.php b/install/parsebooks.php index 1628b44..82dcc20 100644 --- a/install/parsebooks.php +++ b/install/parsebooks.php @@ -31,9 +31,10 @@ $query = "SELECT id, path, filename FROM books ORDER BY path, filename"; $sth = $globaldbh->prepare($query); $sth->execute(); while ( $row = $sth->fetch(PDO::FETCH_ASSOC) ) { - $dbbooks[] = $row['path'] . (($row['path'] != "/") ? "/" : "") . $row['filename']; + $dbbook = $row['path'] . (($row['path'] != "/") ? "/" : "") . $row['filename']; + $dbbooks[] = $dbbook; } -$query = "DELETE FROM books WHERE CONCAT(path, filename)=:target"; +$query = "DELETE FROM books WHERE CONCAT(path, filename)=:target OR CONCAT(path, '/', filename)=:target"; $sth = $globaldbh->prepare($query); foreach ( $dbbooks as $dbbook ) { if ( !is_file(BOOKDIR . $dbbook) ) {