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:
@@ -146,28 +146,26 @@ return res == 0;
|
||||
|
||||
|
||||
|
||||
void Mv::MoveAuth(Item & item)
|
||||
void Mv::MoveStaticFile(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( RenameFile(item.auth_path, mv_new_path) )
|
||||
if( RenameFile(old_path, mv_new_path) )
|
||||
{
|
||||
log << log1 << "Mv: moved 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 << "Mv: moved static file from: " << old_path << ", to: " << mv_new_path << logend;
|
||||
request->status = db->EditFileById(item, item.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
int err = errno;
|
||||
|
||||
log << log1 << "Mv: can't move a file from: " << item.auth_path << ", to: " << mv_new_path << ", ";
|
||||
log.SystemErr(err);
|
||||
log << logend;
|
||||
|
||||
log << log1 << "Mv: can't move a file from: " << old_path << ", to: " << mv_new_path << logend;
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
}
|
||||
}
|
||||
@@ -210,8 +208,8 @@ void Mv::MoveFile(Item & item, bool redirect)
|
||||
{
|
||||
log << log2 << "Mv: the file was moved to: " << mv_dir << item.url << logend;
|
||||
|
||||
if( item.auth != Item::auth_none )
|
||||
MoveAuth(item);
|
||||
if( item.file_type != WINIX_ITEM_FILETYPE_NONE )
|
||||
MoveStaticFile(item);
|
||||
|
||||
if( redirect )
|
||||
system->RedirectTo(item);
|
||||
@@ -227,7 +225,7 @@ DbItemQuery iq;
|
||||
iq.sel_parent_id = true;
|
||||
iq.sel_type = true;
|
||||
iq.sel_url = true;
|
||||
iq.sel_auth = true;
|
||||
iq.sel_file = true;
|
||||
iq.WhereParentId(request->dir_tab.back()->id);
|
||||
|
||||
db->GetItems(request->item_tab, iq);
|
||||
@@ -252,10 +250,10 @@ void Mv::MoveAuthPrepareQuery()
|
||||
mv_auth_iq.sel_parent_id = true;
|
||||
mv_auth_iq.sel_type = true;
|
||||
mv_auth_iq.sel_url = true;
|
||||
mv_auth_iq.sel_auth = true;
|
||||
mv_auth_iq.sel_file = true;
|
||||
|
||||
mv_auth_iq.WhereType(Item::file);
|
||||
mv_auth_iq.WhereAuth(Item::auth_none, false);
|
||||
mv_auth_iq.WhereFileType(WINIX_ITEM_FILETYPE_NONE, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -274,7 +272,7 @@ void Mv::MoveAuthContentOfDir(const Item & item)
|
||||
db->GetItems(mv_auth, mv_auth_iq);
|
||||
|
||||
for(size_t i=0 ; i<mv_auth.size() ; ++i)
|
||||
MoveAuth(mv_auth[i]);
|
||||
MoveStaticFile(mv_auth[i]);
|
||||
|
||||
mv_auth.clear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user