Ignore:
Timestamp:
Sep 13, 2010, 10:05:20 PM (14 years ago)
Author:
grum
Message:

Version 3.2.0
Add process for update from GPC 3.1.0

Location:
extensions/GrumPluginClasses
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/GrumPluginClasses/classes/GPCRequestBuilder.class.inc.php

    r6894 r6901  
    33  class name: GCPRequestBuilder
    44  class version  : 1.1.0
    5   plugin version : 3.1.0
     5  plugin version : 3.2.0
    66  date           : 2010-09-08
    77
     
    9090 *  - getWhere
    9191 *  - getJoin
    92  *  - getImageId (used for multirecord requests only)
     92 *  - getImageId
    9393 *
    9494 * Retrieving the results
     
    102102 *               is builded, but it is used only when retrieving the results for
    103103 *               multirecord tables)
     104 *  - formatData
    104105 *
    105106 *
    106  * Example 1 : single record request
    107  * ---------------------------------
    108  * Consider the table "tableA" like this
    109  *
    110  *  - (*) imageId
    111  *  -     att1
    112  *  -     att2
    113  *  The primary key is the 'imageId' attribute
    114  *    => for one imageId, you can only have ZERO or ONE record
    115  *
    116  *  getSelect returns : "tableA.att1, tableA.att2"
    117  *  getFrom returns   : "tableA"
    118  *  getWhere returns  : "tableA.att1 = zzzz"
    119  *  getJoin returns   : "tableA.imageId = pit.id"
    120  *  getFilter returns : ""
    121  *
    122  *
    123  * Example 2 : multi records request
    124  * ---------------------------------
     107 * Example
     108 * -------
    125109 * Consider the table "tableA" like this
    126110 *
     
    137121 *  getSelect returns  : "tableA.att1, tableA.att2"
    138122 *  getFrom returns    : "tableA"
    139  *  getWhere returns   : "tableA.att1 = zzzz AND tableA.att1 = xxxx"
    140  *  getJoin returns    : "tableA.id = pit.id"
    141  *  getFilter returns  : ""
     123 *  getWhere returns   : "tableA.localId= xxxx AND tableA.att1 = zzzz"
     124 *  getJoin returns    : "tableA.imageId = pit.id"
     125 *  getFilter returns  : "tableA.localId= xxxx"
    142126 *
    143127 */
     
    402386    $tablef= new GPCTables(self::$tables);
    403387    $tablef->create($tablesDef);
     388
     389    return(true);
     390  }
     391
     392  /**
     393   * update the tables needed by RequestBuilder (used during the gpc process
     394   * activation)
     395   */
     396  static public function updateTables($pluginPreviousRelease)
     397  {
     398    $tablesCreate=array();
     399    $tablesUpdate=array();
     400
     401    switch($pluginPreviousRelease)
     402    {
     403      case '03.01.00':
     404        $tablesCreate[]=
     405"CREATE TABLE `".self::$tables['temp']."` (
     406  `requestId` char(30) NOT NULL,
     407  `imageId` mediumint(8) unsigned NOT NULL,
     408  PRIMARY KEY  (`request`,`id`)
     409)
     410CHARACTER SET utf8 COLLATE utf8_general_ci";
     411
     412        $tablesUpdate[self::$tables['request']]['filter']=
     413"ADD COLUMN  `filter` text NOT NULL default '' ";
     414        break;
     415    }
     416
     417    $tablef=new GPCTables(self::$tables);
     418
     419    if(count($tablesCreate)>0) $tablef->create($tablesCreate);
     420    if(count($tablesUpdate)>0) $tablef->updateTablesFields($tablesUpdate);
    404421
    405422    return(true);
  • extensions/GrumPluginClasses/gpc_install.class.inc.php

    r6235 r6901  
    4646    public function install()
    4747    {
     48      $this->initConfig();
     49      $this->loadConfig();
     50      $this->config['installed']=GPC_VERSION2;
     51      $this->saveConfig();
     52
    4853      $result=GPCRequestBuilder::createTables();
    4954      return($result);
     
    7075    public function activate()
    7176    {
     77      global $template, $user;
     78
     79      $this->initConfig();
     80      $this->loadConfig();
     81
     82      /*
     83       * if there is no version information available, assume the previous
     84       *  installed release of the plugin is 3.1.0
     85       */
     86      if(!isset($this->config['installed'])) $this->config['installed']='03.01.00';
     87
     88      /*
     89      switch($this->config['installed'])
     90      {
     91        case '03.01.00':
     92          GPCRequestBuilder::updateTables($this->config['installed']);
     93          break;
     94      }
     95      */
     96      GPCRequestBuilder::updateTables($this->config['installed']);
     97
     98
     99      $this->config['installed']=GPC_VERSION2; //update the installed release number
     100      $this->saveConfig();
    72101    }
    73102
Note: See TracChangeset for help on using the changeset viewer.