source: extensions/AMetaData/maintain.inc.php @ 23884

Last change on this file since 23884 was 10302, checked in by grum, 14 years ago

bug:2143
Compatibility with piwigo 2.2

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