Ignore:
Timestamp:
Sep 20, 2010, 12:43:52 AM (14 years ago)
Author:
grum
Message:

Migration from version 1.0.1 to 1.0.2 implemented

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/ColorStat/admin/plugin_admin.php

    r5961 r6976  
    1414if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
    1515
    16 global $prefixeTable;
     16global $prefixeTable, $template;
    1717load_language('plugin.lang', CSTAT_PATH);
    1818
    1919$main_plugin_object = get_plugin_data($plugin_id);
    2020
    21 /*
    22  * if the plugin is newly installed, display a special configuration page
    23  * otherwise, display normal page
    24  */
    2521
    26 $config=Array();
    27 GPCCore::loadConfig('cstat', $config);
     22if(CommonPlugin::checkGPCRelease(3,2,0))
     23{
     24  $config=Array();
     25  GPCCore::loadConfig('cstat', $config);
    2826
    29 if($config['newInstall']=='n')
    30 {
    31   include(CSTAT_PATH."cstat_aip.class.inc.php");
    32   $plugin_aip = new CStat_AIP($prefixeTable, $main_plugin_object->getFileLocation());
     27  if(!isset($config['installed'])) $config['installed']='01.00.01';
     28  if($config['installed']!=CSTAT_VERSION2)
     29  {
     30    /* the plugin was updated without being deactivated
     31     * deactivate + activate the plugin to process the database upgrade
     32     */
     33    include(CSTAT_PATH."cstat_install.class.inc.php");
     34    $cstat=new CStat_Install($prefixeTable, dirname(__FILE__));
     35    $cstat->deactivate();
     36    $cstat->activate();
     37    $template->delete_compiled_templates();
     38    $config['newInstall']='n';
     39  }
     40
     41  /*
     42   * if the plugin is newly installed, display a special configuration page
     43   * otherwise, display normal page
     44   */
     45  if($config['newInstall']=='n')
     46  {
     47    include(CSTAT_PATH."cstat_aip.class.inc.php");
     48    $plugin_ai = new CStat_AIP($prefixeTable, $main_plugin_object->getFileLocation());
     49  }
     50  else
     51  {
     52    include(CSTAT_PATH."cstat_aip_install.class.inc.php");
     53    $plugin_ai = new CStat_AIPInstall($prefixeTable, $main_plugin_object->getFileLocation());
     54  }
    3355}
    3456else
    3557{
    36   include(CSTAT_PATH."cstat_aip_install.class.inc.php");
    37   $plugin_aip = new CStat_AIPInstall($prefixeTable, $main_plugin_object->getFileLocation());
     58  /*
     59   * plugin was upgraded, but GPC was not
     60   * display a page to inform user to upgrade GPC
     61   */
     62  include(CSTAT_PATH."cstat_aip_release.class.inc.php");
     63  $plugin_ai = new CStat_AIPRelease($prefixeTable, $main_plugin_object->getFileLocation());
    3864}
    3965
    40 $plugin_aip->manage();
     66$plugin_ai->manage();
     67
     68
     69
    4170?>
Note: See TracChangeset for help on using the changeset viewer.