@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Remove previous-generation Phame Conduit API methods

Summary: Ref T9897. We can now provide modern `search` and `edit` endpoints (I'll do this next).

Test Plan: Grepped for removed methods.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9897

Differential Revision: https://secure.phabricator.com/D14898

-289
-8
src/__phutil_library_map__.php
··· 3417 3417 'PhameBlogTransaction' => 'applications/phame/storage/PhameBlogTransaction.php', 3418 3418 'PhameBlogTransactionQuery' => 'applications/phame/query/PhameBlogTransactionQuery.php', 3419 3419 'PhameBlogViewController' => 'applications/phame/controller/blog/PhameBlogViewController.php', 3420 - 'PhameConduitAPIMethod' => 'applications/phame/conduit/PhameConduitAPIMethod.php', 3421 3420 'PhameConstants' => 'applications/phame/constants/PhameConstants.php', 3422 3421 'PhameController' => 'applications/phame/controller/PhameController.php', 3423 - 'PhameCreatePostConduitAPIMethod' => 'applications/phame/conduit/PhameCreatePostConduitAPIMethod.php', 3424 3422 'PhameDAO' => 'applications/phame/storage/PhameDAO.php', 3425 3423 'PhameDescriptionView' => 'applications/phame/view/PhameDescriptionView.php', 3426 3424 'PhameDraftListView' => 'applications/phame/view/PhameDraftListView.php', ··· 3445 3443 'PhamePostTransactionComment' => 'applications/phame/storage/PhamePostTransactionComment.php', 3446 3444 'PhamePostTransactionQuery' => 'applications/phame/query/PhamePostTransactionQuery.php', 3447 3445 'PhamePostViewController' => 'applications/phame/controller/post/PhamePostViewController.php', 3448 - 'PhameQueryConduitAPIMethod' => 'applications/phame/conduit/PhameQueryConduitAPIMethod.php', 3449 - 'PhameQueryPostsConduitAPIMethod' => 'applications/phame/conduit/PhameQueryPostsConduitAPIMethod.php', 3450 3446 'PhameSchemaSpec' => 'applications/phame/storage/PhameSchemaSpec.php', 3451 3447 'PhameSite' => 'applications/phame/site/PhameSite.php', 3452 3448 'PhluxController' => 'applications/phlux/controller/PhluxController.php', ··· 7868 7864 'PhameBlogTransaction' => 'PhabricatorApplicationTransaction', 7869 7865 'PhameBlogTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 7870 7866 'PhameBlogViewController' => 'PhameLiveController', 7871 - 'PhameConduitAPIMethod' => 'ConduitAPIMethod', 7872 7867 'PhameConstants' => 'Phobject', 7873 7868 'PhameController' => 'PhabricatorController', 7874 - 'PhameCreatePostConduitAPIMethod' => 'PhameConduitAPIMethod', 7875 7869 'PhameDAO' => 'PhabricatorLiskDAO', 7876 7870 'PhameDescriptionView' => 'AphrontTagView', 7877 7871 'PhameDraftListView' => 'AphrontTagView', ··· 7906 7900 'PhamePostTransactionComment' => 'PhabricatorApplicationTransactionComment', 7907 7901 'PhamePostTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 7908 7902 'PhamePostViewController' => 'PhameLiveController', 7909 - 'PhameQueryConduitAPIMethod' => 'PhameConduitAPIMethod', 7910 - 'PhameQueryPostsConduitAPIMethod' => 'PhameConduitAPIMethod', 7911 7903 'PhameSchemaSpec' => 'PhabricatorConfigSchemaSpec', 7912 7904 'PhameSite' => 'PhabricatorSite', 7913 7905 'PhluxController' => 'PhabricatorController',
-9
src/applications/phame/conduit/PhameConduitAPIMethod.php
··· 1 - <?php 2 - 3 - abstract class PhameConduitAPIMethod extends ConduitAPIMethod { 4 - 5 - final public function getApplication() { 6 - return PhabricatorApplication::getByClass('PhabricatorPhameApplication'); 7 - } 8 - 9 - }
-97
src/applications/phame/conduit/PhameCreatePostConduitAPIMethod.php
··· 1 - <?php 2 - 3 - final class PhameCreatePostConduitAPIMethod extends PhameConduitAPIMethod { 4 - 5 - public function getAPIMethodName() { 6 - return 'phame.createpost'; 7 - } 8 - 9 - public function getMethodDescription() { 10 - return pht('Create a phame post.'); 11 - } 12 - 13 - public function getMethodStatus() { 14 - return self::METHOD_STATUS_UNSTABLE; 15 - } 16 - 17 - protected function defineParamTypes() { 18 - return array( 19 - 'blogPHID' => 'required phid', 20 - 'title' => 'required string', 21 - 'body' => 'required string', 22 - 'bloggerPHID' => 'optional phid', 23 - 'isDraft' => 'optional bool', 24 - ); 25 - } 26 - 27 - protected function defineReturnType() { 28 - return 'list<dict>'; 29 - } 30 - 31 - protected function defineErrorTypes() { 32 - return array( 33 - 'ERR-INVALID-PARAMETER' => 34 - pht('Missing or malformed parameter.'), 35 - 'ERR-INVALID-BLOG' => 36 - pht('Invalid blog PHID or user can not post to blog.'), 37 - ); 38 - } 39 - 40 - protected function execute(ConduitAPIRequest $request) { 41 - $user = $request->getUser(); 42 - $blog_phid = $request->getValue('blogPHID'); 43 - $title = $request->getValue('title'); 44 - $body = $request->getValue('body'); 45 - $exception_description = array(); 46 - if (!$blog_phid) { 47 - $exception_description[] = pht('No blog phid.'); 48 - } 49 - if (!strlen($title)) { 50 - $exception_description[] = pht('No post title.'); 51 - } 52 - if (!strlen($body)) { 53 - $exception_description[] = pht('No post body.'); 54 - } 55 - if ($exception_description) { 56 - throw id(new ConduitException('ERR-INVALID-PARAMETER')) 57 - ->setErrorDescription(implode("\n", $exception_description)); 58 - } 59 - 60 - $blogger_phid = $request->getValue('bloggerPHID'); 61 - if ($blogger_phid) { 62 - $blogger = id(new PhabricatorPeopleQuery()) 63 - ->setViewer($user) 64 - ->withPHIDs(array($blogger_phid)) 65 - ->executeOne(); 66 - } else { 67 - $blogger = $user; 68 - } 69 - 70 - $blog = id(new PhameBlogQuery()) 71 - ->setViewer($blogger) 72 - ->withPHIDs(array($blog_phid)) 73 - ->requireCapabilities( 74 - array( 75 - PhabricatorPolicyCapability::CAN_VIEW, 76 - PhabricatorPolicyCapability::CAN_EDIT, 77 - )) 78 - ->executeOne(); 79 - 80 - if (!$blog) { 81 - throw new ConduitException('ERR-INVALID-BLOG'); 82 - } 83 - 84 - $post = PhamePost::initializePost($blogger, $blog); 85 - $is_draft = $request->getValue('isDraft', false); 86 - if (!$is_draft) { 87 - $post->setDatePublished(time()); 88 - $post->setVisibility(PhameConstants::VISIBILITY_PUBLISHED); 89 - } 90 - $post->setTitle($title); 91 - $post->setBody($body); 92 - $post->save(); 93 - 94 - return $post->toDictionary(); 95 - } 96 - 97 - }
-78
src/applications/phame/conduit/PhameQueryConduitAPIMethod.php
··· 1 - <?php 2 - 3 - final class PhameQueryConduitAPIMethod extends PhameConduitAPIMethod { 4 - 5 - public function getAPIMethodName() { 6 - return 'phame.query'; 7 - } 8 - 9 - public function getMethodDescription() { 10 - return pht('Query phame blogs.'); 11 - } 12 - 13 - public function getMethodStatus() { 14 - return self::METHOD_STATUS_UNSTABLE; 15 - } 16 - 17 - protected function defineParamTypes() { 18 - return array( 19 - 'ids' => 'optional list<int>', 20 - 'phids' => 'optional list<phid>', 21 - 'after' => 'optional int', 22 - 'before' => 'optional int', 23 - 'limit' => 'optional int', 24 - ); 25 - } 26 - 27 - protected function defineReturnType() { 28 - return 'list<dict>'; 29 - } 30 - 31 - protected function execute(ConduitAPIRequest $request) { 32 - $query = new PhameBlogQuery(); 33 - 34 - $query->setViewer($request->getUser()); 35 - 36 - $ids = $request->getValue('ids', array()); 37 - if ($ids) { 38 - $query->withIDs($ids); 39 - } 40 - 41 - $phids = $request->getValue('phids', array()); 42 - if ($phids) { 43 - $query->withPHIDs($phids); 44 - } 45 - 46 - $after = $request->getValue('after', null); 47 - if ($after !== null) { 48 - $query->setAfterID($after); 49 - } 50 - 51 - $before = $request->getValue('before', null); 52 - if ($before !== null) { 53 - $query->setBeforeID($before); 54 - } 55 - 56 - $limit = $request->getValue('limit', null); 57 - if ($limit !== null) { 58 - $query->setLimit($limit); 59 - } 60 - 61 - $blogs = $query->execute(); 62 - 63 - $results = array(); 64 - foreach ($blogs as $blog) { 65 - $results[] = array( 66 - 'id' => $blog->getID(), 67 - 'phid' => $blog->getPHID(), 68 - 'name' => $blog->getName(), 69 - 'description' => $blog->getDescription(), 70 - 'domain' => $blog->getDomain(), 71 - 'creatorPHID' => $blog->getCreatorPHID(), 72 - ); 73 - } 74 - 75 - return $results; 76 - } 77 - 78 - }
-97
src/applications/phame/conduit/PhameQueryPostsConduitAPIMethod.php
··· 1 - <?php 2 - 3 - final class PhameQueryPostsConduitAPIMethod extends PhameConduitAPIMethod { 4 - 5 - public function getAPIMethodName() { 6 - return 'phame.queryposts'; 7 - } 8 - 9 - public function getMethodDescription() { 10 - return pht('Query phame posts.'); 11 - } 12 - 13 - public function getMethodStatus() { 14 - return self::METHOD_STATUS_UNSTABLE; 15 - } 16 - 17 - protected function defineParamTypes() { 18 - return array( 19 - 'ids' => 'optional list<int>', 20 - 'phids' => 'optional list<phid>', 21 - 'blogPHIDs' => 'optional list<phid>', 22 - 'bloggerPHIDs' => 'optional list<phid>', 23 - 'published' => 'optional bool', 24 - 'publishedAfter' => 'optional date', 25 - 'before' => 'optional int', 26 - 'after' => 'optional int', 27 - 'limit' => 'optional int', 28 - ); 29 - } 30 - 31 - protected function defineReturnType() { 32 - return 'list<dict>'; 33 - } 34 - 35 - protected function execute(ConduitAPIRequest $request) { 36 - $query = new PhamePostQuery(); 37 - 38 - $query->setViewer($request->getUser()); 39 - 40 - $ids = $request->getValue('ids', array()); 41 - if ($ids) { 42 - $query->withIDs($ids); 43 - } 44 - 45 - $phids = $request->getValue('phids', array()); 46 - if ($phids) { 47 - $query->withPHIDs($phids); 48 - } 49 - 50 - $blog_phids = $request->getValue('blogPHIDs', array()); 51 - if ($blog_phids) { 52 - $query->withBlogPHIDs($blog_phids); 53 - } 54 - 55 - $blogger_phids = $request->getValue('bloggerPHIDs', array()); 56 - if ($blogger_phids) { 57 - $query->withBloggerPHIDs($blogger_phids); 58 - } 59 - 60 - $published = $request->getValue('published', null); 61 - if ($published === true) { 62 - $query->withVisibility(PhameConstants::VISIBILITY_PUBLISHED); 63 - } else if ($published === false) { 64 - $query->withVisibility(PhameConstants::VISIBILITY_DRAFT); 65 - } 66 - 67 - $published_after = $request->getValue('publishedAfter', null); 68 - if ($published_after !== null) { 69 - $query->withPublishedAfter($published_after); 70 - } 71 - 72 - $after = $request->getValue('after', null); 73 - if ($after !== null) { 74 - $query->setAfterID($after); 75 - } 76 - 77 - $before = $request->getValue('before', null); 78 - if ($before !== null) { 79 - $query->setBeforeID($before); 80 - } 81 - 82 - $limit = $request->getValue('limit', null); 83 - if ($limit !== null) { 84 - $query->setLimit($limit); 85 - } 86 - 87 - $posts = $query->execute(); 88 - 89 - $results = array(); 90 - foreach ($posts as $post) { 91 - $results[] = $post->toDictionary(); 92 - } 93 - 94 - return $results; 95 - } 96 - 97 - }