Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2484948
PingCommand.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PingCommand.php
View Options
<?php
namespace
App\Console\Commands\DB
;
use
Illuminate\Console\Command
;
use
Illuminate\Support\Facades\DB
;
class
PingCommand
extends
Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected
$signature
=
'db:ping {--wait}'
;
/**
* The console command description.
*
* @var string
*/
protected
$description
=
'Ping the database [and wait for it to respond]'
;
/**
* Execute the console command.
*
* @return mixed
*/
public
function
handle
()
{
if
(
$this
->
option
(
'wait'
))
{
while
(
true
)
{
try
{
$result
=
DB
::
select
(
"SELECT 1"
);
if
(
sizeof
(
$result
)
>
0
)
{
break
;
}
}
catch
(
\Exception
$exception
)
{
sleep
(
1
);
}
}
}
else
{
try
{
$result
=
DB
::
select
(
"SELECT 1"
);
return
0
;
}
catch
(
\Exception
$exception
)
{
return
1
;
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Nov 20, 4:16 PM (16 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
387196
Default Alt Text
PingCommand.php (1 KB)
Attached To
Mode
R2 kolab
Attached
Detach File
Event Timeline
Log In to Comment