Changeset 6975


Ignore:
Timestamp:
09/20/10 00:42:58 (9 years ago)
Author:
grum
Message:

Migration from version 3.1.0 to 3.2.0 implemented

Location:
extensions/GrumPluginClasses
Files:
5 edited

Legend:

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

    r6733 r6975  
    33  class name: CommonPlugin 
    44  class version  : 2.2.0 
    5   plugin version : 3.0.0 
     5  plugin version : 3.2.0 
    66  date           : 2010-07-28 
    77 
     
    4747|         |            | * Update class & function names 
    4848|         |            | 
    49 | 2.2.0   | 2010/07/28 | * Add the loadConfigFromFile function 
    50 |         |            | 
     49| 2.2.0   | 2010/09/18 | * Add the loadConfigFromFile function 
     50|         |            | * Change parameters mode for the checkGPCRelease 
     51|         |            |   function 
    5152|         |            | 
    5253|         |            | 
     
    7475 
    7576  /** 
    76    * this function return true if class release if greater or equal than needed by the plugin 
     77   * this function return true if class release if greater or equal than needed 
     78   * by the plugin 
     79   * 
     80   * the function can be called : 
     81   *   - with 1 String parameter   : checkGPCRelease("3.2.0") 
     82   *                                 => implemented with the release 3.2.0, this 
     83   *                                    is the new method recommanded to use 
     84   *   - with 3 Integer parameters : checkGPCRelease(3,2,0) 
     85   *                                 => this method is kept for older plugin 
     86   *                                    compatibility but it's not recommanded 
     87   *                                    to use it anymore 
     88   * 
     89   * @param String $neededRelease : the needed release 
     90   * @return Boolean : true if the current release is greater or equal than the 
     91   *                   needed release 
     92   * 
     93   * old calling method : 
     94   * @param Integer $neededRelease : the major release 
     95   * @param Integer $minor : 
     96   * @param Integer $minor2 : 
     97   * @return Boolean; 
    7798   */ 
    78   static public function checkGPCRelease($major, $minor, $minor2) 
    79   { 
    80     $release = explode(".", GPC_VERSION); 
    81  
    82     if(($release[0]>$major) || 
    83        ($release[0]==$major)&&($release[1]>$minor) || 
    84        ($release[0]==$major)&&($release[1]==$minor)&&($release[2]>=$minor2)) 
     99  static public function checkGPCRelease($neededRelease=0, $minor=0, $minor2=0) 
     100  { 
     101    $currentRelease = explode(".", GPC_VERSION); 
     102 
     103    if(is_string($neededRelease)) 
     104    { 
     105      $neededRelease=explode('.', $neededRelease); 
     106      $major=$neededRelease[0]; 
     107      $minor=$neededRelease[1]; 
     108      $minor2=$neededRelease[2]; 
     109    } 
     110    else 
     111    { 
     112      $major=$neededRelease; 
     113    } 
     114 
     115    if(($currentRelease[0]>$major) || 
     116       ($currentRelease[0]==$major)&&($currentRelease[1]>$minor) || 
     117       ($currentRelease[0]==$major)&&($currentRelease[1]==$minor)&&($currentRelease[2]>=$minor2)) 
    85118    { 
    86119      return(true); 
  • extensions/GrumPluginClasses/classes/GPCRequestBuilder.class.inc.php

    r6901 r6975  
    275275   * @return Boolean : true if registering is Ok, otherwise false 
    276276   */ 
    277   static public function register($pluginName, $fileName) 
     277  static public function register($plugin, $fileName) 
    278278  { 
    279279    $config=Array(); 
    280280    if(GPCCore::loadConfig(self::$pluginName, $config)) 
    281281    { 
    282       $config['registered'][$pluginName]=Array( 
    283         'name' => $pluginName, 
     282      $config['registered'][$plugin]=Array( 
     283        'name' => $plugin, 
    284284        'fileName' => $fileName, 
    285285        'date' => date("Y-m-d H:i:s"), 
     
    379379  `requestId` char(30) NOT NULL, 
    380380  `imageId` mediumint(8) unsigned NOT NULL, 
    381   PRIMARY KEY  (`request`,`id`) 
     381  PRIMARY KEY  (`requestId`,`imageId`) 
    382382) 
    383383CHARACTER SET utf8 COLLATE utf8_general_ci", 
     
    406406  `requestId` char(30) NOT NULL, 
    407407  `imageId` mediumint(8) unsigned NOT NULL, 
    408   PRIMARY KEY  (`request`,`id`) 
     408  PRIMARY KEY  (`requestId`,`imageId`) 
    409409) 
    410410CHARACTER SET utf8 COLLATE utf8_general_ci"; 
     
    415415    } 
    416416 
    417     $tablef=new GPCTables(self::$tables); 
     417    $tablef=new GPCTables(array(self::$tables['temp'])); 
    418418 
    419419    if(count($tablesCreate)>0) $tablef->create($tablesCreate); 
  • extensions/GrumPluginClasses/gpc_install.class.inc.php

    r6901 r6975  
    6464      if(count($registeredPlugin)>0) 
    6565      { 
    66         return("Some plugins are dependent on Grum Plugin Classes: before uninstall, you must first uninstall the plugins dependent"); 
     66        return(l10n("Some plugins are dependent on Grum Plugin Classes: before uninstall, you must first uninstall the plugins dependent")); 
    6767      } 
    6868      else 
    6969      { 
     70        $this->deleteConfig(); 
    7071        $result=GPCRequestBuilder::deleteTables(); 
    7172        return($result); 
     
    99100      $this->config['installed']=GPC_VERSION2; //update the installed release number 
    100101      $this->saveConfig(); 
     102 
     103      return(true); 
    101104    } 
    102105 
  • extensions/GrumPluginClasses/main.inc.php

    r6948 r6975  
    104104 
    105105include_once('gpc_version.inc.php'); // => Don't forget to update this file !! 
     106include_once(GPC_PATH.'classes/GPCCore.class.inc.php'); 
    106107 
    107108global $prefixeTable; 
     109 
     110 
     111 
     112$config=Array(); 
     113GPCCore::loadConfig('gpc', $config); 
     114 
     115if(!isset($config['installed'])) $config['installed']='03.01.00'; 
     116if($config['installed']!=GPC_VERSION2) 
     117{ 
     118  /* the plugin was updated without being deactivated 
     119   * deactivate + activate the plugin to process the database upgrade 
     120   */ 
     121  include(GPC_PATH."gpc_install.class.inc.php"); 
     122  $gpc=new GPC_Install($prefixeTable, __FILE__); 
     123  $gpc->deactivate(); 
     124  $gpc->activate(); 
     125} 
     126 
    108127 
    109128if(defined('IN_ADMIN')) 
  • extensions/GrumPluginClasses/maintain.inc.php

    r6902 r6975  
    2626function plugin_activate($plugin_id, $plugin_version, &$errors) 
    2727{ 
     28  global $prefixeTable; 
     29 
    2830  $obj = new GPC_Install($prefixeTable, __FILE__); 
    2931  $result=$obj->activate(); 
     
    3739function plugin_deactivate($plugin_id) 
    3840{ 
     41  global $prefixeTable; 
     42 
     43  $obj = new GPC_Install($prefixeTable, __FILE__); 
     44  $result=$obj->deactivate(); 
    3945} 
    4046 
Note: See TracChangeset for help on using the changeset viewer.