|
@@ -2,7 +2,6 @@
|
|
|
#include "SpBase.h"
|
|
|
#include "SpIni.h"
|
|
|
#include "upload.h"
|
|
|
-
|
|
|
#include <memutil.h>
|
|
|
#include <fileutil.h>
|
|
|
#include <array.h>
|
|
@@ -73,110 +72,82 @@ using namespace std;
|
|
|
// return Error;
|
|
|
//}
|
|
|
|
|
|
-//static upload_dir_t *upload_dir_load(IEntityFunction *pEntityFunc, IConfigInfo *pConfig, const char *dir, int default_silent_time, int default_limitation)
|
|
|
+//static upload_dir_t *upload_dir_load(IEntityFunction *pEntityFunc, const char *dir, int default_silent_time, int default_limitation)
|
|
|
//{
|
|
|
// upload_dir_t *updir = ZALLOC_T(upload_dir_t);
|
|
|
// if (updir)
|
|
|
// {
|
|
|
-// char tmp[MAX_PATH];
|
|
|
// CSimpleStringA str;
|
|
|
-// ErrorCodeEnum Error = pConfig->ReadConfigValue(dir, "Path", str);
|
|
|
-// if (Error == Error_Succeed)
|
|
|
-// {
|
|
|
+//
|
|
|
+// std::map<std::string, std::string> macroPath;
|
|
|
+// macroPath["SysLog"] = "$(SysLog)"; //TODO
|
|
|
+// macroPath["InterLog"] = "$(InterLog)"; //TODO
|
|
|
+// macroPath["Photo"] = "$(UploadPhoto)";
|
|
|
+// macroPath["Video"] = "$(UploadVideo)";
|
|
|
+// macroPath["SilverlightDebug"] = "$(slv)"; //TODO
|
|
|
+// macroPath["Debug"] = "$(dbg)";
|
|
|
+//
|
|
|
+// std::map<std::string, bool> macroZip;
|
|
|
+// macroZip["SysLog"] = true;
|
|
|
+// macroZip["InterLog"] = true;
|
|
|
+// macroZip["Photo"] = false;
|
|
|
+// macroZip["Video"] = false;
|
|
|
+// macroZip["SilverlightDebug"] = true;
|
|
|
+// macroZip["Debug"] = true;
|
|
|
+//
|
|
|
+// ErrorCodeEnum Error = Error_Succeed;
|
|
|
+// if (macroPath.find(dir) == macroPath.end()) {
|
|
|
+// return updir;
|
|
|
+// }
|
|
|
+// str = macroPath[dir].c_str();
|
|
|
+//
|
|
|
+// INIT_LIST_HEAD(&updir->candidate_list);
|
|
|
+// CSimpleStringA strRealPath;
|
|
|
+// Error = expand_dir(pEntityFunc, (LPCSTR)str, strRealPath);
|
|
|
+// if (Error == Error_Succeed) {
|
|
|
// INIT_LIST_HEAD(&updir->candidate_list);
|
|
|
-// CSimpleStringA strRealPath;
|
|
|
-// Error = expand_dir(pEntityFunc, (LPCSTR)str, strRealPath);
|
|
|
-// if (Error == Error_Succeed)
|
|
|
-// {
|
|
|
-// INIT_LIST_HEAD(&updir->candidate_list);
|
|
|
-// updir->name = _strdup(dir);
|
|
|
-// updir->path = _strdup(strRealPath);
|
|
|
-// pConfig->ReadConfigValue(dir, "MovePath", str);
|
|
|
-// if (str.GetLength() > 0)
|
|
|
-// {
|
|
|
-// updir->flags |= UPLOAD_FLAG_MOVEPATH;
|
|
|
-// Error = expand_dir(pEntityFunc, str, strRealPath);
|
|
|
-// if (Error != Error_Succeed)
|
|
|
-// {
|
|
|
-// return NULL;
|
|
|
-// }
|
|
|
-// updir->movepath = _strdup(strRealPath);
|
|
|
-// } else {
|
|
|
-// pConfig->ReadConfigValue(dir, "AutoDelete", str);
|
|
|
-// if (_stricmp(str, "true") == 0)
|
|
|
-// {
|
|
|
-// updir->flags |= UPLOAD_FLAG_AUTODELETE;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// pConfig->ReadConfigValue(dir, "Zip", str);
|
|
|
+// updir->name = _strdup(dir);
|
|
|
+// updir->path = _strdup(strRealPath);
|
|
|
//
|
|
|
-// if (_stricmp(str, "true") == 0)
|
|
|
-// {
|
|
|
-// updir->flags |= UPLOAD_FLAG_ZIP;
|
|
|
-// }
|
|
|
-// pConfig->ReadConfigValueInt(dir, "SilentTime", updir->silent_time);
|
|
|
-// if (updir->silent_time == 0)
|
|
|
-// {
|
|
|
-// updir->silent_time = default_silent_time;
|
|
|
+// if (strcmp(dir, "Video") == 0) {
|
|
|
+// str = "$(LocalVideo)";
|
|
|
+// updir->flags |= UPLOAD_FLAG_MOVEPATH;
|
|
|
+// Error = expand_dir(pEntityFunc, str, strRealPath);
|
|
|
+// if (Error != Error_Succeed) {
|
|
|
+// return NULL;
|
|
|
// }
|
|
|
-// pConfig->ReadConfigValueInt(dir, "Limitation", updir->child_count_limitation);
|
|
|
-// if (updir->child_count_limitation == 0)
|
|
|
-// {
|
|
|
-// updir->child_count_limitation = default_limitation;
|
|
|
-// }
|
|
|
-// updir->fileCount=0;//初始化设置为0
|
|
|
-// updir->fileLenSum=0;//初始化设置为0
|
|
|
+// updir->movepath = _strdup(strRealPath);
|
|
|
+// } else {
|
|
|
+// updir->flags |= UPLOAD_FLAG_AUTODELETE;
|
|
|
+// }
|
|
|
+// if (macroZip.find(dir) != macroZip.end() && macroZip[dir]) {
|
|
|
+// updir->flags |= UPLOAD_FLAG_ZIP;
|
|
|
// }
|
|
|
+// if (strcmp("SilverlightDebug", dir) == 0 || strcmp("Debug", dir) == 0) {
|
|
|
+// updir->silent_time = 86400;
|
|
|
+// } else {
|
|
|
+// updir->silent_time = 900;
|
|
|
+// }
|
|
|
+// updir->child_count_limitation = default_limitation;
|
|
|
+// updir->fileCount = 0;//初始化设置为0
|
|
|
+// updir->fileLenSum = 0;//初始化设置为0
|
|
|
// }
|
|
|
// }
|
|
|
// return updir;
|
|
|
//}
|
|
|
|
|
|
//初始化要上传的文件夹配置
|
|
|
-//int upload_create(struct list_head *list, IEntityFunction *pEntityFunc, IConfigInfo *pConfig, CSimpleStringA &checkDir)
|
|
|
+//int upload_create(struct list_head *list, IEntityFunction *pEntityFunc, CSimpleStringA &checkDir)
|
|
|
//{
|
|
|
// assert(list_empty(list));
|
|
|
-// assert(pConfig);
|
|
|
-// ErrorCodeEnum Error;
|
|
|
// char type_str[1024];
|
|
|
// char *p, *c;
|
|
|
-// int default_silent_time = 0;
|
|
|
-// int default_limitation = 0;
|
|
|
-//
|
|
|
-// {
|
|
|
-// CSimpleStringA str;
|
|
|
-// Error = pConfig->ReadConfigValue("Main", "Type", str);
|
|
|
-// if (Error == Error_Succeed)
|
|
|
-// {
|
|
|
-// strcpy(type_str, (LPCSTR)str);
|
|
|
-// }
|
|
|
-// else
|
|
|
-// {
|
|
|
-// return Error;
|
|
|
-// }
|
|
|
-// //添加lwt,读入日结时需要检查的文件类型参数
|
|
|
-// /**交易受限功能代码废弃
|
|
|
-// Error = pConfig->ReadConfigValue("Main", "CheckType", str);
|
|
|
-// if (Error == Error_Succeed)
|
|
|
-// {
|
|
|
-// checkDir = str;
|
|
|
-// }
|
|
|
-// else
|
|
|
-// {
|
|
|
-// return Error;
|
|
|
-// }
|
|
|
-// */
|
|
|
-// pConfig->ReadConfigValueInt("Main", "SilentTime", default_silent_time);//间隔时间
|
|
|
-// pConfig->ReadConfigValueInt("Main", "Limitation", default_limitation);//最大文件数
|
|
|
-// if (default_limitation == 0)
|
|
|
-// {
|
|
|
-// default_limitation = INT_MAX;
|
|
|
-// }
|
|
|
-// }
|
|
|
+// int default_silent_time = 3600;
|
|
|
+// int default_limitation = 256;
|
|
|
+// strcpy(type_str, "SysLog,InterLog,Photo,Video,SilverlightDebug,Debug");
|
|
|
// p = strtok_s(type_str, ", ", &c);
|
|
|
-//
|
|
|
// while (p) {
|
|
|
-// upload_dir_t *dir = upload_dir_load(pEntityFunc, pConfig, p, default_silent_time, default_limitation);
|
|
|
+// upload_dir_t *dir = upload_dir_load(pEntityFunc, p, default_silent_time, default_limitation);
|
|
|
// if (!dir)
|
|
|
// {
|
|
|
// return Error_Unexpect;
|
|
@@ -185,7 +156,6 @@ using namespace std;
|
|
|
// list_add_tail(&dir->entry, list);
|
|
|
// p = strtok_s(NULL, ", ", &c);
|
|
|
// }
|
|
|
-//
|
|
|
// return 0;
|
|
|
//}
|
|
|
|