Patch level :

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :


git-svn-id: svn://10.65.10.50/trunk@15961 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2008-01-07 11:29:42 +00:00
parent e866fd69d3
commit 9daaa15279

View File

@ -109,8 +109,8 @@ protected:
void AssociateExtension(const wxFileName& strExeFile, const wxString strExt);
//...per i servers
bool CreateAutostartMode(const LurchMode iSrvAutostartMode, const wxString& strPath);
long StopLurch();
long StartLurch();
bool StopLurch() const;
bool StartLurch(const wxString& strPrgLocPath) const;
//metodi di interfaccia con il registry di Windows
wxString ReadRootRegistryKey(const wxString strKey) const;
@ -294,20 +294,52 @@ bool CampoSetup::CreateIcon(unsigned int csidl, const wxFileName& strExeFile, co
//-------------------------------------------
// ..per i servers di Campo
//-------------------------------------------
long CampoSetup::StopLurch()
bool CampoSetup::StopLurch() const
{
bool ok = true;
const wxString strValue = ReadLocalMachineRegistryKey("SYSTEM\\CurrentControlSet\\Services\\Lurch\\Parameters\\Application");
if (!strValue.IsEmpty())
{
wxString strExecService = GetFolderPath(CSIDL_SYSTEM);
strExecService += "\\NET STOP Lurch";
return wxExecute(strExecService, wxEXEC_SYNC);
wxExecute(strExecService, wxEXEC_SYNC);
}
else
{
for (int i = 0; i < 2; i++)
{
wxHTTP scServer;
if (scServer.Connect("127.0.0.1", i == 0 ? 10000 : 1883))
{
wxString strResponse = scServer.GetHeader("/stop.cgi");
if (strResponse.Find("200") > 0)
{
wxSleep(3);
break;
}
}
}
}
return ok;
}
long CampoSetup::StartLurch()
bool CampoSetup::StartLurch(const wxString& strPrgLocPath) const
{
const wxString strValue = ReadLocalMachineRegistryKey("SYSTEM\\CurrentControlSet\\Services\\Lurch\\Parameters\\Application");
if (!strValue.IsEmpty())
{
wxString strExecService = GetFolderPath(CSIDL_SYSTEM);
strExecService += "\\NET START Lurch";
return wxExecute(strExecService, wxEXEC_SYNC);
wxExecute(strExecService, wxEXEC_SYNC);
}
else
{
wxString strPath = strPrgLocPath;
strPath += "/servers/lurch.exe";
wxExecute(strPath, wxEXEC_ASYNC);
}
return true;
}
bool CampoSetup::CreateAutostartMode(const LurchMode iSrvAutostartMode, const wxString& strPath)
@ -329,7 +361,11 @@ bool CampoSetup::CreateAutostartMode(const LurchMode iSrvAutostartMode, const wx
const long lRemove = wxExecute(strRemove, wxEXEC_SYNC);
}
//2) Cerca di fermare Lurch se presente come programma in esecuzione automatica
else
{
if (LurchRunning())
StopLurch();
}
switch (iSrvAutostartMode)
{
@ -423,6 +459,12 @@ void CampoSetup::UpdateInstallIni(const wxString strSourcePath, const wxString s
bool CampoSetup::UnzipModule(const wxString& strPrgLocPath, const wxString& strSrc, const wxString& strModule) const
{
//Attenzione! Se c'e' il server di chiavi in funzione va fermato prima di procedere!!!!
const bool bLurch = strModule == "sr" && LurchRunning();
if (bLurch)
StopLurch();
bool ok = false;
wxArrayString asFilesList;
//..contando anche quanti sono e memorizzandoli in un array asFileList
@ -450,6 +492,11 @@ bool CampoSetup::UnzipModule(const wxString& strPrgLocPath, const wxString& strS
//potrebbe sembrare assurdo un for, ma e' per futuri sottomoduli con numero > 1
UpdateInstallIni(strWrk, strPrgLocPath + "/install.ini", strModule);
}
//Adesso puo' far ripartire il server di chiavi
if (bLurch)
StartLurch(strPrgLocPath);
return uFilesToCopy > 0;
}
@ -736,8 +783,6 @@ void CampoSetup::ClientUpdate()
}
ClientUpdateModule(strLocalPath, strRemotePath, "sy");
//ma serve aggiornare SR su un client?
ClientUpdateModule(strLocalPath, strRemotePath, "sr");
wxSetWorkingDirectory(strLocalPath);
wxExecute("ba1 -6 /uADMIN");
@ -758,11 +803,9 @@ void CampoSetup::DiskUpdate()
strRemotePath = iniLocalInstall.Get("DiskPath");
}
//Attenzione! deve fermare il server di chiavi qui...
DiskUpdateModule(strLocalPath, strRemotePath, "sy");
DiskUpdateModule(strLocalPath, strRemotePath, "sr");
//..e farlo ripartire qui
wxSetWorkingDirectory(strLocalPath);
wxExecute("ba1 -6 /uADMIN");
}
@ -786,12 +829,10 @@ void CampoSetup::InternetUpdate()
strRemotePath = iniLocalInstall.Get("WebPath");
}
//Attenzione! deve fermare il server di chiavi qui...
//aggiornamento dei moduli SY e SR via web
InternetUpdateModule(strLocalPath, strRemotePath, "sy");
InternetUpdateModule(strLocalPath, strRemotePath, "sr");
//..e farlo ripartire qui
//lanciare ba1.exe -6 in uscita
wxSetWorkingDirectory(strLocalPath);
wxExecute("ba1 -6 /uADMIN");