source: extensions/EStat/maintain.inc.php @ 20153

Last change on this file since 20153 was 17737, checked in by grum, 12 years ago

First commit for EStat files

  • Property svn:executable set to *
File size: 2.9 KB
Line 
1<?php
2/* -----------------------------------------------------------------------------
3  Plugin     : EStat
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
16include_once('estat_version.inc.php'); // => Don't forget to update this file !!
17
18
19if(!defined('ESTAT_DIR')) define('ESTAT_DIR' , basename(dirname(__FILE__)));
20if(!defined('ESTAT_PATH')) define('ESTAT_PATH' , PHPWG_PLUGINS_PATH . ESTAT_DIR . '/');
21if(!defined('ESTAT_LIB')) define('ESTAT_LIB' , ESTAT_PATH.'lib/');
22
23//ini_set('error_reporting', E_ALL);
24//ini_set('display_errors', true);
25
26global $gpcInstalled, $lang; //needed for plugin manager compatibility
27
28/* -----------------------------------------------------------------------------
29EStat needs the Grum Plugin Classes
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 ...
36  if(CommonPlugin::checkGPCRelease(ESTAT_GPC_NEEDED))
37  {
38    include_once('estat_install.class.inc.php');
39    $gpcInstalled=true;
40  }
41}
42
43function gpcMsgError(&$errors, $errorMessage)
44{
45  switch($errorMessage)
46  {
47    case 'gpc':
48      $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), ESTAT_GPC_NEEDED);
49      break;
50  }
51
52  if(is_array($errors))
53  {
54    array_push($errors, $msg);
55  }
56  else
57  {
58    $errors=Array($msg);
59  }
60}
61// -----------------------------------------------------------------------------
62
63
64
65
66load_language('plugin.lang', ESTAT_PATH);
67
68
69function plugin_install($plugin_id, $plugin_version, &$errors)
70{
71  global $prefixeTable, $gpcInstalled;
72  if(!$gpcInstalled)
73  {
74    gpcMsgError($errors, 'gpc');
75    return(false);
76  }
77
78  $estat=new EStat_Install($prefixeTable, __FILE__);
79  $result=$estat->install();
80}
81
82function plugin_activate($plugin_id, $plugin_version, &$errors)
83{
84  global $prefixeTable, $gpcInstalled;
85  if($gpcInstalled)
86  {
87    $estat = new EStat_Install($prefixeTable, __FILE__);
88    $result=$estat->activate();
89  }
90}
91
92function plugin_deactivate($plugin_id)
93{
94  global $prefixeTable, $gpcInstalled;
95
96  if($gpcInstalled)
97  {
98    $estat=new EStat_Install($prefixeTable, __FILE__);
99    $estat->deactivate();
100  }
101
102}
103
104function plugin_uninstall($plugin_id)
105{
106  global $prefixeTable, $gpcInstalled;
107  if($gpcInstalled)
108  {
109    $estat=new EStat_Install($prefixeTable, __FILE__);
110    $result=$estat->uninstall();
111  }
112  else
113  {
114    gpcMsgError($errors, 'gpc');
115  }
116}
117
118
119?>
Note: See TracBrowser for help on using the repository browser.