Patch level :4.0 790

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :nuove procedure aggiornamento client


git-svn-id: svn://10.65.10.50/trunk@15642 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2007-09-25 12:38:08 +00:00
parent 6da0b223ba
commit 8678ec432c

@ -88,6 +88,7 @@ protected:
void manage_preferred();
bool test_programs();
void copy_setup(const TString& remote_path);
public:
void select_tree_current();
@ -1222,18 +1223,39 @@ static int get_module_version(TConfig& cfg, void* jolly)
return false;
}
void TMenu_application::copy_setup(const TString& remote_path)
{
const TFilename local_setupdir = "setup";
make_dir(local_setupdir);
TFilename remote_setupdir = remote_path;
remote_setupdir.add(local_setupdir.name());
TString_array ar;
list_files(remote_setupdir, ar);
TFilename strsrc, strdst;
FOR_EACH_ARRAY_ROW (ar, i, row)
{
strsrc = *row;
strdst = local_setupdir;
strdst.add(strsrc.name());
fcopy(strsrc, strdst);
}
}
bool TMenu_application::test_programs()
{
TToken_string dangerous;
int update_needed = 0;
bool test = false;
bool more = false;
//parentesi necessaria per richiudere subito il .ini!
{
TConfig prawin(CONFIG_INSTALL, "Main");
test = prawin.get_bool("TestPrograms");
}
while (test)
if (test)
{
TConfig install("install.ini", "Main");
TFilename remote_name = install.get("DiskPath");
@ -1253,14 +1275,21 @@ bool TMenu_application::test_programs()
remote_install.for_each_paragraph(get_module_version, &his_modules);
pi.addstatus(1);
TString msg = TR("I seguenti moduli devono essere aggiornati prima dell'utilizzo:");
int update_needed = 0;
TString msg = TR("I seguenti moduli devono essere aggiornati prima dell'utilizzo:\n");
for (word module = 0; module < ENDAUT; module++)
//giro su tutti i moduli che sono sul server
const TDongle& chiavetta = dongle();
FOR_EACH_ASSOC_STRING(his_modules, h, str_code, str_tok)
{
if (dongle().active(module) && dongle().shown(module))
//per prima cosa controlla se deve aggiornare SY e/o BA
int module = 0;
const TString4 code = str_code;
if (code != "sy" && code != "ba")
module = chiavetta.module_name2code(code);
if (chiavetta.active(module) && chiavetta.shown(module))
{
const TString4 code = dongle().module_code2name(module);
//const TString4 code = dongle().module_code2name(module);
TToken_string* mytok = (TToken_string*)my_modules.objptr(code);
TToken_string* histok = (TToken_string*)his_modules.objptr(code);
@ -1270,24 +1299,28 @@ bool TMenu_application::test_programs()
const int p2 = histok ? histok->get_int() : 0;
if (!v1.blank() && compare_version(v1, p1, v2, p2) < 0)
{
if (module > 0) // Non disabilitare mai il modulo base!
// Non disabilitare mai il modulo base! Se non funzionasse qualcosa (vedi anno di assistenza)...
//...non lascierebbe funzionare nulla!!!!
if (module > 0)
dangerous.add(code);
if (!more)
if (msg.len() < 200)
{
if (msg.len() < 200)
{
const TString& name = dongle().module_code2desc(module);
if (update_needed > 0)
msg << ',';
msg << name;
}
TString name;
if (code == "sy")
name = TR("Sistema");
else
{
if (msg.right(1) != ".")
msg << ",etc.";
}
update_needed++;
name = chiavetta.module_code2desc(module);
if (update_needed > 0)
msg << ", ";
msg << name;
}
else
{
if (msg.right(1) != ".")
msg << ",etc.";
}
update_needed++;
}
}
}
@ -1296,18 +1329,19 @@ bool TMenu_application::test_programs()
warning_box(msg);
}
if (more)
break;
if (dangerous.empty() ||
(!more && !yesno_box(TR("Si desidera aggiornare i moduli adesso?"))))
break;
if (update_needed > 0 && yesno_box(TR("Si desidera aggiornare i moduli adesso?")))
{
//copia il contenuto della setup del server nella setup del client
copy_setup(remote_name.path());
//mette il flag di installing
set_installing_flag();
//lancia setup in modalita' aggiornamento client e si suicida! (banzai!!)
TExternal_app app("setup/setup.exe -uc");
app.run(true);
user() = dongle().administrator(); // Divento temporaneamente amministratore
TExternal_app app("ba1 -6");
app.run(true);
set_installing_flag();
//se lancia un'installazione->esce!!!
return false;
//se lancia un'installazione->esce!!!
return false;
}
}
_menu.set_dangerous_modules(dangerous);
return true;