source: extensions/AStat/maintain.inc.php @ 26168

Last change on this file since 26168 was 10264, checked in by grum, 14 years ago

bug:2146
Compatibility with Piwigo 2.2

  • Property svn:executable set to *
File size: 2.7 KB
Line 
1<?php
2/* -----------------------------------------------------------------------------
3  Plugin     : AStat.2
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('ASTAT_DIR')) define('ASTAT_DIR' , basename(dirname(__FILE__)));
17if(!defined('ASTAT_PATH')) define('ASTAT_PATH' , PHPWG_PLUGINS_PATH . ASTAT_DIR . '/');
18
19include_once('astat_version.inc.php'); // => Don't forget to update this file !!
20
21
22global $gpcInstalled, $lang; //needed for plugin manager compatibility
23
24/* -----------------------------------------------------------------------------
25AStat needs the Grum Plugin Classe
26----------------------------------------------------------------------------- */
27$gpcInstalled=false;
28if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'))
29{
30  @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php');
31  // need GPC release greater or equal than 3.5.0
32  if(CommonPlugin::checkGPCRelease(ASTAT_GPC_NEEDED))
33  {
34    include_once("astat_install.class.inc.php");
35    $gpcInstalled=true;
36  }
37}
38
39function gpcMsgError(&$errors)
40{
41  $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), ASTAT_GPC_NEEDED);
42  if(is_array($errors))
43  {
44    array_push($errors, $msg);
45  }
46  else
47  {
48    $errors=Array($msg);
49  }
50}
51// -----------------------------------------------------------------------------
52
53
54
55load_language('plugin.lang', ASTAT_PATH);
56
57
58
59
60function plugin_install($plugin_id, $plugin_version, &$errors)
61{
62  global $prefixeTable, $gpcInstalled;
63  if($gpcInstalled)
64  {
65    $obj=new AStat_install($prefixeTable, __FILE__);
66    $result=$obj->install();
67  }
68  else
69  {
70    gpcMsgError($errors);
71  }
72}
73
74function plugin_activate($plugin_id, $plugin_version, &$errors)
75{
76  global $prefixeTable, $gpcInstalled;
77  if($gpcInstalled)
78  {
79    $obj=new AStat_install($prefixeTable, __FILE__);
80    $result=$obj->activate();
81  }
82}
83
84function plugin_deactivate($plugin_id)
85{
86  global $prefixeTable, $gpcInstalled;
87
88  if($gpcInstalled)
89  {
90    $obj=new AStat_install($prefixeTable, __FILE__);
91    $obj->deactivate();
92  }
93}
94
95function plugin_uninstall($plugin_id)
96{
97  global $prefixeTable, $gpcInstalled;
98  if($gpcInstalled)
99  {
100    $obj=new AStat_install($prefixeTable, __FILE__);
101    $result=$obj->uninstall();
102  }
103  else
104  {
105    gpcMsgError($errors);
106  }
107}
108
109
110
111
112
113?>
Note: See TracBrowser for help on using the repository browser.