mirror of
https://github.com/flarum/core.git
synced 2025-08-07 00:47:00 +02:00
Clean up usages / deprecate path helpers (#2155)
* Write source map without creating temp file Less I/O, and one less place where we access the global path helpers. * Drop useless app_path() helper This was probably taken straight from Laravel. There is no equivalent concept in Flarum, so this should be safe to remove. * Deprecate global path helpers Developers using these helpers can inject the `Paths` class instead. * Stop storing paths as strings in container * Avoid using path helpers from Application class * Deprecate path helpers from Application class * Avoid using public_path() in prerequisite check a) The comparison was already outdated, as a different path was passed. b) We're trying to get rid of these global helpers.
This commit is contained in:
@@ -86,8 +86,6 @@ class Application
|
||||
$this->registerBaseBindings();
|
||||
$this->registerBaseServiceProviders();
|
||||
$this->registerCoreContainerAliases();
|
||||
|
||||
$this->bindPathsInContainer();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,22 +159,11 @@ class Application
|
||||
$this->register(new EventServiceProvider($this->container));
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind all of the application paths in the container.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function bindPathsInContainer()
|
||||
{
|
||||
foreach (['base', 'public', 'storage', 'vendor'] as $path) {
|
||||
$this->container->instance('path.'.$path, $this->paths->$path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base path of the Laravel installation.
|
||||
*
|
||||
* @return string
|
||||
* @deprecated Will be removed in Beta.15.
|
||||
*/
|
||||
public function basePath()
|
||||
{
|
||||
@@ -187,6 +174,7 @@ class Application
|
||||
* Get the path to the public / web directory.
|
||||
*
|
||||
* @return string
|
||||
* @deprecated Will be removed in Beta.15.
|
||||
*/
|
||||
public function publicPath()
|
||||
{
|
||||
@@ -197,6 +185,7 @@ class Application
|
||||
* Get the path to the storage directory.
|
||||
*
|
||||
* @return string
|
||||
* @deprecated Will be removed in Beta.15.
|
||||
*/
|
||||
public function storagePath()
|
||||
{
|
||||
@@ -207,6 +196,7 @@ class Application
|
||||
* Get the path to the vendor directory where dependencies are installed.
|
||||
*
|
||||
* @return string
|
||||
* @deprecated Will be removed in Beta.15.
|
||||
*/
|
||||
public function vendorPath()
|
||||
{
|
||||
|
Reference in New Issue
Block a user