mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 01:46:45 +02:00
MDL-35238 Compare the ZIP package content hash with the expected value
The expected value is returned as a part of available update info (requires API version 1.1).
This commit is contained in:
parent
85d7516313
commit
6b75106a75
3 changed files with 37 additions and 2 deletions
|
@ -1407,6 +1407,8 @@ class available_update_info {
|
|||
public $url = null;
|
||||
/** @var string|null optional URL of a ZIP package that can be downloaded and installed */
|
||||
public $download = null;
|
||||
/** @var string|null of self::download is set, then this must be the MD5 hash of the ZIP */
|
||||
public $downloadmd5 = null;
|
||||
|
||||
/**
|
||||
* Creates new instance of the class
|
||||
|
@ -1529,7 +1531,7 @@ class available_update_deployer {
|
|||
*
|
||||
* All instances of {@link available_update_info} class always provide at least the
|
||||
* component name and component version. Additionally, we also need the URL to download
|
||||
* the ZIP package from.
|
||||
* the ZIP package from and MD5 hash of the ZIP's content.
|
||||
*
|
||||
* @param available_update_info $info
|
||||
* @return bool
|
||||
|
@ -1540,6 +1542,10 @@ class available_update_deployer {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (empty($info->downloadmd5)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1626,6 +1632,7 @@ class available_update_deployer {
|
|||
'name' => $pluginname,
|
||||
'typeroot' => $pluginrootpaths[$plugintype],
|
||||
'package' => $info->download,
|
||||
'md5' => $info->downloadmd5,
|
||||
'dataroot' => $CFG->dataroot,
|
||||
'dirroot' => $CFG->dirroot,
|
||||
'passfile' => $passfile,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue