Patch level :10.0 244
Files correlati : Ricompilazione Demo : [ ] Commento :Sistemato problema aggiornamento client in presenza di file da killare che compaiono in una patch e non in una versione (problema segnalato da installazione Verga). Adesso è possibile aggiungere files da uccidere anche nelle patch. Resta ovviamente sottinteso che PRIMA va aggiornato il server e POI il client. git-svn-id: svn://10.65.10.50/trunk@18303 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									16cef4ca99
								
							
						
					
					
						commit
						b434396504
					
				@ -224,7 +224,7 @@ int TInstall_ini::build_kill_list(const TString& module, TString_array& a,
 | 
			
		||||
  return a.items();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TInstall_ini::export_paragraph(const char* module, const char* summary,const bool remove_old)
 | 
			
		||||
void TInstall_ini::export_paragraph(const char* module, const char* summary, const bool remove_old)
 | 
			
		||||
{                             
 | 
			
		||||
  CHECK(module && *module > ' ', "Can't export NULL module");
 | 
			
		||||
  CHECK(summary && *summary > ' ', "Can't export to NULL .ini");
 | 
			
		||||
@ -254,13 +254,13 @@ void TInstall_ini::export_paragraph(const char* module, const char* summary,cons
 | 
			
		||||
  TString ;
 | 
			
		||||
  FOR_EACH_ASSOC_STRING(ass, obj, key, str)
 | 
			
		||||
  {
 | 
			
		||||
    if (!remove_old && is_submodule && strncmp(key, "File", 4)==0 )
 | 
			
		||||
    if (!remove_old && is_submodule && strncmp(key, "File", 4) == 0 )
 | 
			
		||||
    {
 | 
			
		||||
      // merging "File(X)" items...
 | 
			
		||||
      item_value=str;
 | 
			
		||||
      tmps=item_value.get(0);
 | 
			
		||||
      int item_number=find(tmps, old_list);
 | 
			
		||||
      if (item_number>=0)
 | 
			
		||||
      item_value = str;
 | 
			
		||||
      tmps = item_value.get(0);
 | 
			
		||||
      int item_number = find(tmps, old_list);
 | 
			
		||||
      if (item_number >= 0)
 | 
			
		||||
      {
 | 
			
		||||
        // file sostituito
 | 
			
		||||
        TString old_smodule(old_list.row(item_number).get(2));
 | 
			
		||||
@ -276,7 +276,7 @@ void TInstall_ini::export_paragraph(const char* module, const char* summary,cons
 | 
			
		||||
            break;
 | 
			
		||||
        } 
 | 
			
		||||
        while (obj);
 | 
			
		||||
        newkey=obj->key();
 | 
			
		||||
        newkey = obj->key();
 | 
			
		||||
        if (old_smodule!=module)
 | 
			
		||||
        {
 | 
			
		||||
          // devo cancellare il file dal vecchio sottomodulo
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										277
									
								
								ba/ba1700.cpp
									
									
									
									
									
								
							
							
						
						
									
										277
									
								
								ba/ba1700.cpp
									
									
									
									
									
								
							@ -137,11 +137,12 @@ protected:
 | 
			
		||||
  static bool install_handler(TMask_field& fld, KEY key);
 | 
			
		||||
  static bool update_handler(TMask_field& f, KEY k);
 | 
			
		||||
 | 
			
		||||
  bool add_module(TConfig& ini, const TString& module, bool patch, int pos=-1);
 | 
			
		||||
  bool add_module(TConfig& ini, const TString& module, bool patch, int pos = -1);
 | 
			
		||||
  bool add_header(TConfig& ini, const TString& module);
 | 
			
		||||
  int precheck_modules(bool only_newer=true);
 | 
			
		||||
  int precheck_modules(bool only_newer = true);
 | 
			
		||||
  void update_version();
 | 
			
		||||
  void update_install_ini() const;
 | 
			
		||||
  void update_disk_and_web_path();
 | 
			
		||||
  void kill_files();
 | 
			
		||||
 | 
			
		||||
  int needs_reboot(const TFilename& file) const;
 | 
			
		||||
  bool move_file(const TFilename& src, const TFilename& dst) const;
 | 
			
		||||
@ -149,8 +150,8 @@ protected:
 | 
			
		||||
 | 
			
		||||
  bool can_install(const char* module, TInstall_ini& ini);
 | 
			
		||||
  void install_selection();
 | 
			
		||||
  bool install_patches(const TString& module, const TString& lastrelease, int lastpatch , bool onlynew=true);
 | 
			
		||||
  KEY askdisk(TString & path, TFilename & cmdline, int d, int dischi, const char * modulo);
 | 
			
		||||
  bool install_patches(const TString& module, const TString& lastrelease, int lastpatch , bool onlynew = true);
 | 
			
		||||
  KEY askdisk(TString& path, TFilename& cmdline, int d, int dischi, const char* modulo);
 | 
			
		||||
 | 
			
		||||
  bool do_process(TToken_string& commands) const;
 | 
			
		||||
  bool pre_process(TInstall_ini& ini, const char* module) const;
 | 
			
		||||
@ -869,13 +870,81 @@ KEY TInstaller_mask::askdisk(TString & path, TFilename & cmdline, int d, int dis
 | 
			
		||||
  return k;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//rimozione da disco dei files da eliminare indicati nei paragrafi kill..
 | 
			
		||||
//..e successivo aggiornamento dell'install.ini in modo da non avere più tra i piedi i files killati
 | 
			
		||||
void TInstaller_mask::kill_files()
 | 
			
		||||
{
 | 
			
		||||
  //apre l'install.ini locale per effettuare l'aggiornamento
 | 
			
		||||
  TInstall_ini ini;
 | 
			
		||||
  //giro su tutti i sottomoduli di tipo 99 con l'elenco dei files da uccidere
 | 
			
		||||
  TString_array paragraph_names;
 | 
			
		||||
  ini.list_paragraphs(paragraph_names);
 | 
			
		||||
 | 
			
		||||
  FOR_EACH_ARRAY_ROW(paragraph_names, nriga, riga)
 | 
			
		||||
  {
 | 
			
		||||
    //interessano solo i paragrafi con le killer list
 | 
			
		||||
    if (riga->ends_with("99") && ini.set_paragraph(*riga))
 | 
			
		||||
    { 
 | 
			
		||||
      TString_array killed;
 | 
			
		||||
 | 
			
		||||
      TToken_string rigaini;
 | 
			
		||||
      TFilename filetokill;
 | 
			
		||||
      for (int k = 0;; k++)
 | 
			
		||||
      {
 | 
			
		||||
        rigaini = ini.get("Kill", NULL, k, "");
 | 
			
		||||
        if (rigaini.empty())
 | 
			
		||||
          break;
 | 
			
		||||
        filetokill = rigaini.get(0);
 | 
			
		||||
        if (filetokill.find('*') >= 0 || filetokill.find('?') >= 0)
 | 
			
		||||
        {
 | 
			
		||||
          TString_array filelist;
 | 
			
		||||
          list_files (filetokill, filelist);
 | 
			
		||||
          FOR_EACH_ARRAY_ROW(filelist, r, file)
 | 
			
		||||
          {
 | 
			
		||||
            if (fexist(*file)) 
 | 
			
		||||
              ::remove_file(*file);
 | 
			
		||||
            killed.add(*file);
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
          if (fexist(filetokill)) 
 | 
			
		||||
            ::remove_file(filetokill);
 | 
			
		||||
          killed.add(filetokill);
 | 
			
		||||
        }
 | 
			
		||||
      } //for(int k=0...
 | 
			
		||||
 | 
			
		||||
      for (int s = 0; s <= 9 && !killed.empty(); s++)
 | 
			
		||||
      {
 | 
			
		||||
        const TString4 mod = riga->left(2);
 | 
			
		||||
        const int cicli = mod == "ba" ? 2 : 1;
 | 
			
		||||
        for (int c = 1; c <= cicli; c++)
 | 
			
		||||
        {
 | 
			
		||||
          TString4 module = c == 1 ? mod : "sy";
 | 
			
		||||
          module << s;
 | 
			
		||||
          TAssoc_array& vars = ini.list_variables(module);
 | 
			
		||||
          FOR_EACH_ASSOC_STRING(vars, hobj, key, str)
 | 
			
		||||
          {
 | 
			
		||||
            const int idx = killed.find(str);
 | 
			
		||||
            if (idx >= 0)
 | 
			
		||||
            {
 | 
			
		||||
              ini.remove(key);
 | 
			
		||||
              killed.destroy(idx, true);
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      } //for (int s...
 | 
			
		||||
    } //if (riga->ends_with...
 | 
			
		||||
  } //FOR_EACH_ARRAY_ROW(...
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool TInstaller_mask::install(const TString& module, int patchlevel)
 | 
			
		||||
{
 | 
			
		||||
  bool cancelled = false;
 | 
			
		||||
  bool ok = false;
 | 
			
		||||
  TString msg;              // stringa per i messaggi
 | 
			
		||||
  TString16 lastrelease;    // release che sto installando
 | 
			
		||||
  int lastpatch=patchlevel; // patchlevel che sto installando
 | 
			
		||||
  int lastpatch = patchlevel; // patchlevel che sto installando
 | 
			
		||||
 | 
			
		||||
  TFilename path ;
 | 
			
		||||
  TString http_server;
 | 
			
		||||
@ -886,64 +955,81 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
 | 
			
		||||
    parse_internet_path(http_server,http_path );
 | 
			
		||||
 | 
			
		||||
  const bool is_a_patch = (patchlevel > 0);
 | 
			
		||||
  TFilename ininame = path;
 | 
			
		||||
  ininame.add(module);
 | 
			
		||||
  //file .ini con le info di installazione (es. bainst.ini o ba0883.ini)
 | 
			
		||||
  TFilename remote_ininame = path;
 | 
			
		||||
  remote_ininame.add(module);
 | 
			
		||||
 | 
			
		||||
  //completa il nome del file .ini controllando se è una patch (es. ba0883a.ini) o se è un pacco (es. bainst.ini)
 | 
			
		||||
  if (is_a_patch)
 | 
			
		||||
  {
 | 
			
		||||
    TString16 name;
 | 
			
		||||
    name.format("%04da.ini", patchlevel);
 | 
			
		||||
    ininame << name;
 | 
			
		||||
    remote_ininame << name;
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
    ininame << "inst.ini";
 | 
			
		||||
    remote_ininame << "inst.ini";
 | 
			
		||||
 | 
			
		||||
  if (internet && !ininame.exist())
 | 
			
		||||
  if (internet && !remote_ininame.exist())
 | 
			
		||||
  {
 | 
			
		||||
    TFilename remote = ininame.name();
 | 
			
		||||
    TFilename remote = remote_ininame.name();
 | 
			
		||||
    remote.insert(http_path, 0);
 | 
			
		||||
    http_get(http_server, remote, ininame);
 | 
			
		||||
    http_get(http_server, remote, remote_ininame);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (ininame.exist())
 | 
			
		||||
  if (remote_ininame.exist())
 | 
			
		||||
  {
 | 
			
		||||
    // esiste un particolare .ini con formato XXinst.ini (moduli) o con XX9999a.ini (patch)
 | 
			
		||||
    // (installazione da directory con .zip)
 | 
			
		||||
    TInstall_ini* ini = new TInstall_ini(ininame);
 | 
			
		||||
    ini->write_protect();
 | 
			
		||||
    lastpatch=ini->get_int("Patch",module);
 | 
			
		||||
    lastrelease=ini->get("Versione",module);
 | 
			
		||||
    if (!can_install(module, *ini))
 | 
			
		||||
    //----------------------------------------------
 | 
			
		||||
    // (INSTALLAZIONE DA DIRECTORY CON FILES .ZIP)
 | 
			
		||||
    //----------------------------------------------
 | 
			
		||||
    //remote_ini è il file .ini con le info di installazione (es. ba0883a.ini, bainst.ini)
 | 
			
		||||
    TInstall_ini* remote_ini = new TInstall_ini(remote_ininame);
 | 
			
		||||
    remote_ini->write_protect();
 | 
			
		||||
    lastpatch = remote_ini->get_int("Patch", module);
 | 
			
		||||
    lastrelease = remote_ini->get("Versione", module);
 | 
			
		||||
 | 
			
		||||
    //se non può installare il modulo chiude il remote_ini
 | 
			
		||||
    if (!can_install(module, *remote_ini))
 | 
			
		||||
    {
 | 
			
		||||
      delete ini;
 | 
			
		||||
      delete remote_ini;
 | 
			
		||||
      return false;
 | 
			
		||||
    }
 | 
			
		||||
    const int dischi = ini->get_int("Dischi", module);
 | 
			
		||||
 | 
			
		||||
    //antico controllo del numero di dischetti (ora sempre = 1)
 | 
			
		||||
    const int dischi = remote_ini->get_int("Dischi", module);
 | 
			
		||||
    ok = dischi > 0;
 | 
			
		||||
    if (!ok)
 | 
			
		||||
      return error_box(FR("Impossibile determinare il numero dei dischetti in %s"),ininame.name());
 | 
			
		||||
      return error_box(FR("Impossibile determinare il numero dei dischetti in %s"), remote_ininame.name());
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
      if (patchlevel==0)
 | 
			
		||||
        ok = pre_process(*ini, module);
 | 
			
		||||
      if (patchlevel == 0)
 | 
			
		||||
        ok = pre_process(*remote_ini, module);
 | 
			
		||||
      if (!ok)
 | 
			
		||||
      {
 | 
			
		||||
        delete ini;
 | 
			
		||||
        delete remote_ini;
 | 
			
		||||
        return false;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    // ==============
 | 
			
		||||
    // decompressione
 | 
			
		||||
 | 
			
		||||
    // DECOMPRESSIONE
 | 
			
		||||
    // ----------------   
 | 
			
		||||
    // viene decompresso il file .zip collegato al file remote_ini (es. ba0883a1.zip, bainst.zip)
 | 
			
		||||
    msg = TR("Decompressione");
 | 
			
		||||
    if (is_a_patch)
 | 
			
		||||
      msg << TR(" della patch ") << patchlevel ;
 | 
			
		||||
    msg  << TR(" del modulo '") << module << TR("' in corso...");
 | 
			
		||||
    msg << TR(" del modulo '") << module << TR("' in corso...");
 | 
			
		||||
 | 
			
		||||
    TProgind pi(dischi, msg, false, true);
 | 
			
		||||
    TFilename tempdir; tempdir.tempdir();
 | 
			
		||||
 | 
			
		||||
    TFilename tempdir; 
 | 
			
		||||
    tempdir.tempdir();
 | 
			
		||||
    
 | 
			
		||||
		// File tottale dei vari sotto-zip
 | 
			
		||||
		TFilename totti = tempdir; totti.add(module); totti.ext("zip");
 | 
			
		||||
		TFilename totti = tempdir; 
 | 
			
		||||
    totti.add(module); 
 | 
			
		||||
    totti.ext("zip");
 | 
			
		||||
    
 | 
			
		||||
    //si costruisce il nome dello zip
 | 
			
		||||
    for (int d = 1; d <= dischi && ok; d++)
 | 
			
		||||
    {
 | 
			
		||||
      TFilename chunk = path;
 | 
			
		||||
@ -966,22 +1052,23 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
 | 
			
		||||
          error_box(FR("Errore di trasferimento del file '%s'"), (const char*)remote);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      //antichi controlli in caso di multidischetto
 | 
			
		||||
      ok = chunk.exist();
 | 
			
		||||
      if (!ok && !internet)  // Chiedi cambio disco (solo se non sta scaricando da internet)
 | 
			
		||||
      {
 | 
			
		||||
        while (!ok)
 | 
			
		||||
        {
 | 
			
		||||
          if (askdisk(path,chunk,d,dischi,(const char*)ini->get("Descrizione"))==K_QUIT)
 | 
			
		||||
          if (askdisk(path, chunk, d, dischi, (const char*)remote_ini->get("Descrizione")) == K_QUIT)
 | 
			
		||||
            break;
 | 
			
		||||
          ok = chunk.exist();
 | 
			
		||||
          if (!ok)
 | 
			
		||||
            message_box(FR("Impossibile trovare il file '%s'"),(const char*)chunk);
 | 
			
		||||
            message_box(FR("Impossibile trovare il file '%s'"), (const char*)chunk);
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (ok)
 | 
			
		||||
      {
 | 
			
		||||
        const long required = fsize(chunk) * (dischi-d+1) * 4;
 | 
			
		||||
        const long required = fsize(chunk) * (dischi - d + 1) * 4;
 | 
			
		||||
        if (!xvt_fsys_test_disk_free_space(tempdir, required))        
 | 
			
		||||
        {
 | 
			
		||||
          ok = yesno_box(TR("Lo spazio su disco potrebbe essere insufficiente:\nSi desidera continuare ugualmente?"));
 | 
			
		||||
@ -991,43 +1078,47 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
 | 
			
		||||
      if (ok)
 | 
			
		||||
        ::fcopy(chunk, totti, d > 1);  // Somma il chunk al totale
 | 
			
		||||
    }
 | 
			
		||||
  	aga_unzip(totti, tempdir); // Scompatta il file totale
 | 
			
		||||
		::remove(totti);
 | 
			
		||||
 | 
			
		||||
    // =============
 | 
			
		||||
    // trasferimento
 | 
			
		||||
    //scompattamento vero e proprio dello zip
 | 
			
		||||
  	aga_unzip(totti, tempdir); // Scompatta il file totale zip
 | 
			
		||||
		::remove(totti);           // Elimina il file totale zip
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // TRASFERIMENTO
 | 
			
		||||
    // -----------------
 | 
			
		||||
    if (ok)
 | 
			
		||||
    {
 | 
			
		||||
      // si assicura che sia leggibile il .ini del primo disco
 | 
			
		||||
      do 
 | 
			
		||||
			{
 | 
			
		||||
        TFilename cmdline = path;
 | 
			
		||||
        cmdline.add(ininame.name());
 | 
			
		||||
        cmdline.add(remote_ininame.name());
 | 
			
		||||
        ok = cmdline.exist();
 | 
			
		||||
        if (!ok)
 | 
			
		||||
        {
 | 
			
		||||
          if (askdisk(path,cmdline,1,dischi,(const char*)ini->get("Descrizione"))==K_QUIT)
 | 
			
		||||
          if (askdisk(path, cmdline, 1, dischi, (const char*)remote_ini->get("Descrizione")) == K_QUIT)
 | 
			
		||||
           break;
 | 
			
		||||
          ok = fexist(cmdline);
 | 
			
		||||
          if (!ok)
 | 
			
		||||
            message_box(FR("Impossibile trovare %s\n"),(const char*)cmdline);
 | 
			
		||||
            message_box(FR("Impossibile trovare %s\n"), (const char*)cmdline);
 | 
			
		||||
          else
 | 
			
		||||
          {
 | 
			
		||||
            delete ini;
 | 
			
		||||
            ini = new TInstall_ini (cmdline);
 | 
			
		||||
            delete remote_ini;
 | 
			
		||||
            remote_ini = new TInstall_ini (cmdline);
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      } while (!ok);
 | 
			
		||||
 | 
			
		||||
      if (ok)
 | 
			
		||||
      {
 | 
			
		||||
        msg.cut(0);
 | 
			
		||||
        msg << TR("Aggiornamento del modulo '") << module << TR("' in corso...");
 | 
			
		||||
        pi.set_text(msg);
 | 
			
		||||
        ok = move_module(module, *ini, true);
 | 
			
		||||
        ok = move_module(module, *remote_ini, true);
 | 
			
		||||
 | 
			
		||||
        if (ok)
 | 
			
		||||
        {
 | 
			
		||||
          TAuto_token_string altri(ini->get("Moduli", module));
 | 
			
		||||
          TAuto_token_string altri(remote_ini->get("Moduli", module));
 | 
			
		||||
          FOR_EACH_TOKEN(altri, mod)
 | 
			
		||||
          {
 | 
			
		||||
            const TString16 submod = mod;
 | 
			
		||||
@ -1036,70 +1127,42 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
 | 
			
		||||
              bool upd = ok;
 | 
			
		||||
              if (ok)
 | 
			
		||||
              {
 | 
			
		||||
                TInstall_ini curini;
 | 
			
		||||
                const TString16 curver = curini.version(submod);
 | 
			
		||||
                const int curpatch = curini.patch(submod);
 | 
			
		||||
                const TString16 reqver = ini->version(submod);
 | 
			
		||||
                const int reqpatch = ini->patch(submod);
 | 
			
		||||
                TInstall_ini local_cur_ini;
 | 
			
		||||
                const TString16 curver = local_cur_ini.version(submod);
 | 
			
		||||
                const int curpatch = local_cur_ini.patch(submod);
 | 
			
		||||
                const TString16 reqver = remote_ini->version(submod);
 | 
			
		||||
                const int reqpatch = remote_ini->patch(submod);
 | 
			
		||||
  
 | 
			
		||||
                int distance = compare_version(reqver, reqpatch, curver, curpatch);
 | 
			
		||||
                upd = distance > 0;
 | 
			
		||||
              }
 | 
			
		||||
              ok &= move_module(submod, *ini, upd);
 | 
			
		||||
              ok &= move_module(submod, *remote_ini, upd);
 | 
			
		||||
              if (upd && ok)  // marca sull'install.ini di destinazione l'avvenuta installazione del sottomodulo "esterno"
 | 
			
		||||
                ini->export_paragraph(submod, ini->default_name(), !is_a_patch);
 | 
			
		||||
                remote_ini->export_paragraph(submod, TInstall_ini::default_name(), !is_a_patch);
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        if (ok) //rimozione files da eliminare indicati nel .ini
 | 
			
		||||
        {
 | 
			
		||||
          TString killmod;
 | 
			
		||||
          killmod << module << 99;
 | 
			
		||||
          if (ini->set_paragraph(killmod))
 | 
			
		||||
          { 
 | 
			
		||||
            TToken_string rigaini;
 | 
			
		||||
            TFilename filetokill;
 | 
			
		||||
            for (int k=0; ;k++)
 | 
			
		||||
            {
 | 
			
		||||
              rigaini = ini->get("Kill", NULL, k, "");
 | 
			
		||||
              if (rigaini.empty())
 | 
			
		||||
                break;
 | 
			
		||||
              filetokill = rigaini.get(0);
 | 
			
		||||
              if (filetokill.find('*') >= 0 || filetokill.find('?') >=0)
 | 
			
		||||
              {
 | 
			
		||||
                TString_array filelist;
 | 
			
		||||
                list_files (filetokill, filelist);
 | 
			
		||||
                FOR_EACH_ARRAY_ROW(filelist, r, file)
 | 
			
		||||
                {
 | 
			
		||||
                  ::remove_file((const char *)file);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
              }
 | 
			
		||||
              else
 | 
			
		||||
                ::remove_file(filetokill);
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
      } //if(ok)..
 | 
			
		||||
    } //if(ok)..
 | 
			
		||||
    if (ok) // marca sull'install.ini di destinazione l'avvenuta installazione del modulo
 | 
			
		||||
      ini->export_module_paragraphs(module, ini->default_name(),!is_a_patch);
 | 
			
		||||
      remote_ini->export_module_paragraphs(module, TInstall_ini::default_name(), !is_a_patch);
 | 
			
		||||
  } // installazione da directory con zip
 | 
			
		||||
  else
 | 
			
		||||
    if (!is_a_patch)
 | 
			
		||||
    {
 | 
			
		||||
      //
 | 
			
		||||
      // non c'e' il .ini del modulo ma un unico "install.ini"
 | 
			
		||||
      // (installazione da directory con eseguibili)
 | 
			
		||||
      ininame = path;
 | 
			
		||||
      ininame.add(TInstall_ini::default_name());
 | 
			
		||||
      ok = fexist(ininame);
 | 
			
		||||
      // non c'e' il .ini del modulo ma un unico "install.ini" (es. aggiornamento client)
 | 
			
		||||
      //------------------------------------------------
 | 
			
		||||
      // (INSTALLAZIONE DA DIRECTORY CON ESEGUIBILI)
 | 
			
		||||
      //------------------------------------------------
 | 
			
		||||
      remote_ininame = path;
 | 
			
		||||
      remote_ininame.add(TInstall_ini::default_name());
 | 
			
		||||
      ok = fexist(remote_ininame);
 | 
			
		||||
      if (ok)
 | 
			
		||||
      {
 | 
			
		||||
        TInstall_ini ini(ininame);
 | 
			
		||||
        TInstall_ini ini(remote_ininame);
 | 
			
		||||
        ini.write_protect();
 | 
			
		||||
        lastpatch=ini.get_int("Patch",module);
 | 
			
		||||
        lastrelease=ini.get("Versione",module);
 | 
			
		||||
        lastpatch = ini.get_int("Patch", module);
 | 
			
		||||
        lastrelease = ini.get("Versione", module);
 | 
			
		||||
        if (!can_install(module, ini))
 | 
			
		||||
          return false;
 | 
			
		||||
  
 | 
			
		||||
@ -1107,7 +1170,7 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
 | 
			
		||||
        const int files = ini.build_complete_list(module, list);
 | 
			
		||||
        if (files > 0)
 | 
			
		||||
        {
 | 
			
		||||
          if (patchlevel==0)
 | 
			
		||||
          if (patchlevel == 0)
 | 
			
		||||
            ok = pre_process(ini, module);
 | 
			
		||||
  
 | 
			
		||||
          if (ok)
 | 
			
		||||
@ -1123,7 +1186,7 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
 | 
			
		||||
              src = path;
 | 
			
		||||
              src.add(dst);
 | 
			
		||||
              const int reboot = needs_reboot(dst);
 | 
			
		||||
              if ((reboot & NEW_SYS)!=0 && dst.exist())
 | 
			
		||||
              if ((reboot & NEW_SYS) !=0 && dst.exist())
 | 
			
		||||
              {
 | 
			
		||||
                dst.rtrim(1);
 | 
			
		||||
                dst << '_';
 | 
			
		||||
@ -1132,6 +1195,7 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
 | 
			
		||||
                create_dirs(dst.path());
 | 
			
		||||
 | 
			
		||||
              ok = ::fcopy(src, dst);
 | 
			
		||||
 | 
			
		||||
              if (ok && is_zip_file(src))
 | 
			
		||||
                aga_unzip(src, dst.path());
 | 
			
		||||
              
 | 
			
		||||
@ -1144,7 +1208,7 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
 | 
			
		||||
          }
 | 
			
		||||
  
 | 
			
		||||
          if (ok)  // marca sull'install.ini di destinazione l'avvenuta installazione del modulo
 | 
			
		||||
            ini.export_module_paragraphs(module, ini.default_name(),true);
 | 
			
		||||
            ini.export_module_paragraphs(module, ini.default_name(), true);
 | 
			
		||||
        } // controllo  esistenza lista di file non vuota per questo modulo
 | 
			
		||||
      } // controllo esistenza install.ini
 | 
			
		||||
    } // fine installazione da directory con eseguibili
 | 
			
		||||
@ -1152,10 +1216,9 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
 | 
			
		||||
  if (ok)
 | 
			
		||||
  {
 | 
			
		||||
    {
 | 
			
		||||
      update_install_ini(); //aggiorna diskpath e webpath
 | 
			
		||||
      TInstall_ini ini;
 | 
			
		||||
      ini.set("Data", TDate(TODAY), module);
 | 
			
		||||
      ini.update_prices(ininame);
 | 
			
		||||
      ini.update_prices(remote_ininame);
 | 
			
		||||
    }
 | 
			
		||||
    // Non togliere le parentesi graffe soprastanti per permettere l'aggiornamento fisico del .ini (CON LA CHIAMATA DEL DISTRUTTORE)
 | 
			
		||||
    update_version();
 | 
			
		||||
@ -1298,10 +1361,11 @@ bool TInstaller_mask::web_handler(TMask_field& fld, KEY key)
 | 
			
		||||
  return ok;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Aggiorna l'install.ini con eventuali modifiche dell'utente. 
 | 
			
		||||
 | 
			
		||||
// Aggiorna l'install.ini con eventuali modifiche dell'utente su dispath e/o webpath 
 | 
			
		||||
// Decisivo in caso di cambio path d'installazione
 | 
			
		||||
// Serve a setup
 | 
			
		||||
void TInstaller_mask::update_install_ini() const
 | 
			
		||||
// Serve a setup (deve essere chiamata in caso di esecuzioni passive di setup, tipo -uw, -uw)
 | 
			
		||||
void TInstaller_mask::update_disk_and_web_path()
 | 
			
		||||
{
 | 
			
		||||
  TInstall_ini ini;
 | 
			
		||||
  ini.set("DiskPath", get(F_PATH));
 | 
			
		||||
@ -1424,7 +1488,7 @@ void TInstaller_mask::install_selection()
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          update_install_ini(); //aggiorna l'install.ini
 | 
			
		||||
          update_disk_and_web_path(); //aggiorna l'install.ini
 | 
			
		||||
          //lancia setup in modalita' aggiornamento da disco
 | 
			
		||||
          _setup_run = xvt_sys_execute("setup\\setup.exe -ud", false, false) !=0;
 | 
			
		||||
        }
 | 
			
		||||
@ -1468,7 +1532,7 @@ void TInstaller_mask::install_selection()
 | 
			
		||||
                file_copied = http_get(http_server, remote_file, local_file); //occhio alle maiuscole!!!!
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
          update_install_ini(); //aggiorna l'install.ini
 | 
			
		||||
          update_disk_and_web_path(); //aggiorna l'install.ini
 | 
			
		||||
          //lancia setup in modalita' aggiornamento web 
 | 
			
		||||
          _setup_run = xvt_sys_execute("setup\\setup.exe -uw", false, false) != 0;
 | 
			
		||||
        }
 | 
			
		||||
@ -1502,7 +1566,12 @@ void TInstaller_mask::install_selection()
 | 
			
		||||
      uncheck(r); // se non ci sono patch o moduli -> uncheck
 | 
			
		||||
  } //FOR_EACH_ARRAY_ROW(arr...
 | 
			
		||||
  
 | 
			
		||||
  force_update(); //serve per togliere il check al modulo 'sy' quando viene installato
 | 
			
		||||
  //aggiorna definitivamente i path su install.ini
 | 
			
		||||
  update_disk_and_web_path();
 | 
			
		||||
  //accoppa i files nelle kill lists e aggiorna install.ini
 | 
			
		||||
  kill_files();
 | 
			
		||||
  //serve per togliere il check al modulo 'sy' quando viene installato
 | 
			
		||||
  force_update();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool TInstaller_mask::install_handler(TMask_field& fld, KEY key)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user