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

Last change on this file since 6442 was 5959, checked in by grum, 15 years ago

Some changes on release 0.4b

  • 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 $gpc_installed, $gpcNeeded, $lang; //needed for plugin manager compatibility
32
33/* -----------------------------------------------------------------------------
34 * AMD needs the Grum Plugin Classe
35 * -------------------------------------------------------------------------- */
36$gpc_installed=false;
37$gpcNeeded="3.1.0";
38if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'))
39{
40  @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php');
41  // need GPC release greater or equal than 3.1.0
42  if(CommonPlugin::checkGPCRelease(3,1,0))
43  {
44    @include_once("amd_install.class.inc.php");
45    $gpc_installed=true;
46  }
47}
48
49function gpcMsgError(&$errors)
50{
51  global $gpcNeeded;
52  $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), $gpcNeeded);
53  if(is_array($errors))
54  {
55    array_push($errors, $msg);
56  }
57  else
58  {
59    $errors=Array($msg);
60  }
61}
62// -----------------------------------------------------------------------------
63
64
65
66load_language('plugin.lang', AMD_PATH);
67
68function plugin_install($plugin_id, $plugin_version, &$errors)
69{
70  global $prefixeTable, $gpc_installed, $gpcNeeded;
71  if($gpc_installed)
72  {
73    $amd=new AMD_install($prefixeTable, __FILE__);
74    $result=$amd->install();
75    GPCCore::register($amd->getPluginName(), AMD_VERSION, $gpcNeeded);
76  }
77  else
78  {
79    gpcMsgError($errors);
80  }
81}
82
83function plugin_activate($plugin_id, $plugin_version, &$errors)
84{
85  global $prefixeTable;
86
87  $amd=new AMD_install($prefixeTable, __FILE__);
88  $result=$amd->activate();
89}
90
91function plugin_deactivate($plugin_id)
92{
93}
94
95function plugin_uninstall($plugin_id)
96{
97  global $prefixeTable, $gpc_installed, $gpcNeeded;
98  if($gpc_installed)
99  {
100    $amd=new AMD_install($prefixeTable, __FILE__);
101    $result=$amd->uninstall();
102    GPCCore::unregister($amd->getPluginName());
103  }
104  else
105  {
106    gpcMsgError($errors);
107  }
108}
109
110
111
112?>
Note: See TracBrowser for help on using the repository browser.