diff --git a/laravel/cli/tasks/bundle/providers/provider.php b/laravel/cli/tasks/bundle/providers/provider.php index 5309e5c0..7cadacc5 100644 --- a/laravel/cli/tasks/bundle/providers/provider.php +++ b/laravel/cli/tasks/bundle/providers/provider.php @@ -30,7 +30,7 @@ abstract class Provider { // 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 @@ abstract class Provider { @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; + } + } \ No newline at end of file