mirror of
https://github.com/flarum/framework.git
synced 2024-11-25 09:41:49 +08:00
Fix installer/updater
This commit is contained in:
parent
be08c32c96
commit
15adfc528f
|
@ -11,7 +11,7 @@
|
||||||
namespace Flarum\Install;
|
namespace Flarum\Install;
|
||||||
|
|
||||||
use Flarum\Foundation\AbstractServiceProvider;
|
use Flarum\Foundation\AbstractServiceProvider;
|
||||||
use Flarum\Http\GenerateRouteHandlerTrait;
|
use Flarum\Http\Handler\RouteHandlerFactory;
|
||||||
use Flarum\Http\RouteCollection;
|
use Flarum\Http\RouteCollection;
|
||||||
use Flarum\Install\Prerequisite\Composite;
|
use Flarum\Install\Prerequisite\Composite;
|
||||||
use Flarum\Install\Prerequisite\PhpExtensions;
|
use Flarum\Install\Prerequisite\PhpExtensions;
|
||||||
|
@ -20,8 +20,6 @@ use Flarum\Install\Prerequisite\WritablePaths;
|
||||||
|
|
||||||
class InstallServiceProvider extends AbstractServiceProvider
|
class InstallServiceProvider extends AbstractServiceProvider
|
||||||
{
|
{
|
||||||
use GenerateRouteHandlerTrait;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
@ -51,33 +49,37 @@ class InstallServiceProvider extends AbstractServiceProvider
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->app->singleton('flarum.install.routes', function () {
|
$this->app->singleton('flarum.install.routes', function () {
|
||||||
return $this->getRoutes();
|
return new RouteCollection;
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->loadViewsFrom(__DIR__.'/../../views/install', 'flarum.install');
|
$this->loadViewsFrom(__DIR__.'/../../views/install', 'flarum.install');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return RouteCollection
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function getRoutes()
|
public function boot()
|
||||||
{
|
{
|
||||||
$routes = new RouteCollection;
|
$this->populateRoutes($this->app->make('flarum.install.routes'));
|
||||||
|
}
|
||||||
|
|
||||||
$toController = $this->getHandlerGenerator($this->app);
|
/**
|
||||||
|
* @param RouteCollection $routes
|
||||||
|
*/
|
||||||
|
protected function populateRoutes(RouteCollection $routes)
|
||||||
|
{
|
||||||
|
$route = $this->app->make(RouteHandlerFactory::class);
|
||||||
|
|
||||||
$routes->get(
|
$routes->get(
|
||||||
'/',
|
'/',
|
||||||
'index',
|
'index',
|
||||||
$toController('Flarum\Install\Controller\IndexController')
|
$route->toController(Controller\IndexController::class)
|
||||||
);
|
);
|
||||||
|
|
||||||
$routes->post(
|
$routes->post(
|
||||||
'/',
|
'/',
|
||||||
'install',
|
'install',
|
||||||
$toController('Flarum\Install\Controller\InstallController')
|
$route->toController(Controller\InstallController::class)
|
||||||
);
|
);
|
||||||
|
|
||||||
return $routes;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ namespace Flarum\Update;
|
||||||
|
|
||||||
use Flarum\Foundation\AbstractServiceProvider;
|
use Flarum\Foundation\AbstractServiceProvider;
|
||||||
use Flarum\Http\GenerateRouteHandlerTrait;
|
use Flarum\Http\GenerateRouteHandlerTrait;
|
||||||
|
use Flarum\Http\Handler\RouteHandlerFactory;
|
||||||
use Flarum\Http\RouteCollection;
|
use Flarum\Http\RouteCollection;
|
||||||
|
|
||||||
class UpdateServiceProvider extends AbstractServiceProvider
|
class UpdateServiceProvider extends AbstractServiceProvider
|
||||||
|
@ -24,33 +25,37 @@ class UpdateServiceProvider extends AbstractServiceProvider
|
||||||
public function register()
|
public function register()
|
||||||
{
|
{
|
||||||
$this->app->singleton('flarum.update.routes', function () {
|
$this->app->singleton('flarum.update.routes', function () {
|
||||||
return $this->getRoutes();
|
return new RouteCollection;
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->loadViewsFrom(__DIR__.'/../../views/install', 'flarum.update');
|
$this->loadViewsFrom(__DIR__.'/../../views/install', 'flarum.update');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return RouteCollection
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function getRoutes()
|
public function boot()
|
||||||
{
|
{
|
||||||
$routes = new RouteCollection;
|
$this->populateRoutes($this->app->make('flarum.install.routes'));
|
||||||
|
}
|
||||||
|
|
||||||
$toController = $this->getHandlerGenerator($this->app);
|
/**
|
||||||
|
* @param RouteCollection $routes
|
||||||
|
*/
|
||||||
|
protected function populateRoutes(RouteCollection $routes)
|
||||||
|
{
|
||||||
|
$route = $this->app->make(RouteHandlerFactory::class);
|
||||||
|
|
||||||
$routes->get(
|
$routes->get(
|
||||||
'/',
|
'/',
|
||||||
'index',
|
'index',
|
||||||
$toController('Flarum\Update\Controller\IndexController')
|
$route->toController(Controller\IndexController::class)
|
||||||
);
|
);
|
||||||
|
|
||||||
$routes->post(
|
$routes->post(
|
||||||
'/',
|
'/',
|
||||||
'update',
|
'update',
|
||||||
$toController('Flarum\Update\Controller\UpdateController')
|
$route->toController(Controller\UpdateController::class)
|
||||||
);
|
);
|
||||||
|
|
||||||
return $routes;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user