Fix path+filename checking in database when comparing to filesystem contents
This commit is contained in:
parent
516bc6bfa9
commit
eb04386d68
|
@ -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) ) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user