Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93012150
PhrictionHistoryConduitAPIMethod.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
Mon, Nov 25, 14:03
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Nov 27, 14:03 (2 d)
Engine
blob
Format
Raw Data
Handle
22557431
Attached To
rPH Phabricator
PhrictionHistoryConduitAPIMethod.php
View Options
<?php
final
class
PhrictionHistoryConduitAPIMethod
extends
PhrictionConduitAPIMethod
{
public
function
getAPIMethodName
()
{
return
'phriction.history'
;
}
public
function
getMethodDescription
()
{
return
pht
(
'Retrieve history about a Phriction document.'
);
}
protected
function
defineParamTypes
()
{
return
array
(
'slug'
=>
'required string'
,
);
}
protected
function
defineReturnType
()
{
return
'nonempty list'
;
}
protected
function
defineErrorTypes
()
{
return
array
(
'ERR-BAD-DOCUMENT'
=>
pht
(
'No such document exists.'
),
);
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$slug
=
$request
->
getValue
(
'slug'
);
$doc
=
id
(
new
PhrictionDocumentQuery
())
->
setViewer
(
$request
->
getUser
())
->
withSlugs
(
array
(
PhabricatorSlug
::
normalize
(
$slug
)))
->
executeOne
();
if
(!
$doc
)
{
throw
new
ConduitException
(
'ERR-BAD-DOCUMENT'
);
}
$content
=
id
(
new
PhrictionContent
())->
loadAllWhere
(
'documentID = %d ORDER BY version DESC'
,
$doc
->
getID
());
$results
=
array
();
foreach
(
$content
as
$version
)
{
$results
[]
=
$this
->
buildDocumentContentDictionary
(
$doc
,
$version
);
}
return
$results
;
}
}
Event Timeline
Log In to Comment