Item class has been moved to a new directory 'models', a new class has been added: ItemContent
and same fields from Item were moved to ItemContent Item - id - parent_id - type (file, dir, symlink) - url - subject - template (html template) - sort_index - content_id ItemContent - id - ref -> references (renamed) - user_id - modification_user_id - group_id - privileges - date_creation - date_modification - guest_name - link_to - link_redirect - file_path - file_fs - file_type - file_size - has_thumb -> file_has_thumb (renamed) - hash -> file_hash (renamed) - hash_type -> file_hash_type (renamed) - content -> content_raw (renamed) - content_type -> content_raw_type (renamed) - content_parsed - content_parsed_type - meta - ameta -> meta_admin (renamed) - modify_index (removed) WIP: #4
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010-2018, Tomasz Sowa
|
||||
* Copyright (c) 2010-2021, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -99,7 +99,13 @@ void ThreadInfo::RemoveThread(long file_id)
|
||||
if( tdb->GetAnswers(file_id, remove_answer_id_tab) == WINIX_ERR_OK )
|
||||
{
|
||||
for(size_t i=0 ; i<remove_answer_id_tab.size() ; ++i)
|
||||
db->DelFileById(remove_answer_id_tab[i]);
|
||||
{
|
||||
Item item;
|
||||
item.set_connector(model_connector);
|
||||
item.id = remove_answer_id_tab[i];
|
||||
item.remove(); // CHECKME is it correct to set only 'id' and call 'remove'?
|
||||
//db->DelFileById(remove_answer_id_tab[i]);
|
||||
}
|
||||
}
|
||||
|
||||
tdb->RemoveThread(file_id);
|
||||
@@ -116,12 +122,22 @@ void ThreadInfo::RemoveThreadAnswer(long answer_id)
|
||||
|
||||
void ThreadInfo::RepairAnswer(long answer_id)
|
||||
{
|
||||
iq.Clear();
|
||||
iq.SetAll(false, false);
|
||||
iq.WhereId(answer_id);
|
||||
iq.WhereType(Item::file); // !! moze w przyszlosci pozwolic takze na symlinki?
|
||||
// iq.Clear();
|
||||
// iq.SetAll(false, false);
|
||||
// iq.WhereId(answer_id);
|
||||
// iq.WhereType(Item::file); // !! moze w przyszlosci pozwolic takze na symlinki?
|
||||
|
||||
if( db->GetItem(repair_item, iq) == WINIX_ERR_NO_ITEM )
|
||||
morm::Finder<Item> finder(model_connector);
|
||||
|
||||
repair_item = finder.
|
||||
select().
|
||||
where().
|
||||
eq(L"id", answer_id).
|
||||
eq(L"type", static_cast<int>(Item::file)).
|
||||
get();
|
||||
|
||||
//if( db->GetItem(repair_item, iq) == WINIX_ERR_NO_ITEM )
|
||||
if( !repair_item.found() )
|
||||
{
|
||||
log << log3 << "ThreadInfo: there is no a file for thread answer_id: " << answer_id << logend;
|
||||
tdb->RemoveAnswerOnly(answer_id);
|
||||
@@ -141,12 +157,21 @@ void ThreadInfo::RepairAnswers(long file_id)
|
||||
|
||||
void ThreadInfo::Repair(long file_id)
|
||||
{
|
||||
iq.Clear();
|
||||
iq.SetAll(false, false);
|
||||
iq.WhereId(file_id);
|
||||
iq.WhereType(Item::file); // !! moze w przyszlosci pozwolic takze na symlinki?
|
||||
// iq.Clear();
|
||||
// iq.SetAll(false, false);
|
||||
// iq.WhereId(file_id);
|
||||
// iq.WhereType(Item::file); // !! moze w przyszlosci pozwolic takze na symlinki?
|
||||
|
||||
if( db->GetItem(repair_item, iq) == WINIX_ERR_NO_ITEM )
|
||||
morm::Finder<Item> finder(model_connector);
|
||||
|
||||
repair_item = finder.
|
||||
select().
|
||||
where().
|
||||
eq(L"id", file_id).
|
||||
eq(L"type", static_cast<int>(Item::file)).
|
||||
get();
|
||||
|
||||
if( !repair_item.found() )
|
||||
{
|
||||
log << log3 << "ThreadInfo: there is no a file for thread file_id: " << file_id << logend;
|
||||
tdb->RemoveThread(file_id);
|
||||
|
Reference in New Issue
Block a user