Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13957232
D14898.id36011.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
11 KB
Referenced Files
None
Subscribers
None
D14898.id36011.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -3417,10 +3417,8 @@
'PhameBlogTransaction' => 'applications/phame/storage/PhameBlogTransaction.php',
'PhameBlogTransactionQuery' => 'applications/phame/query/PhameBlogTransactionQuery.php',
'PhameBlogViewController' => 'applications/phame/controller/blog/PhameBlogViewController.php',
- 'PhameConduitAPIMethod' => 'applications/phame/conduit/PhameConduitAPIMethod.php',
'PhameConstants' => 'applications/phame/constants/PhameConstants.php',
'PhameController' => 'applications/phame/controller/PhameController.php',
- 'PhameCreatePostConduitAPIMethod' => 'applications/phame/conduit/PhameCreatePostConduitAPIMethod.php',
'PhameDAO' => 'applications/phame/storage/PhameDAO.php',
'PhameDescriptionView' => 'applications/phame/view/PhameDescriptionView.php',
'PhameDraftListView' => 'applications/phame/view/PhameDraftListView.php',
@@ -3445,8 +3443,6 @@
'PhamePostTransactionComment' => 'applications/phame/storage/PhamePostTransactionComment.php',
'PhamePostTransactionQuery' => 'applications/phame/query/PhamePostTransactionQuery.php',
'PhamePostViewController' => 'applications/phame/controller/post/PhamePostViewController.php',
- 'PhameQueryConduitAPIMethod' => 'applications/phame/conduit/PhameQueryConduitAPIMethod.php',
- 'PhameQueryPostsConduitAPIMethod' => 'applications/phame/conduit/PhameQueryPostsConduitAPIMethod.php',
'PhameSchemaSpec' => 'applications/phame/storage/PhameSchemaSpec.php',
'PhameSite' => 'applications/phame/site/PhameSite.php',
'PhluxController' => 'applications/phlux/controller/PhluxController.php',
@@ -7868,10 +7864,8 @@
'PhameBlogTransaction' => 'PhabricatorApplicationTransaction',
'PhameBlogTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PhameBlogViewController' => 'PhameLiveController',
- 'PhameConduitAPIMethod' => 'ConduitAPIMethod',
'PhameConstants' => 'Phobject',
'PhameController' => 'PhabricatorController',
- 'PhameCreatePostConduitAPIMethod' => 'PhameConduitAPIMethod',
'PhameDAO' => 'PhabricatorLiskDAO',
'PhameDescriptionView' => 'AphrontTagView',
'PhameDraftListView' => 'AphrontTagView',
@@ -7906,8 +7900,6 @@
'PhamePostTransactionComment' => 'PhabricatorApplicationTransactionComment',
'PhamePostTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PhamePostViewController' => 'PhameLiveController',
- 'PhameQueryConduitAPIMethod' => 'PhameConduitAPIMethod',
- 'PhameQueryPostsConduitAPIMethod' => 'PhameConduitAPIMethod',
'PhameSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhameSite' => 'PhabricatorSite',
'PhluxController' => 'PhabricatorController',
diff --git a/src/applications/phame/conduit/PhameConduitAPIMethod.php b/src/applications/phame/conduit/PhameConduitAPIMethod.php
deleted file mode 100644
--- a/src/applications/phame/conduit/PhameConduitAPIMethod.php
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-
-abstract class PhameConduitAPIMethod extends ConduitAPIMethod {
-
- final public function getApplication() {
- return PhabricatorApplication::getByClass('PhabricatorPhameApplication');
- }
-
-}
diff --git a/src/applications/phame/conduit/PhameCreatePostConduitAPIMethod.php b/src/applications/phame/conduit/PhameCreatePostConduitAPIMethod.php
deleted file mode 100644
--- a/src/applications/phame/conduit/PhameCreatePostConduitAPIMethod.php
+++ /dev/null
@@ -1,97 +0,0 @@
-<?php
-
-final class PhameCreatePostConduitAPIMethod extends PhameConduitAPIMethod {
-
- public function getAPIMethodName() {
- return 'phame.createpost';
- }
-
- public function getMethodDescription() {
- return pht('Create a phame post.');
- }
-
- public function getMethodStatus() {
- return self::METHOD_STATUS_UNSTABLE;
- }
-
- protected function defineParamTypes() {
- return array(
- 'blogPHID' => 'required phid',
- 'title' => 'required string',
- 'body' => 'required string',
- 'bloggerPHID' => 'optional phid',
- 'isDraft' => 'optional bool',
- );
- }
-
- protected function defineReturnType() {
- return 'list<dict>';
- }
-
- protected function defineErrorTypes() {
- return array(
- 'ERR-INVALID-PARAMETER' =>
- pht('Missing or malformed parameter.'),
- 'ERR-INVALID-BLOG' =>
- pht('Invalid blog PHID or user can not post to blog.'),
- );
- }
-
- protected function execute(ConduitAPIRequest $request) {
- $user = $request->getUser();
- $blog_phid = $request->getValue('blogPHID');
- $title = $request->getValue('title');
- $body = $request->getValue('body');
- $exception_description = array();
- if (!$blog_phid) {
- $exception_description[] = pht('No blog phid.');
- }
- if (!strlen($title)) {
- $exception_description[] = pht('No post title.');
- }
- if (!strlen($body)) {
- $exception_description[] = pht('No post body.');
- }
- if ($exception_description) {
- throw id(new ConduitException('ERR-INVALID-PARAMETER'))
- ->setErrorDescription(implode("\n", $exception_description));
- }
-
- $blogger_phid = $request->getValue('bloggerPHID');
- if ($blogger_phid) {
- $blogger = id(new PhabricatorPeopleQuery())
- ->setViewer($user)
- ->withPHIDs(array($blogger_phid))
- ->executeOne();
- } else {
- $blogger = $user;
- }
-
- $blog = id(new PhameBlogQuery())
- ->setViewer($blogger)
- ->withPHIDs(array($blog_phid))
- ->requireCapabilities(
- array(
- PhabricatorPolicyCapability::CAN_VIEW,
- PhabricatorPolicyCapability::CAN_EDIT,
- ))
- ->executeOne();
-
- if (!$blog) {
- throw new ConduitException('ERR-INVALID-BLOG');
- }
-
- $post = PhamePost::initializePost($blogger, $blog);
- $is_draft = $request->getValue('isDraft', false);
- if (!$is_draft) {
- $post->setDatePublished(time());
- $post->setVisibility(PhameConstants::VISIBILITY_PUBLISHED);
- }
- $post->setTitle($title);
- $post->setBody($body);
- $post->save();
-
- return $post->toDictionary();
- }
-
-}
diff --git a/src/applications/phame/conduit/PhameQueryConduitAPIMethod.php b/src/applications/phame/conduit/PhameQueryConduitAPIMethod.php
deleted file mode 100644
--- a/src/applications/phame/conduit/PhameQueryConduitAPIMethod.php
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-
-final class PhameQueryConduitAPIMethod extends PhameConduitAPIMethod {
-
- public function getAPIMethodName() {
- return 'phame.query';
- }
-
- public function getMethodDescription() {
- return pht('Query phame blogs.');
- }
-
- public function getMethodStatus() {
- return self::METHOD_STATUS_UNSTABLE;
- }
-
- protected function defineParamTypes() {
- return array(
- 'ids' => 'optional list<int>',
- 'phids' => 'optional list<phid>',
- 'after' => 'optional int',
- 'before' => 'optional int',
- 'limit' => 'optional int',
- );
- }
-
- protected function defineReturnType() {
- return 'list<dict>';
- }
-
- protected function execute(ConduitAPIRequest $request) {
- $query = new PhameBlogQuery();
-
- $query->setViewer($request->getUser());
-
- $ids = $request->getValue('ids', array());
- if ($ids) {
- $query->withIDs($ids);
- }
-
- $phids = $request->getValue('phids', array());
- if ($phids) {
- $query->withPHIDs($phids);
- }
-
- $after = $request->getValue('after', null);
- if ($after !== null) {
- $query->setAfterID($after);
- }
-
- $before = $request->getValue('before', null);
- if ($before !== null) {
- $query->setBeforeID($before);
- }
-
- $limit = $request->getValue('limit', null);
- if ($limit !== null) {
- $query->setLimit($limit);
- }
-
- $blogs = $query->execute();
-
- $results = array();
- foreach ($blogs as $blog) {
- $results[] = array(
- 'id' => $blog->getID(),
- 'phid' => $blog->getPHID(),
- 'name' => $blog->getName(),
- 'description' => $blog->getDescription(),
- 'domain' => $blog->getDomain(),
- 'creatorPHID' => $blog->getCreatorPHID(),
- );
- }
-
- return $results;
- }
-
-}
diff --git a/src/applications/phame/conduit/PhameQueryPostsConduitAPIMethod.php b/src/applications/phame/conduit/PhameQueryPostsConduitAPIMethod.php
deleted file mode 100644
--- a/src/applications/phame/conduit/PhameQueryPostsConduitAPIMethod.php
+++ /dev/null
@@ -1,97 +0,0 @@
-<?php
-
-final class PhameQueryPostsConduitAPIMethod extends PhameConduitAPIMethod {
-
- public function getAPIMethodName() {
- return 'phame.queryposts';
- }
-
- public function getMethodDescription() {
- return pht('Query phame posts.');
- }
-
- public function getMethodStatus() {
- return self::METHOD_STATUS_UNSTABLE;
- }
-
- protected function defineParamTypes() {
- return array(
- 'ids' => 'optional list<int>',
- 'phids' => 'optional list<phid>',
- 'blogPHIDs' => 'optional list<phid>',
- 'bloggerPHIDs' => 'optional list<phid>',
- 'published' => 'optional bool',
- 'publishedAfter' => 'optional date',
- 'before' => 'optional int',
- 'after' => 'optional int',
- 'limit' => 'optional int',
- );
- }
-
- protected function defineReturnType() {
- return 'list<dict>';
- }
-
- protected function execute(ConduitAPIRequest $request) {
- $query = new PhamePostQuery();
-
- $query->setViewer($request->getUser());
-
- $ids = $request->getValue('ids', array());
- if ($ids) {
- $query->withIDs($ids);
- }
-
- $phids = $request->getValue('phids', array());
- if ($phids) {
- $query->withPHIDs($phids);
- }
-
- $blog_phids = $request->getValue('blogPHIDs', array());
- if ($blog_phids) {
- $query->withBlogPHIDs($blog_phids);
- }
-
- $blogger_phids = $request->getValue('bloggerPHIDs', array());
- if ($blogger_phids) {
- $query->withBloggerPHIDs($blogger_phids);
- }
-
- $published = $request->getValue('published', null);
- if ($published === true) {
- $query->withVisibility(PhameConstants::VISIBILITY_PUBLISHED);
- } else if ($published === false) {
- $query->withVisibility(PhameConstants::VISIBILITY_DRAFT);
- }
-
- $published_after = $request->getValue('publishedAfter', null);
- if ($published_after !== null) {
- $query->withPublishedAfter($published_after);
- }
-
- $after = $request->getValue('after', null);
- if ($after !== null) {
- $query->setAfterID($after);
- }
-
- $before = $request->getValue('before', null);
- if ($before !== null) {
- $query->setBeforeID($before);
- }
-
- $limit = $request->getValue('limit', null);
- if ($limit !== null) {
- $query->setLimit($limit);
- }
-
- $posts = $query->execute();
-
- $results = array();
- foreach ($posts as $post) {
- $results[] = $post->toDictionary();
- }
-
- return $results;
- }
-
-}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Oct 15, 9:08 AM (2 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6712194
Default Alt Text
D14898.id36011.diff (11 KB)
Attached To
Mode
D14898: Remove previous-generation Phame Conduit API methods
Attached
Detach File
Event Timeline
Log In to Comment