Hi Laurent....
I'd now found a way to check the version in the gui
Code
- public function install(iMSCP_Plugin_Manager $pluginManager) { /** @var iMSCP_Config_Handler_File $cfg */ $cfg = iMSCP_Registry::get('config'); $imscpMinVersion = '1.1.0.rc4'; if(version_compare($cfg->Version, $imscpMinVersion, '<') && $cfg->Version != 'Git Master'){ exec_query("UPDATE `plugin` SET `plugin_status` = ? WHERE `plugin_name` = 'OpenDKIM'", $cfg->ITEM_DISABLED_STATUS); set_page_message(tr('Unable to install the plugin OpenDKIM. The version of i-MSCP must be: %s. But you are using: %s', $imscpMinVersion, $cfg->Version), 'error'); } else { try { $this->createDbTable(); } catch(iMSCP_Exception_Database $e) { throw new iMSCP_Plugin_Exception($e->getMessage(), $e->getCode(), $e); } } }
This works very good . But if i want to uninstall the plugin i got this error
Code
- An unexpected error occurred:
- Modules::Plugin::_executePlugin: Can't locate /var/www/imscp/engine/Plugins/OpenDKIM.pm in @INC (@INC contains: /var/www/imscp/engine/PerlVendor /var/www/imscp/engine/PerlLib /var/www/imscp/engine /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at /var/www/imscp/engine/PerlLib/Modules/Plugin.pm line 257, <$fh> line 718
I can only uninstall if i copy the backend file to the Plugins-folder of the engine.
Is it possible to check wheter the file exist when the action is uninstall?