fix possible problem in provider zip extraction.

This commit is contained in:
Taylor Otwell 2012-02-06 14:53:59 -06:00
parent 56ae5e9a7b
commit e89082e3ba
1 changed files with 22 additions and 1 deletions

View File

@ -30,7 +30,7 @@ protected function zipball($url, $bundle, $path)
// we have a spot to do all of our bundle extration work.
$target = $work.'laravel-bundle.zip';
File::put($target, file_get_contents($url));
File::put($target, $this->download($url));
$zip = new \ZipArchive;
@ -54,4 +54,25 @@ protected function zipball($url, $bundle, $path)
@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;
}
}