git.stg.codes
/
stg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added --auth-by.
[stg.git]
/
projects
/
stargazer
/
plugins
/
store
/
files
/
file_store.cpp
diff --git
a/projects/stargazer/plugins/store/files/file_store.cpp
b/projects/stargazer/plugins/store/files/file_store.cpp
index 4e4489adcaa86614d32aaa0b390e24b5e513506b..0466b82490c97bfd576a2e477a7d0514257ab388 100644
(file)
--- a/
projects/stargazer/plugins/store/files/file_store.cpp
+++ b/
projects/stargazer/plugins/store/files/file_store.cpp
@@
-728,7
+728,7
@@
for (int i = 0; i < DIR_NUM; i++)
printfd(__FILE__, "FILES_STORE::RestoreUserStat - download stat read failed for user '%s'\n", login.c_str());
return -1;
}
printfd(__FILE__, "FILES_STORE::RestoreUserStat - download stat read failed for user '%s'\n", login.c_str());
return -1;
}
- stat->
d
own[i] = traff;
+ stat->
monthD
own[i] = traff;
snprintf(s, 22, "U%d", i);
if (cf.ReadULongLongInt(s, &traff, 0) != 0)
snprintf(s, 22, "U%d", i);
if (cf.ReadULongLongInt(s, &traff, 0) != 0)
@@
-738,7
+738,7
@@
for (int i = 0; i < DIR_NUM; i++)
printfd(__FILE__, "FILES_STORE::RestoreUserStat - upload stat read failed for user '%s'\n", login.c_str());
return -1;
}
printfd(__FILE__, "FILES_STORE::RestoreUserStat - upload stat read failed for user '%s'\n", login.c_str());
return -1;
}
- stat->
u
p[i] = traff;
+ stat->
monthU
p[i] = traff;
}
if (cf.ReadDouble("Cash", &stat->cash, 0) != 0)
}
if (cf.ReadDouble("Cash", &stat->cash, 0) != 0)
@@
-869,9
+869,9
@@
fileName = storeSettings.GetUsersDir() + "/" + login + "/stat";
for (int i = 0; i < DIR_NUM; i++)
{
snprintf(s, 22, "D%d", i);
for (int i = 0; i < DIR_NUM; i++)
{
snprintf(s, 22, "D%d", i);
- cfstat.WriteInt(s, stat.
d
own[i]);
+ cfstat.WriteInt(s, stat.
monthD
own[i]);
snprintf(s, 22, "U%d", i);
snprintf(s, 22, "U%d", i);
- cfstat.WriteInt(s, stat.
u
p[i]);
+ cfstat.WriteInt(s, stat.
monthU
p[i]);
}
cfstat.WriteDouble("Cash", stat.cash);
}
cfstat.WriteDouble("Cash", stat.cash);
@@
-990,8
+990,8
@@
return WriteLog2String(logStr, login);
}
//-----------------------------------------------------------------------------
int FILES_STORE::WriteUserDisconnect(const std::string & login,
}
//-----------------------------------------------------------------------------
int FILES_STORE::WriteUserDisconnect(const std::string & login,
- const DIR_TRAFF &
u
p,
- const DIR_TRAFF &
d
own,
+ const DIR_TRAFF &
monthU
p,
+ const DIR_TRAFF &
monthD
own,
const DIR_TRAFF & sessionUp,
const DIR_TRAFF & sessionDown,
double cash,
const DIR_TRAFF & sessionUp,
const DIR_TRAFF & sessionDown,
double cash,
@@
-1005,9
+1005,9
@@
logStr << "Disconnect, "
<< "\' session download: \'"
<< sessionDown
<< "\' month upload: \'"
<< "\' session download: \'"
<< sessionDown
<< "\' month upload: \'"
- <<
u
p
+ <<
monthU
p
<< "\' month download: \'"
<< "\' month download: \'"
- <<
d
own
+ <<
monthD
own
<< "\' cash: \'"
<< cash
<< "\'";
<< "\' cash: \'"
<< cash
<< "\'";
@@
-1061,11
+1061,11
@@
for (size_t i = 0; i < DIR_NUM; i++)
{
char dirName[3];
snprintf(dirName, 3, "U%llu", (unsigned long long)i);
{
char dirName[3];
snprintf(dirName, 3, "U%llu", (unsigned long long)i);
- s.WriteInt(dirName, stat.
u
p[i]); // Classic
- s2.WriteInt(dirName, stat.
u
p[i]); // New
+ s.WriteInt(dirName, stat.
monthU
p[i]); // Classic
+ s2.WriteInt(dirName, stat.
monthU
p[i]); // New
snprintf(dirName, 3, "D%llu", (unsigned long long)i);
snprintf(dirName, 3, "D%llu", (unsigned long long)i);
- s.WriteInt(dirName, stat.
d
own[i]); // Classic
- s2.WriteInt(dirName, stat.
d
own[i]); // New
+ s.WriteInt(dirName, stat.
monthD
own[i]); // Classic
+ s2.WriteInt(dirName, stat.
monthD
own[i]); // New
}
// Classic
}
// Classic
@@
-1483,6
+1483,11
@@
else
printfd(__FILE__, "FILES_STORE::RestoreTariff - invalid trafftype for tariff '%s'\n", tariffName.c_str());
return -1;
}
printfd(__FILE__, "FILES_STORE::RestoreTariff - invalid trafftype for tariff '%s'\n", tariffName.c_str());
return -1;
}
+
+if (conf.ReadString("Period", &str, "month") < 0)
+ td->tariffConf.period = TARIFF::MONTH;
+else
+ td->tariffConf.period = TARIFF::StringToPeriod(str);
return 0;
}
//-----------------------------------------------------------------------------
return 0;
}
//-----------------------------------------------------------------------------
@@
-1558,6
+1563,8
@@
std::string fileName = storeSettings.GetTariffsDir() + "/" + tariffName + ".tf";
cf.WriteString("TraffType", "max");
break;
}
cf.WriteString("TraffType", "max");
break;
}
+
+ cf.WriteString("Period", TARIFF::PeriodToString(td.tariffConf.period));
}
return 0;
}
return 0;
@@
-1851,7
+1858,7
@@
if (rename((fileName + ".new").c_str(), fileName.c_str()) < 0)
{
STG_LOCKER lock(&mutex, __FILE__, __LINE__);
errorStr = "Error moving dir from " + fileName + ".new to " + fileName;
{
STG_LOCKER lock(&mutex, __FILE__, __LINE__);
errorStr = "Error moving dir from " + fileName + ".new to " + fileName;
- printfd(__FILE__, "FILES_STORE::
SaveTariff
- rename failed. Message: '%s'\n", strerror(errno));
+ printfd(__FILE__, "FILES_STORE::
EditMessage
- rename failed. Message: '%s'\n", strerror(errno));
return -1;
}
return -1;
}