use dotclear method to check version
This commit is contained in:
parent
fbc7a75e12
commit
a41edabd8a
1 changed files with 8 additions and 18 deletions
26
_install.php
26
_install.php
|
@ -15,25 +15,14 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
# Grab info
|
# Version
|
||||||
$mod_id = basename(__DIR__);
|
if (!dcCore::app()->newVersion(
|
||||||
$dc_min = dcCore::app()->plugins->moduleInfo($mod_id, 'requires')[0][1];
|
basename(__DIR__),
|
||||||
$old_version = dcCore::app()->getVersion($mod_id);
|
dcCore::app()->plugins->moduleInfo(basename(__DIR__), 'version')
|
||||||
|
)) {
|
||||||
if (version_compare($old_version, dcCore::app()->plugins->moduleInfo($mod_id, 'version'), '>=')) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check Dotclear version
|
|
||||||
if (!method_exists('dcUtils', 'versionsCompare')
|
|
||||||
|| dcUtils::versionsCompare(DC_VERSION, $dc_min, '<', false)) {
|
|
||||||
throw new Exception(sprintf(
|
|
||||||
'%s requires Dotclear %s',
|
|
||||||
$mod_id,
|
|
||||||
$dc_min
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
$s = new dbStruct(dcCore::app()->con, dcCore::app()->prefix);
|
$s = new dbStruct(dcCore::app()->con, dcCore::app()->prefix);
|
||||||
$s->{initEnhancePostContent::EPC_TABLE_NAME}
|
$s->{initEnhancePostContent::EPC_TABLE_NAME}
|
||||||
|
@ -56,8 +45,8 @@ try {
|
||||||
$s = null;
|
$s = null;
|
||||||
|
|
||||||
# Settings
|
# Settings
|
||||||
dcCore::app()->blog->settings->addNamespace($mod_id);
|
dcCore::app()->blog->settings->addNamespace(basename(__DIR__));
|
||||||
$s = dcCore::app()->blog->settings->enhancePostContent;
|
$s = dcCore::app()->blog->settings->__get(basename(__DIR__));
|
||||||
|
|
||||||
$s->put('enhancePostContent_active', false, 'boolean', 'Enable enhancePostContent', false, true);
|
$s->put('enhancePostContent_active', false, 'boolean', 'Enable enhancePostContent', false, true);
|
||||||
$s->put('enhancePostContent_list_sortby', 'epc_key', 'string', 'Admin records list field order', false, true);
|
$s->put('enhancePostContent_list_sortby', 'epc_key', 'string', 'Admin records list field order', false, true);
|
||||||
|
@ -87,6 +76,7 @@ try {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Update old versions
|
# Update old versions
|
||||||
|
$old_version = dcCore::app()->getVersion($mod_id);
|
||||||
if ($old_version && version_compare('2021.10.05', $old_version, '>=')) {
|
if ($old_version && version_compare('2021.10.05', $old_version, '>=')) {
|
||||||
include_once dirname(__FILE__) . '/inc/lib.epc.update.php';
|
include_once dirname(__FILE__) . '/inc/lib.epc.update.php';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue