@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.

Paste - fix caching mechanism for S3-stored files

Summary: Fixes T5798. We basically weren't using the caching mechanism. Also adds service calls for S3 stuff, and support for seeing a little info like you can for conduit.

Test Plan: uploaded a paste, looked at paste list - no s3 service calls. edited the paste, looked at paste list - no s3 service calls and edited content properly shown

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5798

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

+28 -4
+1
src/aphront/console/plugin/DarkConsoleServicesPlugin.php
··· 246 246 case 'exec': 247 247 $info = $row['command']; 248 248 break; 249 + case 's3': 249 250 case 'conduit': 250 251 $info = $row['method']; 251 252 break;
+25 -2
src/applications/files/engine/PhabricatorS3FileStorageEngine.php
··· 40 40 $name = 'phabricator/'.implode('/', $parts); 41 41 42 42 AphrontWriteGuard::willWrite(); 43 + $profiler = PhutilServiceProfiler::getInstance(); 44 + $call_id = $profiler->beginServiceCall( 45 + array( 46 + 'type' => 's3', 47 + 'method' => 'putObject', 48 + )); 43 49 $s3->putObject( 44 50 $data, 45 51 $this->getBucketName(), 46 52 $name, 47 53 $acl = 'private'); 54 + $profiler->endServiceCall($call_id, array()); 48 55 49 56 return $name; 50 57 } ··· 54 61 * Load a stored blob from Amazon S3. 55 62 */ 56 63 public function readFile($handle) { 57 - $result = $this->newS3API()->getObject( 64 + $s3 = $this->newS3API(); 65 + $profiler = PhutilServiceProfiler::getInstance(); 66 + $call_id = $profiler->beginServiceCall( 67 + array( 68 + 'type' => 's3', 69 + 'method' => 'getObject', 70 + )); 71 + $result = $s3->getObject( 58 72 $this->getBucketName(), 59 73 $handle); 74 + $profiler->endServiceCall($call_id, array()); 60 75 61 76 // NOTE: The implementation of the API that we're using may respond with 62 77 // a successful result that has length 0 and no body property. ··· 73 88 */ 74 89 public function deleteFile($handle) { 75 90 AphrontWriteGuard::willWrite(); 76 - $this->newS3API()->deleteObject( 91 + $s3 = $this->newS3API(); 92 + $profiler = PhutilServiceProfiler::getInstance(); 93 + $call_id = $profiler->beginServiceCall( 94 + array( 95 + 'type' => 's3', 96 + 'method' => 'deleteObject', 97 + )); 98 + $s3->deleteObject( 77 99 $this->getBucketName(), 78 100 $handle); 101 + $profiler->endServiceCall($call_id, array()); 79 102 } 80 103 81 104
+2 -2
src/applications/paste/query/PhabricatorPasteSearchEngine.php
··· 27 27 28 28 public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) { 29 29 $query = id(new PhabricatorPasteQuery()) 30 - ->needRawContent(true) 30 + ->needContent(true) 31 31 ->withAuthorPHIDs($saved->getParameter('authorPHIDs', array())) 32 32 ->withLanguages($saved->getParameter('languages', array())); 33 33 ··· 149 149 $created = phabricator_date($paste->getDateCreated(), $viewer); 150 150 $author = $handles[$paste->getAuthorPHID()]->renderLink(); 151 151 152 - $lines = phutil_split_lines($paste->getRawContent()); 152 + $lines = phutil_split_lines($paste->getContent()); 153 153 154 154 $preview = id(new PhabricatorSourceCodeView()) 155 155 ->setLimit(5)