isUpToDate() public method

public isUpToDate ( )
Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 protected function getMiddleware(Application $app)
 {
     $pipe = new MiddlewarePipe();
     $path = parse_url($app->url(), PHP_URL_PATH);
     $errorDir = __DIR__ . '/../../error';
     if (!$app->isInstalled()) {
         $app->register('Flarum\\Install\\InstallServiceProvider');
         $pipe->pipe($path, $app->make('Flarum\\Http\\Middleware\\StartSession'));
         $pipe->pipe($path, $app->make('Flarum\\Http\\Middleware\\DispatchRoute', ['routes' => $app->make('flarum.install.routes')]));
         $pipe->pipe($path, new HandleErrors($errorDir, true));
     } elseif ($app->isUpToDate() && !$app->isDownForMaintenance()) {
         $pipe->pipe($path, $app->make('Flarum\\Http\\Middleware\\ParseJsonBody'));
         $pipe->pipe($path, $app->make('Flarum\\Http\\Middleware\\StartSession'));
         $pipe->pipe($path, $app->make('Flarum\\Http\\Middleware\\RememberFromCookie'));
         $pipe->pipe($path, $app->make('Flarum\\Http\\Middleware\\AuthenticateWithSession'));
         $pipe->pipe($path, $app->make('Flarum\\Http\\Middleware\\SetLocale'));
         event(new ConfigureMiddleware($pipe, $path, $this));
         $pipe->pipe($path, $app->make('Flarum\\Http\\Middleware\\DispatchRoute', ['routes' => $app->make('flarum.forum.routes')]));
         $pipe->pipe($path, new HandleErrors($errorDir, $app->inDebugMode()));
     } else {
         $pipe->pipe($path, function () use($errorDir) {
             return new HtmlResponse(file_get_contents($errorDir . '/503.html', 503));
         });
     }
     return $pipe;
 }
Beispiel #2
0
 /**
  * {@inheritdoc}
  */
 protected function getMiddleware(Application $app)
 {
     $pipe = new MiddlewarePipe();
     if ($app->isInstalled()) {
         $adminPath = parse_url($app->url('admin'), PHP_URL_PATH);
         $errorDir = __DIR__ . '/../../error';
         if ($app->isUpToDate()) {
             $pipe->pipe($adminPath, $app->make('Flarum\\Http\\Middleware\\AuthenticateWithCookie'));
             $pipe->pipe($adminPath, $app->make('Flarum\\Http\\Middleware\\ParseJsonBody'));
             $pipe->pipe($adminPath, $app->make('Flarum\\Admin\\Middleware\\RequireAdministrateAbility'));
             $pipe->pipe($adminPath, $app->make('Flarum\\Http\\Middleware\\DispatchRoute', ['routes' => $app->make('flarum.admin.routes')]));
             $pipe->pipe($adminPath, new HandleErrors($errorDir, $app->inDebugMode()));
         } else {
             $app->register('Flarum\\Update\\UpdateServiceProvider');
             $pipe->pipe($adminPath, $app->make('Flarum\\Http\\Middleware\\DispatchRoute', ['routes' => $app->make('flarum.update.routes')]));
             $pipe->pipe($adminPath, new HandleErrors($errorDir, true));
         }
     }
     return $pipe;
 }
Beispiel #3
0
 /**
  * {@inheritdoc}
  */
 protected function getMiddleware(Application $app)
 {
     $pipe = new MiddlewarePipe();
     $apiPath = parse_url($app->url('api'), PHP_URL_PATH);
     if ($app->isInstalled() && $app->isUpToDate()) {
         $pipe->pipe($apiPath, $app->make('Flarum\\Http\\Middleware\\AuthenticateWithCookie'));
         $pipe->pipe($apiPath, $app->make('Flarum\\Api\\Middleware\\AuthenticateWithHeader'));
         $pipe->pipe($apiPath, $app->make('Flarum\\Http\\Middleware\\ParseJsonBody'));
         $pipe->pipe($apiPath, $app->make('Flarum\\Api\\Middleware\\FakeHttpMethods'));
         $pipe->pipe($apiPath, $app->make('Flarum\\Http\\Middleware\\DispatchRoute', ['routes' => $app->make('flarum.api.routes')]));
         $pipe->pipe($apiPath, $app->make('Flarum\\Api\\Middleware\\HandleErrors'));
     } else {
         $pipe->pipe($apiPath, function () {
             $document = new Document();
             $document->setErrors([['code' => 503, 'title' => 'Service Unavailable']]);
             return new JsonApiResponse($document, 503);
         });
     }
     return $pipe;
 }