use dotclear method to check version
This commit is contained in:
parent
adbc232650
commit
38e38b74bf
1 changed files with 4 additions and 17 deletions
21
_install.php
21
_install.php
|
@ -16,28 +16,15 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
|
|
||||||
# -- Nothing to change below --
|
# -- Nothing to change below --
|
||||||
try {
|
try {
|
||||||
# Grab info
|
|
||||||
$mod_id = basename(__DIR__);
|
|
||||||
$dc_min = dcCore::app()->plugins->moduleInfo($mod_id, 'requires')[0][1];
|
|
||||||
|
|
||||||
# Check module version
|
# Check module version
|
||||||
if (version_compare(
|
if (!dcCore::app()->newVersion(
|
||||||
dcCore::app()->getVersion($mod_id),
|
basename(__DIR__),
|
||||||
dcCore::app()->plugins->moduleInfo($mod_id, 'version'),
|
dcCore::app()->plugins->moduleInfo(basename(__DIR__), '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
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|
Loading…
Reference in a new issue