mirror of
https://github.com/flarum/framework.git
synced 2025-02-11 08:53:58 +08:00
![Toby Zerner](/assets/img/avatar_default.png)
If the version in the settings table mismatches the code version, then we return a 503 error for all requests coming through index.php and api.php, while admin.php serves up a form prompting for the database password which will run outstanding migrations.
58 lines
1.3 KiB
PHP
58 lines
1.3 KiB
PHP
<?php
|
|
/*
|
|
* This file is part of Flarum.
|
|
*
|
|
* (c) Toby Zerner <toby.zerner@gmail.com>
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Flarum\Update;
|
|
|
|
use Flarum\Http\GenerateRouteHandlerTrait;
|
|
use Flarum\Http\RouteCollection;
|
|
use Flarum\Foundation\AbstractServiceProvider;
|
|
use Psr\Http\Message\ServerRequestInterface;
|
|
|
|
class UpdateServiceProvider extends AbstractServiceProvider
|
|
{
|
|
use GenerateRouteHandlerTrait;
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function register()
|
|
{
|
|
$this->app->singleton('flarum.update.routes', function () {
|
|
return $this->getRoutes();
|
|
});
|
|
|
|
$this->loadViewsFrom(__DIR__.'/../../views/install', 'flarum.update');
|
|
}
|
|
|
|
/**
|
|
* @return RouteCollection
|
|
*/
|
|
protected function getRoutes()
|
|
{
|
|
$routes = new RouteCollection;
|
|
|
|
$toController = $this->getHandlerGenerator($this->app);
|
|
|
|
$routes->get(
|
|
'/',
|
|
'index',
|
|
$toController('Flarum\Update\Controller\IndexController')
|
|
);
|
|
|
|
$routes->post(
|
|
'/',
|
|
'update',
|
|
$toController('Flarum\Update\Controller\UpdateController')
|
|
);
|
|
|
|
return $routes;
|
|
}
|
|
}
|