mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-23 20:19:03 +01:00
Summary: `pht`ize a whole bunch of strings in rP. Test Plan: Intense eyeballing. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: hach-que, Korvin, epriestley Differential Revision: https://secure.phabricator.com/D12797
53 lines
1.2 KiB
PHP
53 lines
1.2 KiB
PHP
<?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;
|
|
}
|
|
|
|
}
|