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:
2010-12-10 21:07:01 +00:00
parent 9b29cce1a4
commit 36c8822e6c
41 changed files with 435 additions and 364 deletions

View File

@@ -79,24 +79,26 @@ return res == 0;
}
void Cp::CpAuth(Item & item)
void Cp::CpStaticFile(Item & item)
{
if( !system->MakePath(item, mv_new_path, true) )
bool res1 = system->MakeFilePath(item, old_path);
bool res2 = system->CreateNewFile(item);
bool res3 = system->MakeFilePath(item, mv_new_path, false, true, config->upload_dirs_chmod);
if( !res1 || !res2 || !res3 )
{
request->status = WINIX_ERR_PERMISSION_DENIED;
return;
}
if( CopyFile(item.auth_path, mv_new_path) )
if( CopyFile(old_path, mv_new_path) )
{
log << log1 << "Content: copied static file from: " << item.auth_path << ", to: " << mv_new_path << logend;
item.auth_path = mv_new_path;
request->status = db->EditAuthById(item, item.id);
log << log1 << "Cp: copied static file from: " << old_path << ", to: " << mv_new_path << logend;
request->status = db->EditFileById(item, item.id);
}
else
{
log << log1 << "Content: can't copy a file from: " << item.auth_path << ", to: " << mv_new_path << logend;
log << log1 << "Cp: can't copy a file from: " << old_path << ", to: " << mv_new_path << logend;
request->status = WINIX_ERR_PERMISSION_DENIED;
}
}
@@ -124,8 +126,8 @@ void Cp::CpItem(Item & item, long dst_dir_id)
if( request->status == WINIX_ERR_OK )
{
if( item.auth != Item::auth_none )
CpAuth(item);
if( item.file_type != WINIX_ITEM_FILETYPE_NONE )
CpStaticFile(item);
}
}