• Mercatino: Parte 11

    Ogni campo aggiuntivo deve essere inserito nel database e successivamente abilitato alla lettura e scrittura.

    Nella versione 1.0.4 inseriamo quindi il seguente codice a livello installazione:
    Codice PHP: [Visualizza]
    $SQL = array();

    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread ADD vtp_description VARCHAR(255) NOT NULL DEFAULT ''";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread ADD vtp_lastbidder INT UNSIGNED NOT NULL DEFAULT '0'";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread ADD vtp_biddername VARCHAR(255) NOT NULL DEFAULT ''";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread ADD vtp_startvalue DOUBLE NOT NULL DEFAULT '0'";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread ADD vtp_lastbidvalue DOUBLE NOT NULL DEFAULT '0'";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread ADD vtp_endvalue DOUBLE NOT NULL DEFAULT '0'";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread ADD vtp_xshipping1 INT UNSIGNED NOT NULL DEFAULT '0'";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread ADD vtp_xshipping2 INT UNSIGNED NOT NULL DEFAULT '0'";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread ADD vtp_xshipping3 INT UNSIGNED NOT NULL DEFAULT '0'";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread ADD vtp_price1 DOUBLE NOT NULL DEFAULT '0'";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread ADD vtp_price2 DOUBLE NOT NULL DEFAULT '0'";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread ADD vtp_price3 DOUBLE NOT NULL DEFAULT '0'";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread ADD vtp_xpayment1 INT UNSIGNED NOT NULL DEFAULT '0'";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread ADD vtp_xpayment2 INT UNSIGNED NOT NULL DEFAULT '0'";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread ADD vtp_xpayment3 INT UNSIGNED NOT NULL DEFAULT '0'";

    run_sqls($SQL); 
    disinstallazione:
    Codice PHP: [Visualizza]
    $SQL = array();

    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread DROP vtp_description";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread DROP vtp_lastbidder";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread DROP vtp_biddername";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread DROP vtp_startvalue";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread DROP vtp_lastbidvalue";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread DROP vtp_endvalue";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread DROP vtp_xshipping1";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread DROP vtp_xshipping2";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread DROP vtp_xshipping3";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread DROP vtp_price1";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread DROP vtp_price2";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread DROP vtp_price3";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread DROP vtp_xpayment1";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread DROP vtp_xpayment2";
    $SQL[] = "ALTER TABLE " TABLE_PREFIX "thread DROP vtp_xpayment3";

    run_sqls($SQL); 
    Si impostano tutti i campi separatamente, in quanto un singolo errore non interrompe tutta la procedura. E' essenziale avere un riguardo agli errori di questo genere, perché non curandosi, il prodotto potrebbe non disinstallarsi completamente e creare così una marea di problemi.

    Plugin threaddata_start:
    Codice PHP: [Visualizza]
    $this->validfields['vtp_description'] = array(TYPE_STRREQ_NO);
    $this->validfields['vtp_lastbidder'] = array(TYPE_INTREQ_NO);
    $this->validfields['vtp_biddername'] = array(TYPE_STRREQ_NO);
    $this->validfields['vtp_startvalue'] = array(TYPE_NUMREQ_NO);
    $this->validfields['vtp_lastbidvalue'] = array(TYPE_NUMREQ_NO);
    $this->validfields['vtp_endvalue'] = array(TYPE_NUMREQ_NO);
    $this->validfields['vtp_xshipping1'] = array(TYPE_INTREQ_NO);
    $this->validfields['vtp_xshipping2'] = array(TYPE_INTREQ_NO);
    $this->validfields['vtp_xshipping3'] = array(TYPE_INTREQ_NO);
    $this->validfields['vtp_price1'] = array(TYPE_NUMREQ_NO);
    $this->validfields['vtp_price2'] = array(TYPE_NUMREQ_NO);
    $this->validfields['vtp_price3'] = array(TYPE_NUMREQ_NO);
    $this->validfields['vtp_xpayment1'] = array(TYPE_INTREQ_NO);
    $this->validfields['vtp_xpayment2'] = array(TYPE_INTREQ_NO);
    $this->validfields['vtp_xpayment3'] = array(TYPE_INTREQ_NO); 
    Nota: Lasciare il plugin disabilitato fin quando non abbiamo inserito anche i nuovi campi nella tabella thread.
    Commenti 4 Commenti
    1. L'avatar di Ricsca
      Ricsca -
      Sempre più interessante...
    1. L'avatar di franuliv
      franuliv -
      Un grazie particolare a chi si sta adoperando alla realizzazione di questo Mercatino!!

      Chiedo gentilmente se potete darmi un tempo per il termine di questo splendito Mercatino che state creando e che ritengo una vera svolta per il vbullettin..

      Mi potete dire quando che lo volevo installare sulla mia board?

      Grazie... Francesco
    1. L'avatar di y2ksw
      y2ksw -
      Dato che sono estremamente impegnato su tutti i fronti immaginabili, questo progetto dovrà purtroppo attendere. Il termine era previsto due mesi fa. Non sono in grado di dire quando cesserà il carico di compiti da svolgere, per poter terminarlo, anche perché manca davvero poco per iniziare a usarlo.

      La fortuna vuole che gran parte del codice esiste già, per cui tocca soltanto la revisione e adattamento da vBulletin 3.5 alla versione 4.
    1. L'avatar di franuliv
      franuliv -
      Ti ringrazio infinitamente della risposta. Spero di vero cuore che ti terminino l'ardui compiti e che tu possa completare questo spendido lavoro importante.
      Grazie Francesco