Consolidate Bundle::path and ::location
This commit is contained in:
parent
e828b6c0c3
commit
aa9d790a15
|
@ -169,19 +169,6 @@ public static function exists($bundle)
|
||||||
return $bundle == DEFAULT_BUNDLE or in_array(strtolower($bundle), static::names());
|
return $bundle == DEFAULT_BUNDLE or in_array(strtolower($bundle), static::names());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the full path location of a given bundle.
|
|
||||||
*
|
|
||||||
* @param string $bundle
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public static function location($bundle)
|
|
||||||
{
|
|
||||||
$location = array_get(static::$bundles, $bundle.'.location');
|
|
||||||
|
|
||||||
return path('bundle').str_finish($location, DS);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if a given bundle has been started for the request.
|
* Determine if a given bundle has been started for the request.
|
||||||
*
|
*
|
||||||
|
@ -242,9 +229,14 @@ public static function class_prefix($bundle)
|
||||||
*/
|
*/
|
||||||
public static function path($bundle)
|
public static function path($bundle)
|
||||||
{
|
{
|
||||||
if (is_null($bundle)) return static::path(DEFAULT_BUNDLE);
|
if (is_null($bundle) or $bundle === DEFAULT_BUNDLE)
|
||||||
|
{
|
||||||
return ($bundle == DEFAULT_BUNDLE) ? path('app') : static::location($bundle);
|
return path('app');
|
||||||
|
}
|
||||||
|
else if ($location = array_get(static::$bundles, $bundle.'.location'))
|
||||||
|
{
|
||||||
|
return str_finish(path('bundle').$location, DS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -81,7 +81,7 @@ public function upgrade($bundles)
|
||||||
// First we want to retrieve the information for the bundle, such as
|
// First we want to retrieve the information for the bundle, such as
|
||||||
// where it is currently installed. This will allow us to upgrade
|
// where it is currently installed. This will allow us to upgrade
|
||||||
// the bundle into it's current installation path.
|
// the bundle into it's current installation path.
|
||||||
$location = Bundle::location($name);
|
$location = Bundle::path($name);
|
||||||
|
|
||||||
// If the bundle exists, we will grab the data about the bundle from
|
// If the bundle exists, we will grab the data about the bundle from
|
||||||
// the API so we can make the right bundle provider for the bundle,
|
// the API so we can make the right bundle provider for the bundle,
|
||||||
|
|
Loading…
Reference in New Issue