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

Last change on this file since 6788 was 6729, checked in by grum, 14 years ago

feature:1777

  • Weight of the metadata database can becomes very heavy
  • Property svn:executable set to *
File size: 3.0 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.2.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.2.0
42  if(CommonPlugin::checkGPCRelease(3,2,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, $gpcNeeded;
86
87  $amd=new AMD_install($prefixeTable, __FILE__);
88  $result=$amd->activate();
89  GPCCore::register($amd->getPluginName(), AMD_VERSION, $gpcNeeded);
90}
91
92function plugin_deactivate($plugin_id)
93{
94}
95
96function plugin_uninstall($plugin_id)
97{
98  global $prefixeTable, $gpc_installed, $gpcNeeded;
99  if($gpc_installed)
100  {
101    $amd=new AMD_install($prefixeTable, __FILE__);
102    $result=$amd->uninstall();
103    GPCCore::unregister($amd->getPluginName());
104  }
105  else
106  {
107    gpcMsgError($errors);
108  }
109}
110
111
112
113?>
Note: See TracBrowser for help on using the repository browser.