MDL-48494 admin: Fail validation of plugins with no component declared

This commit is contained in:
David Mudrák
2015-08-31 10:01:34 +02:00
parent 98ea697349
commit 033761fe9b
9 changed files with 49 additions and 16 deletions
+17 -14
View File
@@ -322,22 +322,25 @@ class tool_installaddon_validator {
$this->add_message(self::INFO, 'requiresmoodle', $this->versionphp['requires']);
}
if (isset($info['plugin->component'])) {
$this->versionphp['component'] = $info['plugin->component'];
list($reqtype, $reqname) = core_component::normalize_component($this->versionphp['component']);
if ($reqtype !== $this->assertions['plugintype']) {
$this->add_message(self::ERROR, 'componentmismatchtype', array(
'expected' => $this->assertions['plugintype'],
'found' => $reqtype));
return false;
}
if ($reqname !== $this->rootdir) {
$this->add_message(self::ERROR, 'componentmismatchname', $reqname);
return false;
}
$this->add_message(self::INFO, 'componentmatch', $this->versionphp['component']);
if (!isset($info['plugin->component'])) {
$this->add_message(self::ERROR, 'missingcomponent');
return false;
}
$this->versionphp['component'] = $info['plugin->component'];
list($reqtype, $reqname) = core_component::normalize_component($this->versionphp['component']);
if ($reqtype !== $this->assertions['plugintype']) {
$this->add_message(self::ERROR, 'componentmismatchtype', array(
'expected' => $this->assertions['plugintype'],
'found' => $reqtype));
return false;
}
if ($reqname !== $this->rootdir) {
$this->add_message(self::ERROR, 'componentmismatchname', $reqname);
return false;
}
$this->add_message(self::INFO, 'componentmatch', $this->versionphp['component']);
if (isset($info['plugin->maturity'])) {
$this->versionphp['maturity'] = $info['plugin->maturity'];
if ($this->versionphp['maturity'] === 'MATURITY_STABLE') {