removed from Item: update() and save() methods which take the 'url_was_changed' argument

and added ItemModelData (based on morm::ModelData) class which has 'prepare_unique_url' field,
an object of this class is passed to update(), insert() and save() methods

fixed: Dirs::CheckRootDir(): update should update childs too (privileges)

WIP: #4
This commit is contained in:
2021-03-08 21:06:50 +01:00
parent ab5c44a2cb
commit 57aad8b454
17 changed files with 121 additions and 128 deletions

View File

@@ -283,8 +283,10 @@ bool ok = true;
if( MoveStaticFile(old_static_path, new_static_path) )
{
item.propagate_connector();
//if( db->EditFileById(item, item.id) != WINIX_ERR_OK )
if( !item.update(false, true) )
if( !item.item_content.update() )
{
log << log1 << "Mv: cannot move static file (database problem)" << logend;
slog << logerror << T("internal_error") << logend;
@@ -401,7 +403,7 @@ bool Mv::MoveDir(Item & src_dir, std::vector<Item*> & dst_dir_tab, const std::ws
}
//Error status = db->EditParentUrlById(src_dir, src_dir.id);
if( src_dir.update(true, false) )
if( src_dir.update(false) )
{
log << log3 << "Mv: directory: " << old_url << " was moved to: ";
system->dirs.LogDir(dst_dir_tab);
@@ -530,7 +532,7 @@ bool Mv::MoveFileOrSymlink(Item & src_file, std::vector<Item*> & dst_dir_tab, co
src_file.parent_id = dst_dir_tab.back()->id;
//Error status = db->EditParentUrlById(src_file, src_file.id);
if( src_file.update(true, false) )
if( src_file.update(false) )
{
if( src_file.type == Item::file )
log << log3 << "Mv: file: ";