Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2893119
PhabricatorConduitTokenQuery.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
2 KB
Referenced Files
None
Subscribers
None
PhabricatorConduitTokenQuery.php
View Options
<?php
final
class
PhabricatorConduitTokenQuery
extends
PhabricatorCursorPagedPolicyAwareQuery
{
private
$ids
;
private
$objectPHIDs
;
private
$expired
;
private
$tokens
;
private
$tokenTypes
;
public
function
withExpired
(
$expired
)
{
$this
->
expired
=
$expired
;
return
$this
;
}
public
function
withIDs
(
array
$ids
)
{
$this
->
ids
=
$ids
;
return
$this
;
}
public
function
withObjectPHIDs
(
array
$phids
)
{
$this
->
objectPHIDs
=
$phids
;
return
$this
;
}
public
function
withTokens
(
array
$tokens
)
{
$this
->
tokens
=
$tokens
;
return
$this
;
}
public
function
withTokenTypes
(
array
$types
)
{
$this
->
tokenTypes
=
$types
;
return
$this
;
}
public
function
newResultObject
(
)
{
return
new
PhabricatorConduitToken
(
)
;
}
protected
function
buildWhereClauseParts
(
AphrontDatabaseConnection
$conn
)
{
$where
=
parent
::
buildWhereClauseParts
(
$conn
)
;
if
(
$this
->
ids
!==
null
)
{
$where
[
]
=
qsprintf
(
$conn
,
'id IN (%Ld)'
,
$this
->
ids
)
;
}
if
(
$this
->
objectPHIDs
!==
null
)
{
$where
[
]
=
qsprintf
(
$conn
,
'objectPHID IN (%Ls)'
,
$this
->
objectPHIDs
)
;
}
if
(
$this
->
tokens
!==
null
)
{
$where
[
]
=
qsprintf
(
$conn
,
'token IN (%Ls)'
,
$this
->
tokens
)
;
}
if
(
$this
->
tokenTypes
!==
null
)
{
$where
[
]
=
qsprintf
(
$conn
,
'tokenType IN (%Ls)'
,
$this
->
tokenTypes
)
;
}
if
(
$this
->
expired
!==
null
)
{
if
(
$this
->
expired
)
{
$where
[
]
=
qsprintf
(
$conn
,
'expires <= %d'
,
PhabricatorTime
::
getNow
(
)
)
;
}
else
{
$where
[
]
=
qsprintf
(
$conn
,
'expires IS NULL OR expires > %d'
,
PhabricatorTime
::
getNow
(
)
)
;
}
}
return
$where
;
}
protected
function
willFilterPage
(
array
$tokens
)
{
$object_phids
=
mpull
(
$tokens
,
'getObjectPHID'
)
;
$objects
=
id
(
new
PhabricatorObjectQuery
(
)
)
->
setViewer
(
$this
->
getViewer
(
)
)
->
setParentQuery
(
$this
)
->
withPHIDs
(
$object_phids
)
->
execute
(
)
;
$objects
=
mpull
(
$objects
,
null
,
'getPHID'
)
;
foreach
(
$tokens
as
$key
=>
$token
)
{
$object
=
idx
(
$objects
,
$token
->
getObjectPHID
(
)
,
null
)
;
if
(
!
$object
)
{
$this
->
didRejectResult
(
$token
)
;
unset
(
$tokens
[
$key
]
)
;
continue
;
}
$token
->
attachObject
(
$object
)
;
}
return
$tokens
;
}
public
function
getQueryApplicationClass
(
)
{
return
PhabricatorConduitApplication
::
class
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 17:53 (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1123966
Default Alt Text
PhabricatorConduitTokenQuery.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment