protected function install(UpdateInfo $info, UpdateFile $file)
{
if (!$file->hashMatches($info->getChecksum())) {
throw new CouldNotUpdate(\__('Checksum mismatched'));
}
// Let's open the update package:
$path = $file->getPath();
$zip = new \ZipArchive();
$res = $zip->open($path);
if ($res !== true) {
throw new MotifZipFailed(\__("ZIP Error: %s", "default", $res));
}
$dir = \implode(DIRECTORY_SEPARATOR, [ROOT, 'Motifs', $this->supplier->getName(), $this->name]);
// Extract the new files to the current directory
if (!$zip->extractTo($dir)) {
throw new CouldNotUpdate();
}
// Make sure we update the version info. in the DB cache:
$this->updateDBRecord('Motif', $info);
self::$continuumLogger->store(LogLevel::INFO, 'Motif update installed', $this->getLogContext($info, $file));
}