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

Last change on this file since 32594 was 28817, checked in by Youp3, 10 years ago

Advanced Meta Data : adaptation des fonctions de maintenance du plugin pour adopter les nouveaux standards de Piwigo 2.6+

  • 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
22function gpcMsgError(&$errors=array())
23{
24  $msg=l10n('To install this plugin, you need to install Grum Plugin Classes %s before', AMD_GPC_NEEDED);
25  if(is_array($errors))
26  {
27    array_push($errors, $msg);
28  }
29  else
30  {
31    $errors=Array($msg);
32  }
33}
34
35function amdInit()
36{
37  include_once('amd_version.inc.php'); // => Don't forget to update this file !!
38
39  defined('AMD_DIR') || define('AMD_DIR' , basename(dirname(__FILE__)));
40  defined('AMD_PATH') || define('AMD_PATH' , PHPWG_PLUGINS_PATH . AMD_DIR . '/');
41  @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCCore.class.inc.php');
42  @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTables.class.inc.php');
43
44  global $gpcInstalled, $lang; //needed for plugin manager compatibility
45
46  /* -----------------------------------------------------------------------------
47   * AMD needs the Grum Plugin Classe
48   * -------------------------------------------------------------------------- */
49  $gpcInstalled=false;
50  if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'))
51  {
52    @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php');
53    // need GPC release greater or equal than AMD_GPC_NEEDED
54    if(CommonPlugin::checkGPCRelease(AMD_GPC_NEEDED))
55    {
56      @include_once("amd_install.class.inc.php");
57      $gpcInstalled=true;
58    }
59  }
60
61  load_language('plugin.lang', AMD_PATH);
62}
63// -----------------------------------------------------------------------------
64
65
66class AMetaData_maintain extends PluginMaintain
67{
68
69  function install($plugin_version, &$errors=array())
70  {
71    amdInit();
72
73    global $prefixeTable, $gpcInstalled, $lang;
74
75    if($gpcInstalled)
76    {
77      $amd=new AMD_install($prefixeTable, __FILE__);
78      $result=$amd->install();
79    }
80    else
81    {
82      gpcMsgError($errors);
83    }
84  }
85
86  function activate($plugin_version, &$errors=array())
87  {
88    amdInit();
89
90    global $prefixeTable, $gpcInstalled, $lang;
91
92    if($gpcInstalled)
93    {
94      $amd=new AMD_install($prefixeTable, __FILE__);
95      $result=$amd->activate();
96    }
97  }
98
99  function deactivate()
100  {
101    amdInit();
102
103    global $prefixeTable, $gpcInstalled, $lang;
104
105    if($gpcInstalled)
106    {
107      $amd=new AMD_install($prefixeTable, __FILE__);
108      $amd->deactivate();
109    }
110  }
111
112  function uninstall()
113  {
114    amdInit();
115
116    global $prefixeTable, $gpcInstalled, $lang;
117
118    if($gpcInstalled)
119    {
120      $amd=new AMD_install($prefixeTable, __FILE__);
121      $result=$amd->uninstall();
122    }
123    else
124    {
125      gpcMsgError($errors);
126    }
127  }
128
129}
130
131?>
Note: See TracBrowser for help on using the repository browser.