Commit c26c6f4a authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

Don't fetch absent folders

parent 29b8bce4
...@@ -215,13 +215,13 @@ std::vector<std::shared_ptr<Folder>> Folder::fetchAll( DBConnection dbConn, unsi ...@@ -215,13 +215,13 @@ std::vector<std::shared_ptr<Folder>> Folder::fetchAll( DBConnection dbConn, unsi
if ( parentFolderId == 0 ) if ( parentFolderId == 0 )
{ {
static const std::string req = "SELECT * FROM " + policy::FolderTable::Name static const std::string req = "SELECT * FROM " + policy::FolderTable::Name
+ " WHERE id_parent IS NULL AND is_blacklisted is NULL"; + " WHERE id_parent IS NULL AND is_blacklisted is NULL AND is_present = 1";
return DatabaseHelpers::fetchAll<Folder>( dbConn, req ); return DatabaseHelpers::fetchAll<Folder>( dbConn, req );
} }
else else
{ {
static const std::string req = "SELECT * FROM " + policy::FolderTable::Name static const std::string req = "SELECT * FROM " + policy::FolderTable::Name
+ " WHERE id_parent = ? AND is_blacklisted is NULL"; + " WHERE id_parent = ? AND is_blacklisted is NULL AND is_present = 1";
return DatabaseHelpers::fetchAll<Folder>( dbConn, req, parentFolderId ); return DatabaseHelpers::fetchAll<Folder>( dbConn, req, parentFolderId );
} }
} }
...@@ -142,12 +142,6 @@ bool FsDiscoverer::checkSubfolders( fs::IDirectory* folder, Folder* parentFolder ...@@ -142,12 +142,6 @@ bool FsDiscoverer::checkSubfolders( fs::IDirectory* folder, Folder* parentFolder
continue; continue;
} }
auto folderInDb = *it; auto folderInDb = *it;
// If the folder isn't present, don't check it for modifications
if ( folderInDb->isPresent() == false )
{
subFoldersInDB.erase( it );
continue;
}
if ( subFolder->lastModificationDate() == folderInDb->lastModificationDate() ) if ( subFolder->lastModificationDate() == folderInDb->lastModificationDate() )
{ {
subFoldersInDB.erase( it ); subFoldersInDB.erase( it );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment