Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96504707
PhabricatorMetaMTAMailQuery.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
Fri, Dec 27, 09:10
Size
2 KB
Mime Type
text/x-php
Expires
Sun, Dec 29, 09:10 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23195196
Attached To
rPH Phabricator
PhabricatorMetaMTAMailQuery.php
View Options
<?php
final
class
PhabricatorMetaMTAMailQuery
extends
PhabricatorCursorPagedPolicyAwareQuery
{
private
$ids
;
private
$phids
;
private
$actorPHIDs
;
private
$recipientPHIDs
;
public
function
withIDs
(
array
$ids
)
{
$this
->
ids
=
$ids
;
return
$this
;
}
public
function
withPHIDs
(
array
$phids
)
{
$this
->
phids
=
$phids
;
return
$this
;
}
public
function
withActorPHIDs
(
array
$phids
)
{
$this
->
actorPHIDs
=
$phids
;
return
$this
;
}
public
function
withRecipientPHIDs
(
array
$phids
)
{
$this
->
recipientPHIDs
=
$phids
;
return
$this
;
}
protected
function
loadPage
()
{
return
$this
->
loadStandardPage
(
$this
->
newResultObject
());
}
protected
function
buildWhereClause
(
AphrontDatabaseConnection
$conn_r
)
{
$where
=
array
();
if
(
$this
->
ids
!==
null
)
{
$where
[]
=
qsprintf
(
$conn_r
,
'mail.id IN (%Ld)'
,
$this
->
ids
);
}
if
(
$this
->
phids
!==
null
)
{
$where
[]
=
qsprintf
(
$conn_r
,
'mail.phid IN (%Ls)'
,
$this
->
phids
);
}
if
(
$this
->
actorPHIDs
!==
null
)
{
$where
[]
=
qsprintf
(
$conn_r
,
'mail.actorPHID IN (%Ls)'
,
$this
->
actorPHIDs
);
}
if
(
$this
->
recipientPHIDs
!==
null
)
{
$where
[]
=
qsprintf
(
$conn_r
,
'recipient.dst IN (%Ls)'
,
$this
->
recipientPHIDs
);
}
$viewer
=
$this
->
getViewer
();
$where
[]
=
qsprintf
(
$conn_r
,
'edge.dst = %s OR actorPHID = %s'
,
$viewer
->
getPHID
(),
$viewer
->
getPHID
());
$where
[]
=
$this
->
buildPagingClause
(
$conn_r
);
return
$this
->
formatWhereClause
(
$where
);
}
protected
function
buildJoinClause
(
AphrontDatabaseConnection
$conn
)
{
$joins
=
array
();
$joins
[]
=
qsprintf
(
$conn
,
'LEFT JOIN %T edge ON mail.phid = edge.src AND edge.type = %d'
,
PhabricatorEdgeConfig
::
TABLE_NAME_EDGE
,
PhabricatorMetaMTAMailHasRecipientEdgeType
::
EDGECONST
);
if
(
$this
->
recipientPHIDs
!==
null
)
{
$joins
[]
=
qsprintf
(
$conn
,
'LEFT JOIN %T recipient '
.
'ON mail.phid = recipient.src AND recipient.type = %d'
,
PhabricatorEdgeConfig
::
TABLE_NAME_EDGE
,
PhabricatorMetaMTAMailHasRecipientEdgeType
::
EDGECONST
);
}
return
implode
(
' '
,
$joins
);
}
protected
function
getPrimaryTableAlias
()
{
return
'mail'
;
}
public
function
newResultObject
()
{
return
new
PhabricatorMetaMTAMail
();
}
public
function
getQueryApplicationClass
()
{
return
'PhabricatorMetaMTAApplication'
;
}
}
Event Timeline
Log In to Comment