MDL-32329 new plugininfo_base::is_core_dependency_satisfied() method

The method's logic was previously implemented in all_plugins_ok() but we
will need to call it separately. Also make the code cleaner.
This commit is contained in:
David Mudrak
2012-05-30 10:35:28 +02:00
parent f1753a5b10
commit 3a2300f552
+17 -1
View File
@@ -296,7 +296,7 @@ class plugin_manager {
foreach ($this->get_plugins() as $type => $plugins) {
foreach ($plugins as $plugin) {
if (!empty($plugin->versionrequires) && $plugin->versionrequires > $moodleversion) {
if (!$plugin->is_core_dependency_satisfied($moodleversion)) {
$return = false;
$failedplugins[] = $plugin->component;
}
@@ -1620,6 +1620,22 @@ abstract class plugininfo_base {
return $this->source === plugin_manager::PLUGIN_SOURCE_STANDARD;
}
/**
* Returns true if the the given Moodle version is enough to run this plugin
*
* @param string|int|double $moodleversion
* @return bool
*/
public function is_core_dependency_satisfied($moodleversion) {
if (empty($this->versionrequires)) {
return true;
} else {
return (double)$this->versionrequires <= (double)$moodleversion;
}
}
/**
* Returns the status of the plugin
*