source: extensions/AMenuManager/maintain.inc.php @ 6769

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

Update the plugin for compatibility with Piwigo 2.1

  • Property svn:executable set to *
File size: 2.5 KB
Line 
1<?php
2
3if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
4
5//ini_set('error_reporting', E_ALL);
6//ini_set('display_errors', true);
7
8defined('AMM_DIR') || define('AMM_DIR' , basename(dirname(__FILE__)));
9defined('AMM_PATH') || define('AMM_PATH' , PHPWG_PLUGINS_PATH . AMM_DIR . '/');
10
11include_once('amm_version.inc.php'); // => Don't forget to update this file !!
12include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCCore.class.inc.php');
13include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTables.class.inc.php');
14
15
16global $gpc_installed, $gpcNeeded, $lang; //needed for plugin manager compatibility
17
18/* -----------------------------------------------------------------------------
19AMM needs the Grum Plugin Classe
20----------------------------------------------------------------------------- */
21$gpc_installed=false;
22$gpcNeeded="3.0.0";
23if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'))
24{
25  @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php');
26  // need GPC release greater or equal than 3.0.0
27  if(CommonPlugin::checkGPCRelease(3,0,0))
28  {
29    @include_once("amm_install.class.inc.php");
30    $gpc_installed=true;
31  }
32}
33
34function gpcMsgError(&$errors)
35{
36  global $gpcNeeded;
37  $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), $gpcNeeded);
38  if(is_array($errors))
39  {
40    array_push($errors, $msg);
41  }
42  else
43  {
44    $errors=Array($msg);
45  }
46}
47// -----------------------------------------------------------------------------
48
49
50
51load_language('plugin.lang', AMM_PATH);
52
53function plugin_install($plugin_id, $plugin_version, &$errors)
54{
55  global $prefixeTable, $gpc_installed, $gpcNeeded;
56  if($gpc_installed)
57  {
58    //$menu->register('mbAMM_links', 'Links', 0, 'AMM');
59    //$menu->register('mbAMM_randompict', 'Random pictures', 0, 'AMM');
60    $amm=new AMM_install($prefixeTable, __FILE__);
61    $result=$amm->install();
62    GPCCore::register($amm->getPluginName(), AMM_VERSION, $gpcNeeded);
63  }
64  else
65  {
66    gpcMsgError($errors);
67  }
68}
69
70function plugin_activate($plugin_id, $plugin_version, &$errors)
71{
72  global $prefixeTable;
73
74  $amm=new AMM_install($prefixeTable, __FILE__);
75  $result=$amm->activate();
76}
77
78function plugin_deactivate($plugin_id)
79{
80}
81
82function plugin_uninstall($plugin_id)
83{
84  global $prefixeTable, $gpc_installed;
85  if($gpc_installed)
86  {
87    $amm=new AMM_install($prefixeTable, __FILE__);
88    $result=$amm->uninstall();
89    GPCCore::unregister($amm->getPluginName());
90  }
91  else
92  {
93    gpcMsgError($errors);
94  }
95}
96
97
98
99?>
Note: See TracBrowser for help on using the repository browser.