Allow setting storage path, clean up docblocks

This commit is contained in:
Toby Zerner 2016-04-24 11:00:25 +09:30
parent 777579e146
commit 7bd3fa82b1
2 changed files with 30 additions and 5 deletions

View File

@ -32,13 +32,19 @@ abstract class AbstractServer
*/ */
protected $publicPath; protected $publicPath;
/**
* @var string
*/
protected $storagePath;
/** /**
* @var array * @var array
*/ */
protected $config; protected $config;
/** /**
* @param string $path * @param null $basePath
* @param null $publicPath
*/ */
public function __construct($basePath = null, $publicPath = null) public function __construct($basePath = null, $publicPath = null)
{ {
@ -77,7 +83,15 @@ abstract class AbstractServer
} }
/** /**
* @param string $base_path * @return string
*/
public function getStoragePath()
{
return $this->storagePath;
}
/**
* @param $basePath
*/ */
public function setBasePath($basePath) public function setBasePath($basePath)
{ {
@ -85,13 +99,21 @@ abstract class AbstractServer
} }
/** /**
* @param string $public_path * @param $publicPath
*/ */
public function setPublicPath($publicPath) public function setPublicPath($publicPath)
{ {
$this->publicPath = $publicPath; $this->publicPath = $publicPath;
} }
/**
* @param $storagePath
*/
public function setStoragePath($storagePath)
{
$this->storagePath = $storagePath;
}
/** /**
* @return array * @return array
*/ */
@ -117,6 +139,10 @@ abstract class AbstractServer
$app = new Application($this->basePath, $this->publicPath); $app = new Application($this->basePath, $this->publicPath);
if ($this->storagePath) {
$app->useStoragePath($this->storagePath);
}
$app->instance('env', 'production'); $app->instance('env', 'production');
$app->instance('flarum.config', $this->config); $app->instance('flarum.config', $this->config);
$app->instance('config', $config = $this->getIlluminateConfig($app)); $app->instance('config', $config = $this->getIlluminateConfig($app));

View File

@ -93,6 +93,7 @@ class Application extends Container implements ApplicationContract
* Create a new Flarum application instance. * Create a new Flarum application instance.
* *
* @param string|null $basePath * @param string|null $basePath
* @param string|null $publicPath
*/ */
public function __construct($basePath = null, $publicPath = null) public function __construct($basePath = null, $publicPath = null)
{ {
@ -214,7 +215,6 @@ class Application extends Container implements ApplicationContract
* Set the base path for the application. * Set the base path for the application.
* *
* @param string $basePath * @param string $basePath
* @param string $publicPath
* @return $this * @return $this
*/ */
public function setBasePath($basePath) public function setBasePath($basePath)
@ -229,7 +229,6 @@ class Application extends Container implements ApplicationContract
/** /**
* Set the public path for the application. * Set the public path for the application.
* *
* @param string $basePath
* @param string $publicPath * @param string $publicPath
* @return $this * @return $this
*/ */