Changeset 6976
- Timestamp:
- Sep 20, 2010, 12:43:52 AM (14 years ago)
- Location:
- extensions/ColorStat
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/ColorStat/admin/plugin_admin.php
r5961 r6976 14 14 if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); } 15 15 16 global $prefixeTable ;16 global $prefixeTable, $template; 17 17 load_language('plugin.lang', CSTAT_PATH); 18 18 19 19 $main_plugin_object = get_plugin_data($plugin_id); 20 20 21 /*22 * if the plugin is newly installed, display a special configuration page23 * otherwise, display normal page24 */25 21 26 $config=Array(); 27 GPCCore::loadConfig('cstat', $config); 22 if(CommonPlugin::checkGPCRelease(3,2,0)) 23 { 24 $config=Array(); 25 GPCCore::loadConfig('cstat', $config); 28 26 29 if($config['newInstall']=='n') 30 { 31 include(CSTAT_PATH."cstat_aip.class.inc.php"); 32 $plugin_aip = new CStat_AIP($prefixeTable, $main_plugin_object->getFileLocation()); 27 if(!isset($config['installed'])) $config['installed']='01.00.01'; 28 if($config['installed']!=CSTAT_VERSION2) 29 { 30 /* the plugin was updated without being deactivated 31 * deactivate + activate the plugin to process the database upgrade 32 */ 33 include(CSTAT_PATH."cstat_install.class.inc.php"); 34 $cstat=new CStat_Install($prefixeTable, dirname(__FILE__)); 35 $cstat->deactivate(); 36 $cstat->activate(); 37 $template->delete_compiled_templates(); 38 $config['newInstall']='n'; 39 } 40 41 /* 42 * if the plugin is newly installed, display a special configuration page 43 * otherwise, display normal page 44 */ 45 if($config['newInstall']=='n') 46 { 47 include(CSTAT_PATH."cstat_aip.class.inc.php"); 48 $plugin_ai = new CStat_AIP($prefixeTable, $main_plugin_object->getFileLocation()); 49 } 50 else 51 { 52 include(CSTAT_PATH."cstat_aip_install.class.inc.php"); 53 $plugin_ai = new CStat_AIPInstall($prefixeTable, $main_plugin_object->getFileLocation()); 54 } 33 55 } 34 56 else 35 57 { 36 include(CSTAT_PATH."cstat_aip_install.class.inc.php"); 37 $plugin_aip = new CStat_AIPInstall($prefixeTable, $main_plugin_object->getFileLocation()); 58 /* 59 * plugin was upgraded, but GPC was not 60 * display a page to inform user to upgrade GPC 61 */ 62 include(CSTAT_PATH."cstat_aip_release.class.inc.php"); 63 $plugin_ai = new CStat_AIPRelease($prefixeTable, $main_plugin_object->getFileLocation()); 38 64 } 39 65 40 $plugin_aip->manage(); 66 $plugin_ai->manage(); 67 68 69 41 70 ?> -
extensions/ColorStat/cstat_install.class.inc.php
r6176 r6976 90 90 91 91 $result=$this->tablef->create($tables_def); 92 93 GPCCore::register($this->getPluginName(), CSTAT_VERSION, CSTAT_GPC_NEEDED); 94 92 95 return($result); 93 96 } … … 99 102 public function uninstall() 100 103 { 104 GPCCore::unregister($this->getPluginName()); 105 101 106 $this->deleteConfig(); 102 107 $this->tablef->drop(); … … 109 114 110 115 $this->initConfig(); 111 //$this->loadConfig(); //don't keep the previous config : we need to start with default values116 $this->loadConfig(); 112 117 $this->config['installed']=CSTAT_VERSION2; 113 $this->config['newInstall']='y';114 118 $this->saveConfig(); 115 119 /* 116 120 pwg_query("DELETE FROM ".$this->tables['color_table']); 117 121 pwg_query("DELETE FROM ".$this->tables['images_colors']); … … 128 132 FROM ".IMAGES_TABLE." 129 133 WHERE id NOT IN (SELECT image_id FROM ".$this->tables['images'].")"); 134 */ 135 GPCCore::register($this->getPluginName(), CSTAT_VERSION, CSTAT_GPC_NEEDED); 136 GPCRequestBuilder::register($this->getPluginName(), dirname($this->getFileLocation()).'/cstat_rb_callback.class.inc.php'); 130 137 131 138 return(''); … … 134 141 public function deactivate() 135 142 { 143 GPCRequestBuilder::unregister($this->getPluginName()); 136 144 } 137 145 -
extensions/ColorStat/cstat_version.inc.php
r6893 r6976 17 17 define('CSTAT_VERSION', '1.0.2'); 18 18 define('CSTAT_VERSION2', '01.00.02'); 19 define('CSTAT_GPC_NEEDED', '3.2.0'); 19 20 ?> -
extensions/ColorStat/language/en_UK/plugin.lang.php
r6210 r6976 108 108 $lang['cstat_colors_on_image']='Colors associated with the image'; 109 109 110 // new keys from release 1.0.2 111 $lang['cstat_gpc_not_up_to_date']="Version %s of plugin <i>Grum Plugin Classes</i> is required. 112 Actually, the version %s is installed : thanks to upgrade the <i>Grum Plugin Classes plugin</i>."; 113 114 110 115 ?> -
extensions/ColorStat/language/fr_FR/plugin.lang.php
r6210 r6976 111 111 $lang['cstat_colors_on_image']='Couleurs associées à l\'image'; 112 112 113 // new keys from release 1.0.2 114 $lang['cstat_gpc_not_up_to_date']="Il est nécessaire que le plugin <i>Grum Plugin Classes</i> version %s soit installé. 115 Actuellement, la version %s est installée : merci de procéder à la mise à jour de version du plugin <i>Grum Plugin Classes</i>."; 116 117 113 118 ?> -
extensions/ColorStat/maintain.inc.php
r6893 r6976 20 20 //ini_set('display_errors', true); 21 21 22 global $gpc _installed, $gpcNeeded, $lang; //needed for plugin manager compatibility22 global $gpcInstalled, $lang; //needed for plugin manager compatibility 23 23 24 /* ----------------------------------------------------------------------------- 25 ColorStat needs the Grum Plugin Classe 26 ----------------------------------------------------------------------------- */ 27 $gpc_installed=false; 28 $gpcNeeded="3.2.0"; 24 /* 25 * ----------------------------------------------------------------------------- 26 * ColorStat needs the Grum Plugin Classes 27 * ----------------------------------------------------------------------------- 28 */ 29 $gpcInstalled=false; 29 30 if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php')) 30 31 { … … 34 35 { 35 36 include_once('cstat_install.class.inc.php'); 36 $gpc _installed=true;37 $gpcInstalled=true; 37 38 } 38 39 } … … 40 41 function gpcMsgError(&$errors) 41 42 { 42 global $gpcNeeded; 43 $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), $gpcNeeded); 43 $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), CSTAT_GPC_NEEDED); 44 44 if(is_array($errors)) 45 45 { … … 61 61 function plugin_install($plugin_id, $plugin_version, &$errors) 62 62 { 63 global $prefixeTable, $gpc _installed, $gpcNeeded;63 global $prefixeTable, $gpcInstalled; 64 64 65 if($gpc _installed)65 if($gpcInstalled) 66 66 { 67 $obj = new CStat_Install($prefixeTable, __FILE__); 68 $result=$obj->install(); 69 if(!$result) 67 $cstat = new CStat_Install($prefixeTable, __FILE__); 68 if(!$cstat->install()) 70 69 { 71 70 array_push($errors, "error"); 72 71 } 73 GPCCore::register($obj->getPluginName(), CSTAT_VERSION, $gpcNeeded);74 GPCRequestBuilder::register($obj->getPluginName(), dirname($obj->getFileLocation()).'/cstat_rb_callback.class.inc.php');75 72 } 76 73 else … … 82 79 function plugin_activate($plugin_id, $plugin_version, &$errors) 83 80 { 84 global $prefixeTable, $gpc _installed;81 global $prefixeTable, $gpcInstalled; 85 82 86 if($gpc _installed)83 if($gpcInstalled) 87 84 { 88 $ obj= new CStat_Install($prefixeTable, __FILE__);89 $result=$ obj->activate();85 $cstat = new CStat_Install($prefixeTable, __FILE__); 86 $result=$cstat->activate(); 90 87 if($result===false or $result!='') 91 88 { … … 108 105 function plugin_deactivate($plugin_id) 109 106 { 107 global $prefixeTable, $gpcInstalled; 108 109 if($gpcInstalled) 110 { 111 $cstat = new CStat_Install($prefixeTable, __FILE__); 112 $cstat->deactivate(); 113 } 110 114 } 111 115 112 116 function plugin_uninstall($plugin_id) 113 117 { 114 global $prefixeTable, $gpc _installed;118 global $prefixeTable, $gpcInstalled; 115 119 116 if($gpc _installed)120 if($gpcInstalled) 117 121 { 118 $obj = new CStat_Install($prefixeTable, __FILE__); 119 $obj->uninstall(); 120 GPCRequestBuilder::unregister($obj->getPluginName()); 121 GPCCore::unregister($obj->getPluginName()); 122 $cstat = new CStat_Install($prefixeTable, __FILE__); 123 $cstat->uninstall(); 122 124 } 123 125 else
Note: See TracChangeset
for help on using the changeset viewer.