Changeset 28817 for extensions/AMetaData/maintain.inc.php
- Timestamp:
- Jun 27, 2014, 10:02:05 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/AMetaData/maintain.inc.php
r28815 r28817 20 20 //ini_set('display_errors', true); 21 21 22 include_once('amd_version.inc.php'); // => Don't forget to update this file !! 23 24 25 defined('AMD_DIR') || define('AMD_DIR' , basename(dirname(__FILE__))); 26 defined('AMD_PATH') || define('AMD_PATH' , PHPWG_PLUGINS_PATH . AMD_DIR . '/'); 27 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCCore.class.inc.php'); 28 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTables.class.inc.php'); 29 30 31 global $gpcInstalled, $lang; //needed for plugin manager compatibility 32 33 /* ----------------------------------------------------------------------------- 34 * AMD needs the Grum Plugin Classe 35 * -------------------------------------------------------------------------- */ 36 $gpcInstalled=false; 37 if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php')) 38 { 39 @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'); 40 // need GPC release greater or equal than AMD_GPC_NEEDED 41 if(CommonPlugin::checkGPCRelease(AMD_GPC_NEEDED)) 42 { 43 @include_once("amd_install.class.inc.php"); 44 $gpcInstalled=true; 45 } 46 } 47 48 function gpcMsgError(&$errors) 22 function gpcMsgError(&$errors=array()) 49 23 { 50 24 $msg=l10n('To install this plugin, you need to install Grum Plugin Classes %s before', AMD_GPC_NEEDED); … … 58 32 } 59 33 } 34 35 function 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 } 60 63 // ----------------------------------------------------------------------------- 61 64 62 65 66 class AMetaData_maintain extends PluginMaintain 67 { 63 68 64 load_language('plugin.lang', AMD_PATH); 69 function install($plugin_version, &$errors=array()) 70 { 71 amdInit(); 65 72 66 function plugin_install($plugin_id, $plugin_version, &$errors) 67 { 68 global $prefixeTable, $gpcInstalled; 69 if($gpcInstalled) 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()) 70 87 { 71 $amd=new AMD_install($prefixeTable, __FILE__); 72 $result=$amd->install(); 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 } 73 97 } 74 else 98 99 function deactivate() 75 100 { 76 gpcMsgError($errors); 101 amdInit(); 102 103 global $prefixeTable, $gpcInstalled, $lang; 104 105 if($gpcInstalled) 106 { 107 $amd=new AMD_install($prefixeTable, __FILE__); 108 $amd->deactivate(); 109 } 77 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 78 129 } 79 130 80 function plugin_activate($plugin_id, $plugin_version, &$errors)81 {82 global $prefixeTable, $gpcInstalled;83 if($gpcInstalled)84 {85 $amd=new AMD_install($prefixeTable, __FILE__);86 $result=$amd->activate();87 }88 }89 90 function plugin_deactivate($plugin_id)91 {92 global $prefixeTable, $gpcInstalled;93 94 if($gpcInstalled)95 {96 $amd=new AMD_install($prefixeTable, __FILE__);97 $amd->deactivate();98 }99 }100 101 function plugin_uninstall($plugin_id)102 {103 global $prefixeTable, $gpcInstalled;104 if($gpcInstalled)105 {106 $amd=new AMD_install($prefixeTable, __FILE__);107 $result=$amd->uninstall();108 }109 else110 {111 gpcMsgError($errors);112 }113 }114 115 116 117 131 ?>
Note: See TracChangeset
for help on using the changeset viewer.