changed: plugin messages:

WINIX_FILE_REMOVED and WINIX_DIR_PREPARE_TO_REMOVE
         now as a parameter we have a pointer to the Item struct
changed: export plugin now exports all files from a directory
         (in the future there'll be an option how the plugin should behave)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@772 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2011-09-30 01:33:42 +00:00
parent 9dae2de2fa
commit c7b6ca67a2
13 changed files with 172 additions and 85 deletions

View File

@@ -121,14 +121,10 @@ void Rm::RemoveStaticFile(Item & item)
if( RemoveStaticFile(path) )
{
if( item.has_thumb && system->MakeFilePath(item, path, true) )
{
RemoveStaticFile(path);
item.has_thumb = false;
}
// we don't store it to db (it will be removed or is removed already)
item.file_path.clear();
item.file_type = WINIX_ITEM_FILETYPE_NONE;
// we don't change item.file_path and others file_* variables
// they can be used by a plugin
}
}
else
@@ -141,8 +137,6 @@ void Rm::RemoveStaticFile(Item & item)
void Rm::RemoveFileOrSymlink(Item & item)
{
plugin.Call(5000, &item); // !! dodac do pluginmsg.h
if( db->DelItem(item) == WINIX_ERR_OK )
{
if( item.type == Item::file )
@@ -153,10 +147,11 @@ void Rm::RemoveFileOrSymlink(Item & item)
log << item.url << logend;
TemplatesFunctions::pattern_cacher.DeletePattern(item);
plugin.Call(WINIX_FILE_REMOVED, item.id);
if( item.file_type != WINIX_ITEM_FILETYPE_NONE )
RemoveStaticFile(item);
plugin.Call(WINIX_FILE_REMOVED, &item);
}
}
@@ -189,14 +184,14 @@ void Rm::RemoveDirTree(long dir_id)
for( ; p != system->dirs.ParentEnd() ; p = pnext )
{
plugin.Call(WINIX_DIR_PREPARE_TO_REMOVE, &(*p->second));
// this iterator p will be deleted by the next DeleteDir(p->second->id)
// (the next iterator we must calculate beforehand)
pnext = system->dirs.NextChild(p);
RemoveDirTree(p->second->id);
}
plugin.Call(WINIX_DIR_PREPARE_TO_REMOVE, dir_id);
content_dir_iq.WhereParentId(dir_id);
db->GetItems(content_item_tab, content_dir_iq);
@@ -214,9 +209,13 @@ void Rm::RemoveDirTree(long dir_id)
void Rm::RemoveDir(const Item & dir)
{
plugin.Call(WINIX_DIR_PREPARE_TO_REMOVE, const_cast<Item*>(&dir));
old_url = dir.url;
RemoveDirTree(dir.id);
// warning: 'dir' has been deleted so don't use the 'dir' reference
if( cur->request->status == WINIX_ERR_OK )
log << log3 << "Rm: removed directory " << old_url << logend;
}