working on bundle upgrade routine.

This commit is contained in:
Taylor Otwell
2012-02-03 14:54:23 -06:00
parent b1f12b19bf
commit ea42fe75f2
4 changed files with 113 additions and 90 deletions

View File

@@ -8,23 +8,27 @@ abstract class Provider {
* Install the given bundle into the application.
*
* @param string $bundle
* @param string $path
* @return void
*/
abstract public function install($bundle);
abstract public function install($bundle, $path);
/**
* Install a bundle from by downloading a Zip.
*
* @param array $bundle
* @param string $url
* @param array $bundle
* @param string $path
* @return void
*/
protected function zipball($bundle, $url)
protected function zipball($url, $bundle, $path)
{
$work = path('storage').'work/';
// When installing a bundle from a Zip archive, we'll first clone
// down the bundle zip into the bundles "working" directory so
// we have a spot to do all of our bundle extration work.
$target = path('storage').'work/laravel-bundle.zip';
$target = $work.'laravel-bundle.zip';
File::put($target, file_get_contents($url));
@@ -36,9 +40,9 @@ abstract class Provider {
// into the working directory. By convention, we expect the
// archive to contain one root directory, and all of the
// bundle contents should be stored in that directory.
$zip->extractTo(path('storage').'work');
$zip->extractTo($work);
$latest = File::latest(dirname($target))->getRealPath();
$latest = File::latest($work)->getRealPath();
@chmod($latest, 0777);
@@ -52,15 +56,4 @@ abstract class Provider {
@unlink($target);
}
/**
* Return the path for a given bundle.
*
* @param array $bundle
* @return string
*/
protected function path($bundle)
{
return array_get($bundle, 'path', $bundle['name']);
}
}