changed organization of static files
removed: item.auth item.auth_path added: item.file_path, item.file_fs, item.file_type now the path to a static file is a relative path added: thumbnails (not finished yet) fixed: db didn't correctly return the number of deleted items /DelItem() method/ git-svn-id: svn://ttmath.org/publicrep/winix/trunk@696 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -78,10 +78,10 @@ void Rm::RemoveAuthPrepareQuery()
|
||||
|
||||
rm_auth_iq.sel_parent_id = true;
|
||||
rm_auth_iq.sel_type = true;
|
||||
rm_auth_iq.sel_auth = true;
|
||||
rm_auth_iq.sel_file = true;
|
||||
|
||||
rm_auth_iq.WhereType(Item::file);
|
||||
rm_auth_iq.WhereAuth(Item::auth_none, false);
|
||||
rm_auth_iq.WhereFileType(WINIX_ITEM_FILETYPE_NONE, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -104,15 +104,12 @@ void Rm::RemoveAllDirs(long dir_id)
|
||||
db->GetItems(request->item_tab, rm_auth_iq);
|
||||
|
||||
for(size_t i=0 ; i<request->item_tab.size() ; ++i)
|
||||
RemoveAuth(request->item_tab[i]);
|
||||
RemoveStaticFile(request->item_tab[i]);
|
||||
|
||||
if( db->DelDirById(dir_id) == WINIX_ERR_OK )
|
||||
{
|
||||
system->dirs.DelDir(dir_id);
|
||||
|
||||
db->RemoveThread(dir_id);
|
||||
// !! tticket
|
||||
// db->RemoveTicket(dir_id);
|
||||
|
||||
plugin.Call(WINIX_DIR_REMOVED, dir_id);
|
||||
}
|
||||
@@ -160,29 +157,27 @@ void Rm::RemoveDir()
|
||||
|
||||
|
||||
|
||||
void Rm::RemoveAuth(Item & item)
|
||||
void Rm::RemoveStaticFile(Item & item)
|
||||
{
|
||||
if( item.auth_path.empty() )
|
||||
if( item.file_path.empty() )
|
||||
{
|
||||
log << log1 << "Content: can't remove a static file: auth_path is empty" << logend;
|
||||
log << log1 << "Rm: can't remove a static file: file_path is empty" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
if( ::RemoveFile(item.auth_path) )
|
||||
if( !system->MakeFilePath(item, path) )
|
||||
return;
|
||||
|
||||
if( ::RemoveFile(path) )
|
||||
{
|
||||
log << log1 << "Content: removed static file: " << item.auth_path << logend;
|
||||
item.auth_path.clear();
|
||||
item.auth = Item::auth_none;
|
||||
log << log1 << "Rm: removed static file: " << path << logend;
|
||||
item.file_path.clear();
|
||||
item.file_type = WINIX_ITEM_FILETYPE_NONE;
|
||||
// we don't store it to db (will be removed or is removed already)
|
||||
}
|
||||
else
|
||||
{
|
||||
int err = errno;
|
||||
|
||||
log << log1 << "Content: can't remove a file: " << item.auth_path;
|
||||
log.SystemErr(err);
|
||||
log << logend;
|
||||
|
||||
log << log1 << "Rm: can't remove a file: " << path << logend;
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
}
|
||||
}
|
||||
@@ -198,26 +193,19 @@ void Rm::RemoveFile()
|
||||
request->status = WINIX_ERR_UNKNOWN_PARAM;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if( db->DelItem( request->item ) )
|
||||
{
|
||||
log << log2 << "Content: deleted item: subject: " << request->item.subject << ", id: " << request->item.id << logend;
|
||||
log << log2 << "Rm: deleted item: subject: " << request->item.subject << ", id: " << request->item.id << logend;
|
||||
TemplatesFunctions::pattern_cacher.DeletePattern(request->item);
|
||||
|
||||
plugin.Call(WINIX_FILE_REMOVED, request->item.id);
|
||||
|
||||
if( system->mounts.pmount->type == system->mounts.MountTypeThread() )
|
||||
db->EditThreadRemoveItem(request->item.parent_id);
|
||||
/*
|
||||
!! tticket
|
||||
else
|
||||
if( system->mounts.pmount->type == system->mounts.MountTypeTicket() )
|
||||
db->EditTicketRemoveItem(request->item.id);
|
||||
*/
|
||||
|
||||
if( request->item.auth != Item::auth_none )
|
||||
RemoveAuth(request->item);
|
||||
if( request->item.file_type != WINIX_ITEM_FILETYPE_NONE )
|
||||
RemoveStaticFile(request->item);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user