Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96132190
PhabricatorSMSManagementShowOutboundWorkflow.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Dec 22, 23:29
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Dec 24, 23:29 (2 d)
Engine
blob
Format
Raw Data
Handle
23128872
Attached To
rPH Phabricator
PhabricatorSMSManagementShowOutboundWorkflow.php
View Options
<?php
final
class
PhabricatorSMSManagementShowOutboundWorkflow
extends
PhabricatorSMSManagementWorkflow
{
protected
function
didConstruct
()
{
$this
->
setName
(
'show-outbound'
)
->
setSynopsis
(
'Show diagnostic details about outbound sms.'
)
->
setExamples
(
"**show-outbound** --id 1 --id 2"
)
->
setArguments
(
array
(
array
(
'name'
=>
'id'
,
'param'
=>
'id'
,
'help'
=>
'Show details about outbound sms with given ID.'
,
'repeat'
=>
true
,
),
));
}
public
function
execute
(
PhutilArgumentParser
$args
)
{
$console
=
PhutilConsole
::
getConsole
();
$ids
=
$args
->
getArg
(
'id'
);
if
(!
$ids
)
{
throw
new
PhutilArgumentUsageException
(
"Use the '--id' flag to specify one or more sms messages to show."
);
}
$messages
=
id
(
new
PhabricatorSMS
())->
loadAllWhere
(
'id IN (%Ld)'
,
$ids
);
if
(
$ids
)
{
$ids
=
array_fuse
(
$ids
);
$missing
=
array_diff_key
(
$ids
,
$messages
);
if
(
$missing
)
{
throw
new
PhutilArgumentUsageException
(
"Some specified sms messages do not exist: "
.
implode
(
', '
,
array_keys
(
$missing
)));
}
}
$last_key
=
last_key
(
$messages
);
foreach
(
$messages
as
$message_key
=>
$message
)
{
$info
=
array
();
$info
[]
=
pht
(
'PROPERTIES'
);
$info
[]
=
pht
(
'ID: %d'
,
$message
->
getID
());
$info
[]
=
pht
(
'Status: %s'
,
$message
->
getSendStatus
());
$info
[]
=
pht
(
'To: %s'
,
$message
->
getToNumber
());
$info
[]
=
pht
(
'From: %s'
,
$message
->
getFromNumber
());
$info
[]
=
null
;
$info
[]
=
pht
(
'BODY'
);
$info
[]
=
$message
->
getBody
();
$info
[]
=
null
;
$console
->
writeOut
(
'%s'
,
implode
(
"
\n
"
,
$info
));
if
(
$message_key
!=
$last_key
)
{
$console
->
writeOut
(
"
\n
%s
\n\n
"
,
str_repeat
(
'-'
,
80
));
}
}
}
}
Event Timeline
Log In to Comment