no more need to set version

This commit is contained in:
Jean-Christian Denis 2022-12-08 00:10:29 +01:00
parent bd362a6700
commit 61c905460f
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951

View file

@ -14,17 +14,16 @@ if (!defined('DC_CONTEXT_ADMIN')) {
return; return;
} }
# Get new version try {
$new_version = dcCore::app()->plugins->moduleInfo('kUtRL', 'version');
$old_version = dcCore::app()->getVersion('kUtRL');
# Compare versions # Compare versions
if (version_compare($old_version, $new_version, '>=')) { if (version_compare(
dcCore::app()->getVersion('kUtRL'),
dcCore::app()->plugins->moduleInfo('kUtRL', 'version'),
'>='
)) {
return null; return null;
} }
# Install or update
try {
# Table # Table
$t = new dbStruct(dcCore::app()->con, dcCore::app()->prefix); $t = new dbStruct(dcCore::app()->con, dcCore::app()->prefix);
$t->{initkUtRL::KURL_TABLE_NAME} $t->{initkUtRL::KURL_TABLE_NAME}
@ -73,9 +72,6 @@ try {
$s->put('kutrl_srv_yourls_username', '', 'string', 'User name to YOURLS service', false, true); $s->put('kutrl_srv_yourls_username', '', 'string', 'User name to YOURLS service', false, true);
$s->put('kutrl_srv_yourls_password', '', 'string', 'User password to YOURLS service', false, true); $s->put('kutrl_srv_yourls_password', '', 'string', 'User password to YOURLS service', false, true);
# Version
dcCore::app()->setVersion('kUtRL', $new_version);
# Get dcMiniUrl records as this plugin do the same # Get dcMiniUrl records as this plugin do the same
if (dcCore::app()->plugins->moduleExists('dcMiniUrl')) { if (dcCore::app()->plugins->moduleExists('dcMiniUrl')) {
require_once __DIR__ . '/inc/patch.dcminiurl.php'; require_once __DIR__ . '/inc/patch.dcminiurl.php';