本文整理汇总了PHP中Illuminate\Support\Facades\App::isDownForMaintenance方法的典型用法代码示例。如果您正苦于以下问题:PHP App::isDownForMaintenance方法的具体用法?PHP App::isDownForMaintenance怎么用?PHP App::isDownForMaintenance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\App
的用法示例。
在下文中一共展示了App::isDownForMaintenance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
// Check not 'sync'
if (Config::get('queue.default') == "sync") {
Artisan::call('down');
$this->info("Application maintenance mode enabled.");
return;
}
// Push job onto queue
Queue::push(function ($job) {
// Take Application down.
Artisan::call('down');
// Add Log message
Log::info("Application is down, pausing queue while maintenance happens.");
// Loop, waiting for app to come back up
while (App::isDownForMaintenance()) {
echo ".";
sleep(5);
}
// App is back online, kill worker to restart daemon.
Log::info("Application is up, rebooting queue.");
Artisan::call('queue:restart');
$job->delete();
});
// Wait until Maintenance Mode enabled.
while (!App::isDownForMaintenance()) {
sleep(1);
}
$this->info("Application maintenance mode enabled.");
}
示例2: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
if (!$this->verifyInstalled() || $this->hasRunningDeployments() || $this->composerOutdated() || $this->nodeOutdated() || !$this->checkRequirements()) {
return -1;
}
$bring_back_up = false;
if (!App::isDownForMaintenance()) {
$this->error(Lang::get('app.not_down'));
if (!$this->confirm(Lang::get('app.switch_down'))) {
return;
}
$bring_back_up = true;
$this->call('down');
}
$this->backupDatabase();
$this->updateConfiguration();
$this->clearCaches();
$this->migrate();
$this->optimize();
$this->restartQueue();
$this->restartSocket();
// If we prompted the user to bring the app down, bring it back up
if ($bring_back_up) {
$this->call('up');
}
}
示例3: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
if (App::isDownForMaintenance()) {
throw new HttpException(503);
}
return $next($request);
}
示例4: handle
/**
* Execute the console command.
*/
public function handle()
{
$bring_back_up = false;
// Check the app is offline, if not ask the user if it can be brought down
if (!App::isDownForMaintenance()) {
$this->error(Lang::get('app.not_down'));
if (!$this->confirm(Lang::get('app.switch_down'))) {
return;
}
$bring_back_up = true;
$this->call('down');
}
$this->cleanupDeployments();
// If we prompted the user to bring the app down, bring it back up
if ($bring_back_up) {
$this->call('up');
}
}