I found that the function extractFile in UpdateManager.php was changed and I guess it might lead to the “ZipArchive::extractTo(): failed to open stream: Permission denied” problem.
I could upgrade to 3.0.7 successfully but now I cannot upgrade to 3.0.8
ErrorException: ZipArchive::extractTo(/opt/bitnami/nginx/html/LICENSE.txt): failed to open stream: Permission denied
in /opt/bitnami/nginx/html/app/system/classes/UpdateManager.php:524
Any advices ?
FROM: (Previous upgraded to 3.0.7)
public function extractFile($fileCode, $directory = null)
{
$filePath = $this->getFilePath($fileCode);
$extractTo = base_path();
if ($directory)
$extractTo .= '/'.$directory.str_replace('.', '/', $fileCode);
if (!file_exists($extractTo))
mkdir($extractTo, 0777, TRUE);
$zip = new ZipArchive();
if ($zip->open($filePath) === TRUE) {
$zip->extractTo($extractTo);
$zip->close();
@unlink($filePath);
return TRUE;
}
throw new ApplicationException('Failed to extract '.$fileCode.' archive file');
}
TO: (code at 3.0.7 and cannot upgrade to 3.0.8)
public function extractFile($fileCode, $extractTo = null)
{
$filePath = $this->getFilePath($fileCode);
if ($extractTo)
$extractTo .= '/'.str_replace('.', '/', $fileCode);
if (is_null($extractTo))
$extractTo = base_path();
if (!file_exists($extractTo))
mkdir($extractTo, 0777, TRUE);
$zip = new ZipArchive();
if ($zip->open($filePath) === TRUE) {
$zip->extractTo($extractTo);
$zip->close();
@unlink($filePath);
return TRUE;
}
throw new ApplicationException('Failed to extract '.$fileCode.' archive file');
}