plugin version compatibility checking. To use, set MinVersion, MaxVersion or MinPHPversion in the plugin header block. Case is not important. We check the project versions against STD_VERSION, which should be rolled to a new y of x.x.y if the plugin interface or project code changes in an incompatible way.
This commit is contained in:
@@ -348,19 +348,46 @@ function get_plugin_info($plugin){
|
||||
} else {
|
||||
$info[$k][] = array('name' => $v);
|
||||
}
|
||||
} else {
|
||||
// if (array_key_exists($k, $info)){
|
||||
$info[$k] = $v;
|
||||
// }
|
||||
}
|
||||
else {
|
||||
$info[$k] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
function check_plugin_versions($info) {
|
||||
|
||||
if(! is_array($info))
|
||||
return true;
|
||||
|
||||
if(array_key_exists('minversion',$info)) {
|
||||
if(version_compare(trim($info['minversion']),STD_VERSION, '<')) {
|
||||
logger('minversion limit: ' . $info['name'],LOGGER_NORMAL,LOG_WARNING);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(array_key_exists('maxversion',$info)) {
|
||||
if(version_compare(trim($info['maxversion']),STD_VERSION, '>')) {
|
||||
logger('maxversion limit: ' . $info['name'],LOGGER_NORMAL,LOG_WARNING);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(array_key_exists('minphpversion',$info)) {
|
||||
if(version_compare(trim($info['minphpversion']),PHP_VERSION, '<')) {
|
||||
logger('minphpversion limit: ' . $info['name'],LOGGER_NORMAL,LOG_WARNING);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Parse theme comment in search of theme infos.
|
||||
|
Reference in New Issue
Block a user