Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2353671
PhabricatorNotificationStatusController.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
PhabricatorNotificationStatusController.php
View Options
<?php
final
class
PhabricatorNotificationStatusController
extends
PhabricatorNotificationController
{
public
function
processRequest
()
{
$uri
=
PhabricatorEnv
::
getEnvConfig
(
'notification.server-uri'
);
$uri
=
new
PhutilURI
(
$uri
);
$uri
->
setPath
(
'/status/'
);
$future
=
id
(
new
HTTPSFuture
(
$uri
))
->
setTimeout
(
3
);
try
{
list
(
$body
)
=
$future
->
resolvex
();
$body
=
json_decode
(
$body
,
true
);
if
(!
is_array
(
$body
))
{
throw
new
Exception
(
"Expected JSON response from server!"
);
}
$status
=
$this
->
renderServerStatus
(
$body
);
}
catch
(
Exception
$ex
)
{
$status
=
new
AphrontErrorView
();
$status
->
setTitle
(
"Notification Server Issue"
);
$status
->
appendChild
(
hsprintf
(
'Unable to determine server status. This probably means the server '
.
'is not in great shape. The specific issue encountered was:'
.
'<br />'
.
'<br />'
.
'<strong>%s</strong> %s'
,
get_class
(
$ex
),
phutil_escape_html_newlines
(
$ex
->
getMessage
())));
}
return
$this
->
buildStandardPageResponse
(
$status
,
array
(
'title'
=>
'Aphlict Server Status'
,
));
}
private
function
renderServerStatus
(
array
$status
)
{
$rows
=
array
();
foreach
(
$status
as
$key
=>
$value
)
{
$label
=
phutil_escape_html
(
$key
);
switch
(
$key
)
{
case
'uptime'
:
$value
/=
1000
;
$value
=
phabricator_format_relative_time_detailed
(
$value
);
break
;
case
'log'
:
$value
=
phutil_escape_html
(
$value
);
break
;
default
:
$value
=
phutil_escape_html
(
number_format
(
$value
));
break
;
}
$rows
[]
=
array
(
$label
,
$value
);
}
$table
=
new
AphrontTableView
(
$rows
);
$table
->
setColumnClasses
(
array
(
'header'
,
'wide'
,
));
$panel
=
new
AphrontPanelView
();
$panel
->
setHeader
(
'Server Status'
);
$panel
->
appendChild
(
$table
);
return
$panel
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Sep 16, 1:09 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
443571
Default Alt Text
PhabricatorNotificationStatusController.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment