diff --git a/_define.php b/_define.php index 6dfffcb..6bec2ec 100644 --- a/_define.php +++ b/_define.php @@ -24,9 +24,9 @@ $this->registerModule( 'permissions' => dcCore::app()->auth->makePermissions([ dcAuth::PERMISSION_ADMIN, ]), - 'type' => 'plugin', - 'support' => 'https://github.com/JcDenis/alias', - 'details' => 'https://plugins.dotaddict.org/dc2/details/alias', - 'repository' => 'https://raw.githubusercontent.com/JcDenis/alias/master/dcstore.xml', + 'type' => 'plugin', + 'support' => 'https://github.com/JcDenis/alias', + 'details' => 'https://plugins.dotaddict.org/dc2/details/alias', + 'repository' => 'https://raw.githubusercontent.com/JcDenis/alias/master/dcstore.xml', ] ); diff --git a/_install.php b/_install.php index 1d986c8..b613f31 100644 --- a/_install.php +++ b/_install.php @@ -14,15 +14,15 @@ if (!defined('DC_CONTEXT_ADMIN')) { return null; } -$version = dcCore::app()->plugins->moduleInfo('alias', 'version'); - -if (version_compare(dcCore::app()->getVersion('alias'), $version, '>=')) { - return null; -} - try { - $s = new dbStruct(dcCore::app()->con, dcCore::app()->prefix); + $mod_id = basename(__DIR__); + $version = dcCore::app()->plugins->moduleInfo($mod_id, 'version'); + if (version_compare(dcCore::app()->getVersion($mod_id), $version, '>=')) { + return null; + } + + $s = new dbStruct(dcCore::app()->con, dcCore::app()->prefix); $s->{initAlias::ALIAS_TABLE_NAME} ->blog_id('varchar', 32, false) ->alias_url('varchar', 255, false) @@ -37,11 +37,10 @@ try { ->reference('fk_alias_blog', 'blog_id', 'blog', 'blog_id', 'cascade', 'cascade') ; - # Schema installation $si = new dbStruct(dcCore::app()->con, dcCore::app()->prefix); $changes = $si->synchronize($s); - dcCore::app()->setVersion('alias', $version); + dcCore::app()->setVersion($mod_id, $version); return true; } catch (Exception $e) {