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

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

Implement metadata search, release 0.5.1
bug:1846, bug:1691

  • Property svn:executable set to *
File size: 3.2 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  GPCRequestBuilder::register($amd->getPluginName(), dirname($amd->getFileLocation()).'/amd_rb_callback.class.inc.php');
91}
92
93function plugin_deactivate($plugin_id)
94{
95  global $prefixeTable, $gpcNeeded;
96
97  $amd=new AMD_install($prefixeTable, __FILE__);
98  GPCRequestBuilder::unregister($amd->getPluginName());
99}
100
101function plugin_uninstall($plugin_id)
102{
103  global $prefixeTable, $gpc_installed, $gpcNeeded;
104  if($gpc_installed)
105  {
106    $amd=new AMD_install($prefixeTable, __FILE__);
107    $result=$amd->uninstall();
108    GPCCore::unregister($amd->getPluginName());
109  }
110  else
111  {
112    gpcMsgError($errors);
113  }
114}
115
116
117
118?>
Note: See TracBrowser for help on using the repository browser.