source: extensions/ColorStat/maintain.inc.php @ 15907

Revision 10630, 3.0 KB checked in by grum, 9 years ago (diff)

bug:2147 ; Compatibility with Piwigo 2.2

  • Property svn:executable set to *
Line 
1<?php
2/* -----------------------------------------------------------------------------
3  Plugin     : ColorStat
4  Author     : Grum
5    email    : grum@piwigo.org
6    website  : http://photos.grum.fr
7
8    << May the Little SpaceFrog be with you ! >>
9  ------------------------------------------------------------------------------
10  See main.inc.php for release information
11
12  --------------------------------------------------------------------------- */
13
14if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
15
16if(!defined('CSTAT_DIR')) define('CSTAT_DIR' , basename(dirname(__FILE__)));
17if(!defined('CSTAT_PATH')) define('CSTAT_PATH' , PHPWG_PLUGINS_PATH . CSTAT_DIR . '/');
18
19//ini_set('error_reporting', E_ALL);
20//ini_set('display_errors', true);
21
22include_once('cstat_version.inc.php'); // => Don't forget to update this file !!
23
24global $gpcInstalled, $lang; //needed for plugin manager compatibility
25
26/*
27 * -----------------------------------------------------------------------------
28 * ColorStat needs the Grum Plugin Classes
29 * -----------------------------------------------------------------------------
30 */
31$gpcInstalled=false;
32if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'))
33{
34  include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php');
35  // need GPC release greater or equal than CSTAT_GPC_NEEDED
36  if(CommonPlugin::checkGPCRelease(CSTAT_GPC_NEEDED))
37  {
38    include_once('cstat_install.class.inc.php');
39    $gpcInstalled=true;
40  }
41}
42
43function gpcMsgError(&$errors)
44{
45  $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), CSTAT_GPC_NEEDED);
46  if(is_array($errors))
47  {
48    array_push($errors, $msg);
49  }
50  else
51  {
52    $errors=Array($msg);
53  }
54}
55// -----------------------------------------------------------------------------
56
57
58
59
60load_language('plugin.lang', CSTAT_PATH);
61
62
63function plugin_install($plugin_id, $plugin_version, &$errors)
64{
65  global $prefixeTable, $gpcInstalled;
66
67  if($gpcInstalled)
68  {
69    $cstat = new CStat_Install($prefixeTable, __FILE__);
70    if(!$cstat->install())
71    {
72      array_push($errors, "error");
73    }
74  }
75  else
76  {
77    gpcMsgError($errors);
78  }
79}
80
81function plugin_activate($plugin_id, $plugin_version, &$errors)
82{
83  global $prefixeTable, $gpcInstalled;
84
85  if($gpcInstalled)
86  {
87    $cstat = new CStat_Install($prefixeTable, __FILE__);
88    $result=$cstat->activate();
89    if($result===false or $result!='')
90    {
91      if(is_string($result))
92      {
93        array_push($errors, $result);
94      }
95      else
96      {
97        array_push($errors, "");
98      }
99    }
100  }
101  else
102  {
103    gpcMsgError($errors);
104  }
105}
106
107function plugin_deactivate($plugin_id)
108{
109  global $prefixeTable, $gpcInstalled;
110
111  if($gpcInstalled)
112  {
113    $cstat = new CStat_Install($prefixeTable, __FILE__);
114    $cstat->deactivate();
115  }
116}
117
118function plugin_uninstall($plugin_id)
119{
120  global $prefixeTable, $gpcInstalled;
121
122  if($gpcInstalled)
123  {
124    $cstat = new CStat_Install($prefixeTable, __FILE__);
125    $cstat->uninstall();
126  }
127  else
128  {
129    gpcMsgError($errors);
130  }
131}
132
133
134?>
Note: See TracBrowser for help on using the repository browser.