Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96132348
PhabricatorMetaMTAListController.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:32
Size
2 KB
Mime Type
text/x-php
Expires
Tue, Dec 24, 23:32 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23129278
Attached To
rPH Phabricator
PhabricatorMetaMTAListController.php
View Options
<?php
final
class
PhabricatorMetaMTAListController
extends
PhabricatorMetaMTAController
{
public
function
processRequest
()
{
// Get a page of mails together with pager.
$request
=
$this
->
getRequest
();
$user
=
$request
->
getUser
();
$offset
=
$request
->
getInt
(
'offset'
,
0
);
$related_phid
=
$request
->
getStr
(
'phid'
);
$status
=
$request
->
getStr
(
'status'
);
$pager
=
new
AphrontPagerView
();
$pager
->
setOffset
(
$offset
);
$pager
->
setURI
(
$request
->
getRequestURI
(),
'offset'
);
$mail
=
new
PhabricatorMetaMTAMail
();
$conn_r
=
$mail
->
establishConnection
(
'r'
);
$wheres
=
array
();
if
(
$status
)
{
$wheres
[]
=
qsprintf
(
$conn_r
,
'status = %s'
,
$status
);
}
if
(
$related_phid
)
{
$wheres
[]
=
qsprintf
(
$conn_r
,
'relatedPHID = %s'
,
$related_phid
);
}
if
(
count
(
$wheres
))
{
$where_clause
=
'WHERE '
.
implode
(
$wheres
,
' AND '
);
}
else
{
$where_clause
=
'WHERE 1 = 1'
;
}
$data
=
queryfx_all
(
$conn_r
,
'SELECT * FROM %T
%Q
ORDER BY id DESC
LIMIT %d, %d'
,
$mail
->
getTableName
(),
$where_clause
,
$pager
->
getOffset
(),
$pager
->
getPageSize
()
+
1
);
$data
=
$pager
->
sliceResults
(
$data
);
$mails
=
$mail
->
loadAllFromArray
(
$data
);
// Render the details table.
$rows
=
array
();
foreach
(
$mails
as
$mail
)
{
$next_retry
=
$mail
->
getNextRetry
()
-
time
();
if
(
$next_retry
<=
0
)
{
$next_retry
=
"None"
;
}
else
{
$next_retry
=
phabricator_format_relative_time_detailed
(
$next_retry
);
}
$rows
[]
=
array
(
PhabricatorMetaMTAMail
::
getReadableStatus
(
$mail
->
getStatus
()),
$mail
->
getRetryCount
(),
$next_retry
,
phabricator_datetime
(
$mail
->
getDateCreated
(),
$user
),
phabricator_format_relative_time_detailed
(
time
()
-
$mail
->
getDateModified
()),
$mail
->
getSubject
(),
phutil_tag
(
'a'
,
array
(
'class'
=>
'button small grey'
,
'href'
=>
$this
->
getApplicationURI
(
'/view/'
.
$mail
->
getID
().
'/'
),
),
pht
(
'View'
)),
);
}
$table
=
new
AphrontTableView
(
$rows
);
$table
->
setHeaders
(
array
(
pht
(
'Status'
),
pht
(
'Retry'
),
pht
(
'Next'
),
pht
(
'Created'
),
pht
(
'Updated'
),
pht
(
'Subject'
),
''
,
));
$table
->
setColumnClasses
(
array
(
null
,
null
,
null
,
null
,
null
,
'wide'
,
'action'
,
));
// Render the whole page.
$panel
=
new
AphrontPanelView
();
$panel
->
appendChild
(
$table
);
$panel
->
setHeader
(
pht
(
'MetaMTA Messages'
));
$panel
->
appendChild
(
$pager
);
$panel
->
setNoBackground
();
$nav
=
$this
->
buildSideNavView
();
$nav
->
selectFilter
(
'sent'
);
$nav
->
appendChild
(
$panel
);
return
$this
->
buildApplicationPage
(
$nav
,
array
(
'title'
=>
pht
(
'Sent Mail'
),
'device'
=>
true
,
));
}
}
Event Timeline
Log In to Comment