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

Last change on this file since 4052 was 3394, checked in by grum, 15 years ago

Add plugin AStat 2.0.4

  • Property svn:executable set to *
File size: 2.4 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
16define('ASTAT_DIR' , basename(dirname(__FILE__)));
17define('ASTAT_PATH' , PHPWG_PLUGINS_PATH . ASTAT_DIR . '/');
18
19//ini_set('error_reporting', E_ALL);
20//ini_set('display_errors', true);
21
22global $gpc_installed, $lang; //needed for plugin manager compatibility
23
24/* -----------------------------------------------------------------------------
25AStat-2 needs the Grum Plugin Classe
26----------------------------------------------------------------------------- */
27$gpc_installed=false;
28if(file_exists(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/common_plugin.class.inc.php'))
29{
30  @include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/main.inc.php');
31  // need GPC release greater or equal than 2.0.1
32  if(checkGPCRelease(2,0,1))
33  {
34    @include_once("astat_aim.class.inc.php");
35    $gpc_installed=true;
36  }
37}
38
39function gpcMsgError(&$errors)
40{
41  array_push($errors, sprintf(l10n('AStat_gpc2_not_installed'), "2.0.1"));
42}
43// -----------------------------------------------------------------------------
44
45
46load_language('plugin.lang', ASTAT_PATH);
47
48function plugin_install($plugin_id, $plugin_version, &$errors) 
49{
50  global $prefixeTable, $gpc_installed;
51  if($gpc_installed)
52  {
53    $obj = new AStat_AIM($prefixeTable, __FILE__);
54    $obj->delete_config();
55    $obj->init_config();
56    $obj->save_config();
57  }
58  else
59  {
60    gpcMsgError($errors);
61  }
62}
63
64function plugin_activate($plugin_id, $plugin_version, &$errors)
65{
66  global $prefixeTable, $gpc_installed;
67  if($gpc_installed)
68  {
69    $obj = new AStat_AIM($prefixeTable, __FILE__);
70    $obj->init_config();
71    $obj->load_config();
72    $obj->save_config();
73    $obj->alter_history_section_enum('deleted_cat');
74  }
75  else
76  {
77    gpcMsgError($errors);
78  }
79}
80
81function plugin_deactivate($plugin_id)
82{
83}
84
85function plugin_uninstall($plugin_id)
86{
87  global $prefixeTable, $gpc_installed;
88  if($gpc_installed)
89  {
90    $obj = new AStat_AIM($prefixeTable, __FILE__);
91    $obj->delete_config();
92  }
93  else
94  {
95    gpcMsgError($errors);
96  }
97}
98
99
100
101?>
Note: See TracBrowser for help on using the repository browser.