fix possible problem in provider zip extraction.
This commit is contained in:
@@ -30,7 +30,7 @@ abstract class Provider {
|
|||||||
// we have a spot to do all of our bundle extration work.
|
// we have a spot to do all of our bundle extration work.
|
||||||
$target = $work.'laravel-bundle.zip';
|
$target = $work.'laravel-bundle.zip';
|
||||||
|
|
||||||
File::put($target, file_get_contents($url));
|
File::put($target, $this->download($url));
|
||||||
|
|
||||||
$zip = new \ZipArchive;
|
$zip = new \ZipArchive;
|
||||||
|
|
||||||
@@ -54,4 +54,25 @@ abstract class Provider {
|
|||||||
@unlink($target);
|
@unlink($target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Download a remote zip archive from a URL.
|
||||||
|
*
|
||||||
|
* @param string $url
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function download($url)
|
||||||
|
{
|
||||||
|
$remote = file_get_contents($url);
|
||||||
|
|
||||||
|
// If we were unable to download the zip archive correctly
|
||||||
|
// we'll bomb out since we don't want to extract the last
|
||||||
|
// zip that was put in the storage directory.
|
||||||
|
if ($remote === false)
|
||||||
|
{
|
||||||
|
throw new \Exception("Error downloading bundle [{$bundle}].");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $remote;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user