当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::isDownForMaintenance方法代码示例

本文整理汇总了PHP中Illuminate\Contracts\Foundation\Application::isDownForMaintenance方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::isDownForMaintenance方法的具体用法?PHP Application::isDownForMaintenance怎么用?PHP Application::isDownForMaintenance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Contracts\Foundation\Application的用法示例。


在下文中一共展示了Application::isDownForMaintenance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  *
  * @throws \Symfony\Component\HttpKernel\Exception\HttpException
  */
 public function handle($request, Closure $next)
 {
     if ($this->app->isDownForMaintenance() && $this->app->environment() != 'testing') {
         throw new HttpException(503, 'Server is currently undergoing maintenance. We should be ' . 'back up shortly.');
     }
     return $next($request);
 }
开发者ID:revolverobotics,项目名称:tools-laravel-microservice,代码行数:16,代码来源:CheckForMaintenanceMode.php

示例2: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  * @return mixed
  *
  * @throws \Symfony\Component\HttpKernel\Exception\HttpException
  */
 public function handle($request, Closure $next)
 {
     if ($this->app->isDownForMaintenance()) {
         throw new HttpException(503, null, null, ['Retry-After' => 900]);
     }
     return $next($request);
 }
开发者ID:it-can,项目名称:laravel-middlewares,代码行数:16,代码来源:CheckForMaintenanceMode.php

示例3: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->app->isDownForMaintenance()) {
         throw new HttpException(503);
     }
     return $next($request);
 }
开发者ID:mubassirhayat,项目名称:Laravel51-starter,代码行数:14,代码来源:CheckForMaintenanceMode.php

示例4: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  *
  * @throws \Symfony\Component\HttpKernel\Exception\HttpException
  */
 public function handle(Request $request, Closure $next)
 {
     if ($this->app->isDownForMaintenance() && !in_array($request->getClientIp(), config('maintenance.ips', [])) && (config('maintenance.bypass_with_cookie', false) === false || config('maintenance.cookie_name', '') === '' || !$request->hasCookie(config('maintenance.cookie_name')))) {
         throw new HttpException(503);
     }
     return $next($request);
 }
开发者ID:philcross,项目名称:laravel-maintenance-mode,代码行数:16,代码来源:CheckForMaintenanceMode.php

示例5: handle

 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->app->isDownForMaintenance()) {
         return new Response($this->view->make('maintenance')->render(), 503);
     }
     return $next($request);
 }
开发者ID:berkapavel,项目名称:CMS,代码行数:15,代码来源:CheckForMaintenanceMode.php

示例6: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->app->isDownForMaintenance()) {
         return new Response('Be right back!', 503);
     }
     return $next($request);
 }
开发者ID:CodeWire,项目名称:larapress,代码行数:14,代码来源:MaintenanceMiddleware.php

示例7: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  * @return void|mixed
  */
 public function handle(Request $request, Closure $next)
 {
     if (!$this->app->isDownForMaintenance()) {
         return $next($request);
     }
     if ($request->segment(1) == 'admin') {
         return $next($request);
     }
     if (in_array($request->getClientIp(), $this->config->get('streams::maintenance.ip_whitelist', []))) {
         return $next($request);
     }
     /* @var UserInterface $user */
     $user = $this->guard->user();
     if ($user && $user->isAdmin()) {
         return $next($request);
     }
     if ($user && $this->authorizer->authorize('streams::maintenance.access')) {
         return $next($request);
     }
     if (!$user && $this->config->get('streams::maintenance.auth')) {
         /* @var Response|null $response */
         $response = $this->guard->onceBasic();
         if (!$response) {
             return $next($request);
         }
         $response->setContent(view('streams::errors.401'));
         return $response;
     }
     abort(503);
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:37,代码来源:CheckForMaintenanceMode.php

示例8: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->app->isDownForMaintenance() && !in_array($request->getClientIp(), ['127.0.0.1'])) {
         throw new HttpException(503);
     }
     return $next($request);
 }
开发者ID:nekonekonik,项目名称:nuswhispers,代码行数:14,代码来源:CheckForMaintenanceMode.php

示例9: handle

 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @throws \Symfony\Component\HttpKernel\Exception\HttpException
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->application->isDownForMaintenance()) {
         $data = json_decode(file_get_contents($this->application->storagePath() . '/bootstraps/down'), true);
         throw new MaintenanceModeException($data['time'], $data['retry'], $data['message']);
     }
     return $next($request);
 }
开发者ID:notadd,项目名称:framework,代码行数:17,代码来源:CheckForMaintenanceMode.php

示例10: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  * @return mixed
  *
  * @throws \Symfony\Component\HttpKernel\Exception\HttpException
  */
 public function handle($request, Closure $next)
 {
     if ($this->app->isDownForMaintenance()) {
         if (site('adminIgnoresMaintenance') == '1' && ($user = $request->user()) && $user->isAdmin()) {
             return $next($request);
         }
         throw new HttpException(503);
     }
     return $next($request);
 }
开发者ID:projnoah,项目名称:noah,代码行数:19,代码来源:CheckForMaintenanceMode.php

示例11: handle

 /**
  * Handle the command.
  *
  * @param SettingsWereSaved $event
  */
 public function handle(SettingsWereSaved $event)
 {
     $builder = $event->getBuilder();
     if (!($namespace = $builder->getEntry()) == 'streams') {
         return;
     }
     $maintenance = $builder->getFormValue('maintenance');
     if ($maintenance && !$this->application->isDownForMaintenance()) {
         touch(storage_path('framework/down'));
     }
     if (!$maintenance && $this->application->isDownForMaintenance()) {
         unlink(storage_path('framework/down'));
     }
 }
开发者ID:jacksun101,项目名称:settings-module,代码行数:19,代码来源:UpdateMaintenanceMode.php

示例12: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  *
  * @throws \Symfony\Component\HttpKernel\Exception\HttpException
  */
 public function handle($request, Closure $next)
 {
     if ($this->app->isDownForMaintenance()) {
         $response = $next($request);
         $route = $request->route();
         if ($route instanceof Route) {
             if (in_array($route->getName(), $this->excludedRoutes)) {
                 return $response;
             }
         }
         throw new HttpException(503);
     }
     return $next($request);
 }
开发者ID:pedrohbraz,项目名称:rifasPando,代码行数:23,代码来源:ModoManutencao.php

示例13: isDue

 /**
  * Determine if the given event should run based on the Cron expression.
  *
  * @param  \Illuminate\Contracts\Foundation\Application  $app
  * @return bool
  */
 public function isDue($app)
 {
     if (!$this->runsInMaintenanceMode() && $app->isDownForMaintenance()) {
         return false;
     }
     return $this->expressionPasses() && $this->runsInEnvironment($app->environment());
 }
开发者ID:rosswilson252,项目名称:framework,代码行数:13,代码来源:Event.php

示例14: handle

 /**
  * Handle the request
  *
  * @param \Illuminate\Http\Request $request
  * @param callable                 $next
  * @return Response
  * @throws ExemptionDoesNotExist
  * @throws InvalidExemption
  */
 public function handle($request, Closure $next)
 {
     // Grab our configs
     $injectGlobally = $this->app['config']->get('maintenancemode.inject.globally', true);
     $prefix = $this->app['config']->get('maintenancemode.inject.prefix', 'MaintenanceMode');
     $lang = $this->app['config']->get('maintenancemode.language-path', 'maintenancemode::defaults');
     // Setup value array
     $info = [$prefix . 'Enabled' => false, $prefix . 'Timestamp' => Carbon::now(), $prefix . 'Message' => $this->app['translator']->get($lang . '.message')];
     // Are we down?
     if ($this->app->isDownForMaintenance()) {
         // Yes. :(
         $info[$prefix . 'Enabled'] = true;
         $path = storage_path() . '/framework/down';
         if ($this->app['files']->exists($path)) {
             // Grab the stored information
             $fileContents = $this->app['files']->get($path);
             if (preg_match('~([0-9]+)\\|(.*)~', $fileContents, $matches)) {
                 // And put it into our array, if it exists
                 $info[$prefix . 'Timestamp'] = Carbon::createFromTimeStamp($matches[1]);
                 if (isset($matches[2]) && $matches[2] != '') {
                     $info[$prefix . 'Message'] = $matches[2];
                 }
             }
         }
         if ($injectGlobally) {
             // Inject the information globally
             foreach ($info as $key => $value) {
                 $this->app['view']->share($key, $value);
             }
         }
         // Check to see if the user is exempt or not
         $isExempt = false;
         // Grab all of the exemption classes to create/execute against
         $exemptions = $this->app['config']->get('maintenancemode.exemptions', []);
         foreach ($exemptions as $className) {
             if (class_exists($className)) {
                 $exemption = new $className($this->app);
                 if ($exemption instanceof MaintenanceModeExemption) {
                     // Run the exemption check
                     if ($exemption->isExempt()) {
                         $isExempt = true;
                         break;
                     }
                 } else {
                     // Class doesn't match what we're looking for
                     throw new InvalidExemption($this->app['translator']->get($lang . '.exceptions.invalid', ['class' => $className]));
                 }
             } else {
                 // Where's Waldo?
                 throw new ExemptionDoesNotExist($this->app['translator']->get($lang . '.exceptions.missing', ['class' => $className]));
             }
         }
         if (!$isExempt) {
             // Since the session isn't started... it'll throw an error
             $this->app['session']->start();
             // The user isn't exempt, let's show them the maintenance page!
             $view = $this->app['config']->get('maintenancemode.view-page', 'maintenancemode::app-down');
             // $view = 'errors.503';
             return new Response(view($view, $info), 503);
         }
     } else {
         if ($injectGlobally) {
             // Inject the information globally (to prevent the need of isset)
             foreach ($info as $key => $value) {
                 $this->app['view']->share($key, $value);
             }
         }
     }
     return $next($request);
 }
开发者ID:brahmantyo,项目名称:master,代码行数:79,代码来源:CheckForMaintenanceMode.php

示例15: filter

 /**
  * Run the request filter.
  *
  * @return mixed
  */
 public function filter()
 {
     if ($this->app->isDownForMaintenance()) {
         return new Response('Be right back!', 503);
     }
 }
开发者ID:devLopez,项目名称:espresso,代码行数:11,代码来源:MaintenanceFilter.php


注:本文中的Illuminate\Contracts\Foundation\Application::isDownForMaintenance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。