1
0
mirror of https://github.com/flarum/core.git synced 2025-10-27 21:46:17 +01:00

Inject/use new config class where applicable

This commit is contained in:
Franz Liedke
2020-03-28 11:03:19 +01:00
parent f869999011
commit 6639678fb2
10 changed files with 47 additions and 52 deletions

View File

@@ -11,7 +11,7 @@ namespace Flarum\Update\Controller;
use Exception;
use Flarum\Database\Console\MigrateCommand;
use Flarum\Foundation\Application;
use Flarum\Foundation\Config;
use Illuminate\Support\Arr;
use Laminas\Diactoros\Response;
use Laminas\Diactoros\Response\HtmlResponse;
@@ -26,18 +26,18 @@ class UpdateController implements RequestHandlerInterface
protected $command;
/**
* @var Application
* @var Config
*/
protected $app;
protected $config;
/**
* @param MigrateCommand $command
* @param Application $app
* @param Config $config
*/
public function __construct(MigrateCommand $command, Application $app)
public function __construct(MigrateCommand $command, Config $config)
{
$this->command = $command;
$this->app = $app;
$this->config = $config;
}
/**
@@ -48,7 +48,7 @@ class UpdateController implements RequestHandlerInterface
{
$input = $request->getParsedBody();
if (Arr::get($input, 'databasePassword') !== $this->app->config('database.password')) {
if (Arr::get($input, 'databasePassword') !== $this->config['database.password']) {
return new HtmlResponse('Incorrect database password.', 500);
}