Ignore:
Timestamp:
Apr 10, 2011, 10:07:47 PM (13 years ago)
Author:
grum
Message:

bug:2146
Compatibility with Piwigo 2.2

File:
1 edited

Legend:

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

    r5546 r10264  
    1717if(!defined('ASTAT_PATH')) define('ASTAT_PATH' , PHPWG_PLUGINS_PATH . ASTAT_DIR . '/');
    1818
    19 include_once('astat_version.inc.php');
     19include_once('astat_version.inc.php'); // => Don't forget to update this file !!
    2020
    21 //ini_set('error_reporting', E_ALL);
    22 //ini_set('display_errors', true);
    2321
    24 global $gpc_installed, $gpcNeeded, $lang; //needed for plugin manager compatibility
     22global $gpcInstalled, $lang; //needed for plugin manager compatibility
    2523
    2624/* -----------------------------------------------------------------------------
    27 AStat-2 needs the Grum Plugin Classe
     25AStat needs the Grum Plugin Classe
    2826----------------------------------------------------------------------------- */
    29 $gpc_installed=false;
    30 $gpcNeeded="3.0.0";
     27$gpcInstalled=false;
    3128if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'))
    3229{
    3330  @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))
     31  // need GPC release greater or equal than 3.5.0
     32  if(CommonPlugin::checkGPCRelease(ASTAT_GPC_NEEDED))
    3633  {
    37     @include_once("astat_aim.class.inc.php");
    38     $gpc_installed=true;
     34    include_once("astat_install.class.inc.php");
     35    $gpcInstalled=true;
    3936  }
    4037}
     
    4239function gpcMsgError(&$errors)
    4340{
    44   global $gpcNeeded;
    45   $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), $gpcNeeded);
     41  $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), ASTAT_GPC_NEEDED);
    4642  if(is_array($errors))
    4743  {
     
    5652
    5753
     54
    5855load_language('plugin.lang', ASTAT_PATH);
     56
     57
     58
    5959
    6060function plugin_install($plugin_id, $plugin_version, &$errors)
    6161{
    62   global $prefixeTable, $gpc_installed, $gpcNeeded;
    63   if($gpc_installed)
     62  global $prefixeTable, $gpcInstalled;
     63  if($gpcInstalled)
    6464  {
    65     $obj = new AStat_AIM($prefixeTable, __FILE__);
    66     $obj->deleteConfig();
    67     $obj->initConfig();
    68     $obj->my_config['installed']=ASTAT_VERSION2;
    69     $obj->saveConfig();
    70     GPCCore::register($obj->getPluginName(), ASTAT_VERSION, $gpcNeeded);
     65    $obj=new AStat_install($prefixeTable, __FILE__);
     66    $result=$obj->install();
    7167  }
    7268  else
     
    7874function plugin_activate($plugin_id, $plugin_version, &$errors)
    7975{
    80   global $prefixeTable, $gpc_installed;
    81   if($gpc_installed)
     76  global $prefixeTable, $gpcInstalled;
     77  if($gpcInstalled)
    8278  {
    83     $obj = new AStat_AIM($prefixeTable, __FILE__);
    84     $obj->initConfig();
    85     $obj->loadConfig();
    86     $obj->my_config['installed']=ASTAT_VERSION2;
    87     $obj->saveConfig();
    88     $obj->alter_history_section_enum('deleted_cat');
    89   }
    90   else
    91   {
    92     gpcMsgError($errors);
     79    $obj=new AStat_install($prefixeTable, __FILE__);
     80    $result=$obj->activate();
    9381  }
    9482}
     
    9684function plugin_deactivate($plugin_id)
    9785{
     86  global $prefixeTable, $gpcInstalled;
     87
     88  if($gpcInstalled)
     89  {
     90    $obj=new AStat_install($prefixeTable, __FILE__);
     91    $obj->deactivate();
     92  }
    9893}
    9994
    10095function plugin_uninstall($plugin_id)
    10196{
    102   global $prefixeTable, $gpc_installed;
    103   if($gpc_installed)
     97  global $prefixeTable, $gpcInstalled;
     98  if($gpcInstalled)
    10499  {
    105     $obj = new AStat_AIM($prefixeTable, __FILE__);
    106     $obj->deleteConfig();
    107     GPCCore::unregister($obj->getPluginName());
     100    $obj=new AStat_install($prefixeTable, __FILE__);
     101    $result=$obj->uninstall();
    108102  }
    109103  else
     
    115109
    116110
     111
     112
    117113?>
Note: See TracChangeset for help on using the changeset viewer.