Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91551277
PhabricatorMetaMTAWorker.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
Tue, Nov 12, 03:42
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Nov 14, 03:42 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22282151
Attached To
rPH Phabricator
PhabricatorMetaMTAWorker.php
View Options
<?php
final
class
PhabricatorMetaMTAWorker
extends
PhabricatorWorker
{
private
$message
;
public
function
getWaitBeforeRetry
(
PhabricatorWorkerTask
$task
)
{
$message
=
$this
->
loadMessage
();
if
(!
$message
)
{
return
null
;
}
$wait
=
max
(
$message
->
getNextRetry
()
-
time
(),
0
)
+
15
;
return
$wait
;
}
public
function
doWork
()
{
$message
=
$this
->
loadMessage
();
if
(!
$message
||
$message
->
getStatus
()
!=
PhabricatorMetaMTAMail
::
STATUS_QUEUE
)
{
return
;
}
$id
=
$message
->
getID
();
$message
->
sendNow
();
// task failed if the message is still queued
// (instead of sent, void, or failed)
if
(
$message
->
getStatus
()
==
PhabricatorMetaMTAMail
::
STATUS_QUEUE
)
{
throw
new
Exception
(
'Failed to send message'
);
}
}
private
function
loadMessage
()
{
if
(!
$this
->
message
)
{
$message_id
=
$this
->
getTaskData
();
$this
->
message
=
id
(
new
PhabricatorMetaMTAMail
())->
load
(
$message_id
);
if
(!
$this
->
message
)
{
return
null
;
}
}
return
$this
->
message
;
}
public
function
renderForDisplay
()
{
return
phutil_tag
(
'a'
,
array
(
'href'
=>
'/mail/view/'
.
$this
->
getTaskData
().
'/'
),
$this
->
getTaskData
());
}
}
Event Timeline
Log In to Comment