fixed: UGContainer<Type> used a std::vector<Type> and when a new item was inserted
then current iterators (and pointers) were invalidated
now we are using std::vector<Type*>
this caused some crashes when a new user was added by 'adduser' winix function
added: plugin 'export' is able to upload files on a remote server now
(not finished yet)
changed: Thumb class is now called: Image
and we are able to resize images too
(some new options in the config and in mount points)
added: some new plugin messages
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@764 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* Copyright (c) 2008-2011, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
@@ -10,6 +10,8 @@
|
||||
#include <errno.h>
|
||||
#include "mv.h"
|
||||
#include "functions.h"
|
||||
#include "core/plugin.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
@@ -179,6 +181,8 @@ bool res1, res2, res3, res4, res5;
|
||||
|
||||
void Mv::MoveFileOrSymlink(Item & item)
|
||||
{
|
||||
plugin.Call(WINIX_FILE_PREPARE_TO_MOVE, &item);
|
||||
|
||||
old_url = item.url;
|
||||
|
||||
if( !file.empty() )
|
||||
@@ -204,6 +208,8 @@ void Mv::MoveFileOrSymlink(Item & item)
|
||||
|
||||
if( item.file_type != WINIX_ITEM_FILETYPE_NONE )
|
||||
MoveStaticFile(item);
|
||||
|
||||
plugin.Call(WINIX_FILE_MOVED, &item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,39 +241,63 @@ void Mv::Prepare()
|
||||
content_dir_iq.sel_url = true;
|
||||
content_dir_iq.sel_file = true;
|
||||
|
||||
static_iq.SetAll(false, false);
|
||||
static_iq.sel_parent_id = true;
|
||||
static_iq.sel_type = true;
|
||||
static_iq.sel_url = true;
|
||||
static_iq.sel_file = true;
|
||||
|
||||
static_iq.WhereType(Item::file);
|
||||
static_iq.WhereFileType(WINIX_ITEM_FILETYPE_NONE, false);
|
||||
files_iq.SetAll(false, false);
|
||||
files_iq.sel_parent_id = true;
|
||||
files_iq.sel_type = true;
|
||||
files_iq.sel_url = true;
|
||||
files_iq.sel_file = true;
|
||||
files_iq.WhereType(Item::dir, false);
|
||||
}
|
||||
|
||||
|
||||
void Mv::Clear()
|
||||
{
|
||||
dir_tab.clear();
|
||||
static_item_tab.clear();
|
||||
files_item_tab.clear();
|
||||
item_tab.clear();
|
||||
}
|
||||
|
||||
|
||||
void Mv::MoveFilesPrepareTree(const Item & dir)
|
||||
{
|
||||
// we only calling plugins here
|
||||
// so if there is no WINIX_FILE_PREPARE_TO_MOVE message
|
||||
// we can immediately return and the database will not be bothered
|
||||
if( !plugin.HasMessage(WINIX_FILE_PREPARE_TO_MOVE) )
|
||||
return;
|
||||
|
||||
void Mv::MoveStaticFilesTree(const Item & dir)
|
||||
DirContainer::ParentIterator i = system->dirs.FindFirstChild(dir.id);
|
||||
|
||||
// go through all directories
|
||||
for( ; i != system->dirs.ParentEnd() ; i = system->dirs.NextChild(i) )
|
||||
MoveFilesPrepareTree(*(i->second));
|
||||
|
||||
files_iq.WhereParentId(dir.id);
|
||||
db->GetItems(files_item_tab, files_iq);
|
||||
|
||||
for(size_t i=0 ; i<files_item_tab.size() ; ++i)
|
||||
plugin.Call(WINIX_FILE_PREPARE_TO_MOVE, &files_item_tab[i]);
|
||||
}
|
||||
|
||||
|
||||
void Mv::MoveFilesTree(const Item & dir)
|
||||
{
|
||||
DirContainer::ParentIterator i = system->dirs.FindFirstChild(dir.id);
|
||||
|
||||
// go through all directories
|
||||
for( ; i != system->dirs.ParentEnd() ; i = system->dirs.NextChild(i) )
|
||||
MoveStaticFilesTree(*(i->second));
|
||||
MoveFilesTree(*(i->second));
|
||||
|
||||
static_iq.WhereParentId(dir.id);
|
||||
db->GetItems(static_item_tab, static_iq);
|
||||
files_iq.WhereParentId(dir.id);
|
||||
db->GetItems(files_item_tab, files_iq);
|
||||
|
||||
for(size_t i=0 ; i<static_item_tab.size() ; ++i)
|
||||
MoveStaticFile(static_item_tab[i]);
|
||||
for(size_t i=0 ; i<files_item_tab.size() ; ++i)
|
||||
{
|
||||
if( files_item_tab[i].file_type != WINIX_ITEM_FILETYPE_NONE )
|
||||
MoveStaticFile(files_item_tab[i]);
|
||||
|
||||
plugin.Call(WINIX_FILE_MOVED, &files_item_tab[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -284,6 +314,8 @@ void Mv::MoveDir(Item & dir)
|
||||
return;
|
||||
}
|
||||
|
||||
MoveFilesPrepareTree(dir);
|
||||
|
||||
if( !system->dirs.ChangeParent(dir.id, dst_dir_id) )
|
||||
{
|
||||
cur->request->status = WINIX_ERR_INCORRECT_DIR;
|
||||
@@ -307,7 +339,7 @@ void Mv::MoveDir(Item & dir)
|
||||
system->dirs.LogDir(dir_tab);
|
||||
log << dir.url << logend;
|
||||
|
||||
MoveStaticFilesTree(dir);
|
||||
MoveFilesTree(dir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user