mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Refact
This commit is contained in:
@@ -12,6 +12,9 @@
|
|||||||
#include "tasksAmmFim.h"
|
#include "tasksAmmFim.h"
|
||||||
#include "timingoftrainee.h"
|
#include "timingoftrainee.h"
|
||||||
|
|
||||||
|
static const QString backupEmptyName = "DBLMS_EMPTY.backup";
|
||||||
|
static const QString restoreDBscriptName = "restoreDBscript.bat";
|
||||||
|
|
||||||
class DATABASELMS_EXPORT DataBaseSettings
|
class DATABASELMS_EXPORT DataBaseSettings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ bool DataBaseLMS::createDB()
|
|||||||
if(prepareRestoreDBscript())
|
if(prepareRestoreDBscript())
|
||||||
{
|
{
|
||||||
QProcess process;
|
QProcess process;
|
||||||
QString pgRestorePath = "restoreDBscript.bat";
|
QString pgRestorePath = restoreDBscriptName;
|
||||||
|
|
||||||
process.start("cmd /C " + pgRestorePath);
|
process.start("cmd /C " + pgRestorePath);
|
||||||
process.waitForFinished(-1); // Ждать бесконечно, пока процесс не завершится
|
process.waitForFinished(-1); // Ждать бесконечно, пока процесс не завершится
|
||||||
@@ -235,17 +235,18 @@ bool DataBaseLMS::prepareRestoreDBscript()
|
|||||||
{
|
{
|
||||||
DataBaseSettings settings = getDataBaseSettings();
|
DataBaseSettings settings = getDataBaseSettings();
|
||||||
|
|
||||||
QFile file("restoreDBscript.bat");
|
QFile file(restoreDBscriptName);
|
||||||
if (file.open(QIODevice::WriteOnly | QIODevice::Text))
|
if (file.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
QTextStream out(&file);
|
QTextStream out(&file);
|
||||||
out << "set CURRENT_DIR=%~dp0\n";
|
out << "set CURRENT_DIR=%~dp0\n";
|
||||||
out << "cd %CURRENT_DIR%\n";
|
out << "cd %CURRENT_DIR%\n";
|
||||||
out << QString("set \"PGPASSWORD=%1\"\n").arg(PasswordPostgres);
|
out << QString("set \"PGPASSWORD=%1\"\n").arg(PasswordPostgres);
|
||||||
out << QString("pg_restore -U %1 -h %2 -p %3 -d %4 DBLMS_EMPTY.backup\n").arg(UserNamePostgres,
|
out << QString("pg_restore -U %1 -h %2 -p %3 -d %4 %5\n").arg(UserNamePostgres,
|
||||||
settings.dbHostName,
|
settings.dbHostName,
|
||||||
QString::number(settings.dbPort),
|
QString::number(settings.dbPort),
|
||||||
settings.dbName);
|
settings.dbName,
|
||||||
|
backupEmptyName);
|
||||||
file.close();
|
file.close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,10 @@ static QString staticDataFolderName = "StaticData";
|
|||||||
static QString additionalFilesFolderName = "RRJ-95NEW-100";
|
static QString additionalFilesFolderName = "RRJ-95NEW-100";
|
||||||
static QString streamingAssetsPath = "/Application/RRJLoader/RRJ_Data/StreamingAssets";
|
static QString streamingAssetsPath = "/Application/RRJLoader/RRJ_Data/StreamingAssets";
|
||||||
static QString hashFilename = staticDataFolderName + "/clientHash.xml";
|
static QString hashFilename = staticDataFolderName + "/clientHash.xml";
|
||||||
static QString settingsName = staticDataFolderName + "/settings.xml";
|
|
||||||
|
static QString configFolderName = "config";
|
||||||
|
static QString settingsName = configFolderName + "/settings.xml";
|
||||||
|
|
||||||
static QString tempName = staticDataFolderName + "/temp.xml";
|
static QString tempName = staticDataFolderName + "/temp.xml";
|
||||||
static QString authTempName = staticDataFolderName + "/authData.xml";
|
static QString authTempName = staticDataFolderName + "/authData.xml";
|
||||||
static QString displayTemp = staticDataFolderName + "/displayData.xml";
|
static QString displayTemp = staticDataFolderName + "/displayData.xml";
|
||||||
|
|||||||
Reference in New Issue
Block a user