Ignore:
Timestamp:
Apr 1, 2010, 9:04:16 PM (14 years ago)
Author:
grum
Message:

Update the plugin for compatibility with Piwigo 2.1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/AStat/maintain.inc.php

    r5425 r5546  
    1717if(!defined('ASTAT_PATH')) define('ASTAT_PATH' , PHPWG_PLUGINS_PATH . ASTAT_DIR . '/');
    1818
     19include_once('astat_version.inc.php');
     20
    1921//ini_set('error_reporting', E_ALL);
    2022//ini_set('display_errors', true);
    2123
    22 global $gpc_installed, $lang; //needed for plugin manager compatibility
     24global $gpc_installed, $gpcNeeded, $lang; //needed for plugin manager compatibility
    2325
    2426/* -----------------------------------------------------------------------------
     
    2628----------------------------------------------------------------------------- */
    2729$gpc_installed=false;
    28 if(file_exists(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/common_plugin.class.inc.php'))
     30$gpcNeeded="3.0.0";
     31if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'))
    2932{
    30   @include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/main.inc.php');
    31   // need GPC release greater or equal than 2.0.5
    32   if(checkGPCRelease(2,0,5))
     33  @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php');
     34  // need GPC release greater or equal than 3.0.0
     35  if(CommonPlugin::checkGPCRelease(3,0,0))
    3336  {
    3437    @include_once("astat_aim.class.inc.php");
     
    3942function gpcMsgError(&$errors)
    4043{
    41   array_push($errors, sprintf(l10n('AStat_gpc2_not_installed'), "2.0.5"));
     44  global $gpcNeeded;
     45  $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), $gpcNeeded);
     46  if(is_array($errors))
     47  {
     48    array_push($errors, $msg);
     49  }
     50  else
     51  {
     52    $errors=Array($msg);
     53  }
    4254}
    4355// -----------------------------------------------------------------------------
     
    4860function plugin_install($plugin_id, $plugin_version, &$errors)
    4961{
    50   global $prefixeTable, $gpc_installed;
     62  global $prefixeTable, $gpc_installed, $gpcNeeded;
    5163  if($gpc_installed)
    5264  {
    5365    $obj = new AStat_AIM($prefixeTable, __FILE__);
    54     $obj->delete_config();
    55     $obj->init_config();
    56     $obj->save_config();
     66    $obj->deleteConfig();
     67    $obj->initConfig();
     68    $obj->my_config['installed']=ASTAT_VERSION2;
     69    $obj->saveConfig();
     70    GPCCore::register($obj->getPluginName(), ASTAT_VERSION, $gpcNeeded);
    5771  }
    5872  else
     
    6882  {
    6983    $obj = new AStat_AIM($prefixeTable, __FILE__);
    70     $obj->init_config();
    71     $obj->load_config();
    72     $obj->save_config();
     84    $obj->initConfig();
     85    $obj->loadConfig();
     86    $obj->my_config['installed']=ASTAT_VERSION2;
     87    $obj->saveConfig();
    7388    $obj->alter_history_section_enum('deleted_cat');
    7489  }
     
    89104  {
    90105    $obj = new AStat_AIM($prefixeTable, __FILE__);
    91     $obj->delete_config();
     106    $obj->deleteConfig();
     107    GPCCore::unregister($obj->getPluginName());
    92108  }
    93109  else
Note: See TracChangeset for help on using the changeset viewer.