cleanup install file (psr2, short array)

master
Jean-Christian Paul Denis 2021-08-26 01:42:59 +02:00
parent d4d19113e3
commit d53c4e9a10
1 changed files with 73 additions and 75 deletions

View File

@ -10,20 +10,22 @@
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# -- END LICENSE BLOCK ------------------------------------ # -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_CONTEXT_ADMIN')){return;} if (!defined('DC_CONTEXT_ADMIN')) {
return;
}
# Get new version # Get new version
$new_version = $core->plugins->moduleInfo('kUtRL', 'version'); $new_version = $core->plugins->moduleInfo('kUtRL', 'version');
$old_version = $core->getVersion('kUtRL'); $old_version = $core->getVersion('kUtRL');
# Compare versions # Compare versions
if (version_compare($old_version,$new_version,'>=')) {return;} if (version_compare($old_version, $new_version, '>=')) {
return;
}
# Install or update # Install or update
try try {
{ if (version_compare(str_replace("-r", "-p", DC_VERSION), '2.2-alpha', '<')) {
if (version_compare(str_replace("-r","-p",DC_VERSION),'2.2-alpha','<'))
{
throw new Exception('kUtRL requires Dotclear 2.2'); throw new Exception('kUtRL requires Dotclear 2.2');
} }
@ -80,15 +82,11 @@ try
$core->setVersion('kUtRL', $new_version); $core->setVersion('kUtRL', $new_version);
# Get dcMiniUrl records as this plugin do the same # Get dcMiniUrl records as this plugin do the same
if ($core->plugins->moduleExists('dcMiniUrl')) if ($core->plugins->moduleExists('dcMiniUrl')) {
{
require_once dirname(__FILE__) . '/inc/patch.dcminiurl.php'; require_once dirname(__FILE__) . '/inc/patch.dcminiurl.php';
} }
return true; return true;
} } catch (Exception $e) {
catch (Exception $e)
{
$core->error->add($e->getMessage()); $core->error->add($e->getMessage());
return false; return false;
} }
?>