Changeset 10344 for extensions/UserStat/maintain.inc.php
- Timestamp:
- Apr 12, 2011, 11:46:45 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/UserStat/maintain.inc.php
r5549 r10344 16 16 include_once('userstat_version.inc.php'); // => Don't forget to update this file !! 17 17 18 if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); } 18 defined('USERSTAT_DIR') || define('USERSTAT_DIR' , basename(dirname(__FILE__))); 19 defined('USERSTAT_PATH') || define('USERSTAT_PATH' , PHPWG_PLUGINS_PATH . USERSTAT_DIR . '/'); 20 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCCore.class.inc.php'); 19 21 20 if(!defined('USERSTAT_DIR')) define('USERSTAT_DIR' , basename(dirname(__FILE__))); 21 if(!defined('USERSTAT_PATH')) define('USERSTAT_PATH' , PHPWG_PLUGINS_PATH . USERSTAT_DIR . '/'); 22 23 24 global $gpc_installed, $gpcNeeded, $lang; //needed for plugin manager compatibility 22 global $gpcInstalled, $lang; //needed for plugin manager compatibility 25 23 26 24 /* ----------------------------------------------------------------------------- 27 UserStat needs the Grum Plugin Classe 28 ----------------------------------------------------------------------------- */ 29 $gpc_installed=false; 30 $gpcNeeded="3.0.0"; 25 * UserStat needs the Grum Plugin Classes 26 * -------------------------------------------------------------------------- */ 27 $gpcInstalled=false; 31 28 if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php')) 32 29 { 33 30 @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'); 34 // need GPC release greater or equal than 3.0.035 if(CommonPlugin::checkGPCRelease( 3,0,0))31 // need GPC release greater or equal than USERSTAT_GPC_NEEDED 32 if(CommonPlugin::checkGPCRelease(USERSTAT_GPC_NEEDED)) 36 33 { 37 @include_once("userstat_ aim.class.inc.php");38 $gpc _installed=true;34 @include_once("userstat_install.class.inc.php"); 35 $gpcInstalled=true; 39 36 } 40 37 } … … 42 39 function gpcMsgError(&$errors) 43 40 { 44 global $gpcNeeded; 45 $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), $gpcNeeded); 41 $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), USERSTAT_GPC_NEEDED); 46 42 if(is_array($errors)) 47 43 { … … 56 52 57 53 54 58 55 load_language('plugin.lang', USERSTAT_PATH); 59 56 60 57 function plugin_install($plugin_id, $plugin_version, &$errors) 61 58 { 62 global $prefixeTable, $gpc _installed, $gpcNeeded;63 if($gpc _installed)59 global $prefixeTable, $gpcInstalled; 60 if($gpcInstalled) 64 61 { 65 $obj = new UserStat_AIM($prefixeTable, __FILE__); 66 $obj->deleteConfig(); 67 $obj->initConfig(); 68 $obj->my_config['installed']=USERSTAT_VERSION2; 69 $obj->saveConfig(); 70 GPCCore::register($obj->getPluginName(), USERSTAT_VERSION, $gpcNeeded); 62 $obj=new UserStat_install($prefixeTable, __FILE__); 63 $result=$obj->install(); 71 64 } 72 65 else … … 78 71 function plugin_activate($plugin_id, $plugin_version, &$errors) 79 72 { 80 global $prefixeTable, $gpc _installed, $gpcNeeded;81 if($gpc _installed)73 global $prefixeTable, $gpcInstalled; 74 if($gpcInstalled) 82 75 { 83 $obj = new UserStat_AIM($prefixeTable, __FILE__); 84 $obj->initConfig(); 85 $obj->loadConfig(); 86 $obj->my_config['installed']=USERSTAT_VERSION2; 87 $obj->saveConfig(); 88 } 89 else 90 { 91 gpcMsgError($errors); 76 $obj=new UserStat_install($prefixeTable, __FILE__); 77 $result=$obj->activate(); 92 78 } 93 79 } … … 95 81 function plugin_deactivate($plugin_id) 96 82 { 83 global $prefixeTable, $gpcInstalled; 84 85 if($gpcInstalled) 86 { 87 $obj=new UserStat_install($prefixeTable, __FILE__); 88 $obj->deactivate(); 89 } 97 90 } 98 91 99 92 function plugin_uninstall($plugin_id) 100 93 { 101 global $prefixeTable, $gpc _installed;102 if($gpc _installed)94 global $prefixeTable, $gpcInstalled; 95 if($gpcInstalled) 103 96 { 104 $obj = new UserStat_AIM($prefixeTable, __FILE__); 105 $obj->deleteConfig(); 106 GPCCore::unregister($obj->getPluginName()); 97 $obj=new UserStat_install($prefixeTable, __FILE__); 98 $result=$obj->uninstall(); 107 99 } 108 100 else … … 113 105 114 106 115 116 107 ?>
Note: See TracChangeset
for help on using the changeset viewer.