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

Add very basic scaffolding for Pholio

Summary:
I'm not going to land this until it's a bit more fleshed out since it would just confuse users, but this is probably more reviewable as a few diffs adding a couple features than one ULTRA-diff adding everything. Implement application basics for Pholio. This does more or less nothing, but adds storage, subscribe, flag, markup, indexing, query basics, PHIDs, handle loads, a couple of realy really basic controllers, etc.
Basic hierarchy is:

- **Moleskine**: Top-level object like a Differential Revision, like "Ponder Feed Ideas".
- **Image**: Each Moleskine has one or more images, like the unexpanded / expanded / mobile / empty states of feed.
- **Transaction**: Comment or edit, like Maniphest. I generally want to move most apps to a transaction model so we can log edits.
- **PixelComment**: Equivalent of an inline comment.

Test Plan: Created a fake object and viewed it.

Reviewers: btrahan, chad

Reviewed By: btrahan

CC: aran, davidreuss

Maniphest Tasks: T2097

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

+909 -1
+74
resources/sql/patches/pholio.sql
··· 1 + CREATE TABLE {$NAMESPACE}_pholio.pholio_mock ( 2 + id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, 3 + phid VARCHAR(64) NOT NULL COLLATE utf8_bin, 4 + name VARCHAR(128) NOT NULL COLLATE utf8_general_ci, 5 + originalName VARCHAR(128) NOT NULL COLLATE utf8_general_ci, 6 + description LONGTEXT NOT NULL COLLATE utf8_general_ci, 7 + authorPHID VARCHAR(64) NOT NULL COLLATE utf8_bin, 8 + viewPolicy VARCHAR(64) NOT NULL COLLATE utf8_bin, 9 + coverPHID VARCHAR(64) NOT NULL COLLATE utf8_bin, 10 + mailKey VARCHAR(20) NOT NULL COLLATE utf8_bin, 11 + dateCreated INT UNSIGNED NOT NULL, 12 + dateModified INT UNSIGNED NOT NULL, 13 + UNIQUE KEY (phid), 14 + KEY (authorPHID) 15 + ) ENGINE=InnoDB, COLLATE utf8_general_ci; 16 + 17 + CREATE TABLE {$NAMESPACE}_pholio.edge ( 18 + src VARCHAR(64) NOT NULL COLLATE utf8_bin, 19 + type VARCHAR(64) NOT NULL COLLATE utf8_bin, 20 + dst VARCHAR(64) NOT NULL COLLATE utf8_bin, 21 + dateCreated INT UNSIGNED NOT NULL, 22 + seq INT UNSIGNED NOT NULL, 23 + dataID INT UNSIGNED, 24 + PRIMARY KEY (src, type, dst), 25 + KEY (src, type, dateCreated, seq) 26 + ) ENGINE=InnoDB, COLLATE utf8_general_ci; 27 + 28 + CREATE TABLE {$NAMESPACE}_pholio.edgedata ( 29 + id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, 30 + data LONGTEXT NOT NULL COLLATE utf8_bin 31 + ) ENGINE=InnoDB, COLLATE utf8_general_ci; 32 + 33 + CREATE TABLE {$NAMESPACE}_pholio.pholio_transaction ( 34 + id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, 35 + authorPHID VARCHAR(64) NOT NULL COLLATE utf8_bin, 36 + mockID INT UNSIGNED NOT NULL, 37 + transactionType VARCHAR(32) NOT NULL COLLATE utf8_bin, 38 + oldValue LONGTEXT NOT NULL COLLATE utf8_bin, 39 + newValue LONGTEXT NOT NULL COLLATE utf8_bin, 40 + comment LONGTEXT NOT NULL COLLATE utf8_general_ci, 41 + metadata LONGTEXT NOT NULL COLLATE utf8_bin, 42 + contentSource LONGTEXT NOT NULL COLLATE utf8_bin, 43 + dateCreated INT UNSIGNED NOT NULL, 44 + dateModified INT UNSIGNED NOT NULL 45 + ) ENGINE=InnoDB, COLLATE utf8_general_ci; 46 + 47 + CREATE TABLE {$NAMESPACE}_pholio.pholio_image ( 48 + id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, 49 + mockID INT UNSIGNED NOT NULL, 50 + filePHID VARCHAR(64) NOT NULL COLLATE utf8_bin, 51 + name VARCHAR(128) NOT NULL COLLATE utf8_general_ci, 52 + description LONGTEXT NOT NULL COLLATE utf8_general_ci, 53 + sequence INT UNSIGNED NOT NULL, 54 + dateCreated INT UNSIGNED NOT NULL, 55 + dateModified INT UNSIGNED NOT NULL, 56 + KEY (mockID, sequence) 57 + ) ENGINE=InnoDB, COLLATE utf8_general_ci; 58 + 59 + CREATE TABLE {$NAMESPACE}_pholio.pholio_pixelcomment ( 60 + id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, 61 + mockID INT UNSIGNED NOT NULL, 62 + imageID INT UNSIGNED NOT NULL, 63 + transactionID INT UNSIGNED, 64 + authorPHID VARCHAR(64) NOT NULL COLLATE utf8_bin, 65 + x INT UNSIGNED NOT NULL, 66 + y INT UNSIGNED NOT NULL, 67 + width INT UNSIGNED NOT NULL, 68 + height INT UNSIGNED NOT NULL, 69 + comment LONGTEXT NOT NULL COLLATE utf8_general_ci, 70 + dateCreated INT UNSIGNED NOT NULL, 71 + dateModified INT UNSIGNED NOT NULL, 72 + KEY (mockID), 73 + KEY (authorPHID, transactionID) 74 + ) ENGINE=InnoDB, COLLATE utf8_general_ci;
+42
src/__phutil_library_map__.php
··· 582 582 'PhabricatorApplicationPaste' => 'applications/paste/application/PhabricatorApplicationPaste.php', 583 583 'PhabricatorApplicationPeople' => 'applications/people/application/PhabricatorApplicationPeople.php', 584 584 'PhabricatorApplicationPhame' => 'applications/phame/application/PhabricatorApplicationPhame.php', 585 + 'PhabricatorApplicationPholio' => 'applications/pholio/application/PhabricatorApplicationPholio.php', 585 586 'PhabricatorApplicationPhriction' => 'applications/phriction/application/PhabricatorApplicationPhriction.php', 586 587 'PhabricatorApplicationPonder' => 'applications/ponder/application/PhabricatorApplicationPonder.php', 587 588 'PhabricatorApplicationProject' => 'applications/project/application/PhabricatorApplicationProject.php', ··· 1199 1200 'PhamePostViewController' => 'applications/phame/controller/post/PhamePostViewController.php', 1200 1201 'PhameResourceController' => 'applications/phame/controller/PhameResourceController.php', 1201 1202 'PhameSkinSpecification' => 'applications/phame/skins/PhameSkinSpecification.php', 1203 + 'PholioController' => 'applications/pholio/controller/PholioController.php', 1204 + 'PholioDAO' => 'applications/pholio/storage/PholioDAO.php', 1205 + 'PholioImage' => 'applications/pholio/storage/PholioImage.php', 1206 + 'PholioIndexer' => 'applications/pholio/indexer/PholioIndexer.php', 1207 + 'PholioMock' => 'applications/pholio/storage/PholioMock.php', 1208 + 'PholioMockEditor' => 'applications/pholio/editor/PholioMockEditor.php', 1209 + 'PholioMockListController' => 'applications/pholio/controller/PholioMockListController.php', 1210 + 'PholioMockQuery' => 'applications/pholio/query/PholioMockQuery.php', 1211 + 'PholioMockViewController' => 'applications/pholio/controller/PholioMockViewController.php', 1212 + 'PholioPixelComment' => 'applications/pholio/storage/PholioPixelComment.php', 1213 + 'PholioTransaction' => 'applications/pholio/storage/PholioTransaction.php', 1202 1214 'PhortuneMonthYearExpiryControl' => 'applications/phortune/control/PhortuneMonthYearExpiryControl.php', 1203 1215 'PhortuneStripeBaseController' => 'applications/phortune/stripe/controller/PhortuneStripeBaseController.php', 1204 1216 'PhortuneStripePaymentFormView' => 'applications/phortune/stripe/view/PhortuneStripePaymentFormView.php', ··· 1799 1811 'PhabricatorApplicationPaste' => 'PhabricatorApplication', 1800 1812 'PhabricatorApplicationPeople' => 'PhabricatorApplication', 1801 1813 'PhabricatorApplicationPhame' => 'PhabricatorApplication', 1814 + 'PhabricatorApplicationPholio' => 'PhabricatorApplication', 1802 1815 'PhabricatorApplicationPhriction' => 'PhabricatorApplication', 1803 1816 'PhabricatorApplicationPonder' => 'PhabricatorApplication', 1804 1817 'PhabricatorApplicationProject' => 'PhabricatorApplication', ··· 2377 2390 'PhamePostView' => 'AphrontView', 2378 2391 'PhamePostViewController' => 'PhameController', 2379 2392 'PhameResourceController' => 'CelerityResourceController', 2393 + 'PholioController' => 'PhabricatorController', 2394 + 'PholioDAO' => 'PhabricatorLiskDAO', 2395 + 'PholioImage' => 2396 + array( 2397 + 0 => 'PholioDAO', 2398 + 1 => 'PhabricatorMarkupInterface', 2399 + ), 2400 + 'PholioIndexer' => 'PhabricatorSearchDocumentIndexer', 2401 + 'PholioMock' => 2402 + array( 2403 + 0 => 'PholioDAO', 2404 + 1 => 'PhabricatorMarkupInterface', 2405 + 2 => 'PhabricatorPolicyInterface', 2406 + 3 => 'PhabricatorSubscribableInterface', 2407 + ), 2408 + 'PholioMockEditor' => 'PhabricatorEditor', 2409 + 'PholioMockListController' => 'PholioController', 2410 + 'PholioMockQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 2411 + 'PholioMockViewController' => 'PholioController', 2412 + 'PholioPixelComment' => 2413 + array( 2414 + 0 => 'PholioDAO', 2415 + 1 => 'PhabricatorMarkupInterface', 2416 + ), 2417 + 'PholioTransaction' => 2418 + array( 2419 + 0 => 'PholioDAO', 2420 + 1 => 'PhabricatorMarkupInterface', 2421 + ), 2380 2422 'PhortuneMonthYearExpiryControl' => 'AphrontFormControl', 2381 2423 'PhortuneStripeBaseController' => 'PhabricatorController', 2382 2424 'PhortuneStripePaymentFormView' => 'AphrontView',
+2
src/applications/phid/PhabricatorPHIDConstants.php
··· 28 28 const PHID_TYPE_BLOG = 'BLOG'; 29 29 const PHID_TYPE_QUES = 'QUES'; 30 30 const PHID_TYPE_ANSW = 'ANSW'; 31 + const PHID_TYPE_MOCK = 'MOCK'; 32 + 31 33 }
+33
src/applications/phid/handle/PhabricatorObjectHandleData.php
··· 88 88 break; 89 89 case PhabricatorPHIDConstants::PHID_TYPE_QUES: 90 90 $questions = id(new PonderQuestionQuery()) 91 + ->setViewer($this->viewer) 91 92 ->withPHIDs($phids) 92 93 ->execute(); 93 94 foreach ($questions as $question) { 94 95 $objects[$question->getPHID()] = $question; 96 + } 97 + break; 98 + case PhabricatorPHIDConstants::PHID_TYPE_MOCK: 99 + $mocks = id(new PholioMockQuery()) 100 + ->setViewer($this->viewer) 101 + ->withPHIDs($phids) 102 + ->execute(); 103 + foreach ($mocks as $mock) { 104 + $objects[$mock->getPHID()] = $mock; 95 105 } 96 106 break; 97 107 } ··· 541 551 $handle->setName($post->getTitle()); 542 552 $handle->setFullName($post->getTitle()); 543 553 $handle->setURI('/phame/post/view/'.$post->getID().'/'); 554 + $handle->setComplete(true); 555 + } 556 + $handles[$phid] = $handle; 557 + } 558 + break; 559 + case PhabricatorPHIDConstants::PHID_TYPE_MOCK: 560 + $mocks = id(new PholioMockQuery()) 561 + ->withPHIDs($phids) 562 + ->setViewer($this->viewer) 563 + ->execute(); 564 + $mocks = mpull($mocks, null, 'getPHID'); 565 + 566 + foreach ($phids as $phid) { 567 + $handle = new PhabricatorObjectHandle(); 568 + $handle->setPHID($phid); 569 + $handle->setType($type); 570 + if (empty($mocks[$phid])) { 571 + $handle->setName('Unknown Mock'); 572 + } else { 573 + $mock = $mocks[$phid]; 574 + $handle->setName($mock->getName()); 575 + $handle->setFullName($mock->getName()); 576 + $handle->setURI('/M'.$mock->getID()); 544 577 $handle->setComplete(true); 545 578 } 546 579 $handles[$phid] = $handle;
+63
src/applications/pholio/application/PhabricatorApplicationPholio.php
··· 1 + <?php 2 + 3 + /* 4 + * Copyright 2012 Facebook, Inc. 5 + * 6 + * Licensed under the Apache License, Version 2.0 (the "License"); 7 + * you may not use this file except in compliance with the License. 8 + * You may obtain a copy of the License at 9 + * 10 + * http://www.apache.org/licenses/LICENSE-2.0 11 + * 12 + * Unless required by applicable law or agreed to in writing, software 13 + * distributed under the License is distributed on an "AS IS" BASIS, 14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 + * See the License for the specific language governing permissions and 16 + * limitations under the License. 17 + */ 18 + 19 + /** 20 + * @group pholio 21 + */ 22 + final class PhabricatorApplicationPholio extends PhabricatorApplication { 23 + 24 + public function shouldAppearInLaunchView() { 25 + // TODO: See getApplicationGroup(). 26 + return false; 27 + } 28 + 29 + public function getBaseURI() { 30 + return '/pholio/'; 31 + } 32 + 33 + public function getShortDescription() { 34 + return 'Design Review'; 35 + } 36 + 37 + public function getAutospriteName() { 38 + return 'pholio'; 39 + } 40 + 41 + public function getTitleGlyph() { 42 + return "\xE2\x9D\xA6"; 43 + } 44 + 45 + public function getFlavorText() { 46 + return pht('Things before they were cool.'); 47 + } 48 + 49 + public function getApplicationGroup() { 50 + // TODO: Move to CORE, this just keeps it out of the side menu. 51 + return self::GROUP_COMMUNICATION; 52 + } 53 + 54 + public function getRoutes() { 55 + return array( 56 + '/M(?P<id>[1-9]\d*)' => 'PholioMockViewController', 57 + '/pholio/' => array( 58 + '' => 'PholioMockListController', 59 + ), 60 + ); 61 + } 62 + 63 + }
+25
src/applications/pholio/controller/PholioController.php
··· 1 + <?php 2 + 3 + /* 4 + * Copyright 2012 Facebook, Inc. 5 + * 6 + * Licensed under the Apache License, Version 2.0 (the "License"); 7 + * you may not use this file except in compliance with the License. 8 + * You may obtain a copy of the License at 9 + * 10 + * http://www.apache.org/licenses/LICENSE-2.0 11 + * 12 + * Unless required by applicable law or agreed to in writing, software 13 + * distributed under the License is distributed on an "AS IS" BASIS, 14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 + * See the License for the specific language governing permissions and 16 + * limitations under the License. 17 + */ 18 + 19 + /** 20 + * @group pholio 21 + */ 22 + abstract class PholioController extends PhabricatorController { 23 + 24 + 25 + }
+62
src/applications/pholio/controller/PholioMockListController.php
··· 1 + <?php 2 + 3 + /* 4 + * Copyright 2012 Facebook, Inc. 5 + * 6 + * Licensed under the Apache License, Version 2.0 (the "License"); 7 + * you may not use this file except in compliance with the License. 8 + * You may obtain a copy of the License at 9 + * 10 + * http://www.apache.org/licenses/LICENSE-2.0 11 + * 12 + * Unless required by applicable law or agreed to in writing, software 13 + * distributed under the License is distributed on an "AS IS" BASIS, 14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 + * See the License for the specific language governing permissions and 16 + * limitations under the License. 17 + */ 18 + 19 + /** 20 + * @group pholio 21 + */ 22 + final class PholioMockListController extends PholioController { 23 + 24 + public function processRequest() { 25 + $request = $this->getRequest(); 26 + $user = $request->getUser(); 27 + 28 + $query = id(new PholioMockQuery()) 29 + ->setViewer($user); 30 + 31 + $title = 'All Mocks'; 32 + 33 + $pager = new AphrontCursorPagerView(); 34 + $pager->readFromRequest($request); 35 + 36 + $mocks = $query->executeWithCursorPager($pager); 37 + 38 + $board = new PhabricatorPinboardView(); 39 + foreach ($mocks as $mock) { 40 + $board->addItem( 41 + id(new PhabricatorPinboardItemView()) 42 + ->setHeader($mock->getName()) 43 + ->setURI('/M'.$mock->getID())); 44 + } 45 + 46 + $header = id(new PhabricatorHeaderView()) 47 + ->setHeader($title); 48 + 49 + $content = array( 50 + $header, 51 + $board, 52 + $pager, 53 + ); 54 + 55 + return $this->buildApplicationPage( 56 + $content, 57 + array( 58 + 'title' => $title, 59 + )); 60 + } 61 + 62 + }
+67
src/applications/pholio/controller/PholioMockViewController.php
··· 1 + <?php 2 + 3 + /* 4 + * Copyright 2012 Facebook, Inc. 5 + * 6 + * Licensed under the Apache License, Version 2.0 (the "License"); 7 + * you may not use this file except in compliance with the License. 8 + * You may obtain a copy of the License at 9 + * 10 + * http://www.apache.org/licenses/LICENSE-2.0 11 + * 12 + * Unless required by applicable law or agreed to in writing, software 13 + * distributed under the License is distributed on an "AS IS" BASIS, 14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 + * See the License for the specific language governing permissions and 16 + * limitations under the License. 17 + */ 18 + 19 + /** 20 + * @group pholio 21 + */ 22 + final class PholioMockViewController extends PholioController { 23 + 24 + private $id; 25 + 26 + public function willProcessRequest(array $data) { 27 + $this->id = $data['id']; 28 + } 29 + 30 + public function processRequest() { 31 + $request = $this->getRequest(); 32 + $user = $request->getUser(); 33 + 34 + $mock = id(new PholioMockQuery()) 35 + ->setViewer($user) 36 + ->withIDs(array($this->id)) 37 + ->executeOne(); 38 + 39 + if (!$mock) { 40 + return new Aphront404Response(); 41 + } 42 + 43 + $title = 'M'.$mock->getID().' '.$mock->getName(); 44 + 45 + $header = id(new PhabricatorHeaderView()) 46 + ->setHeader($title); 47 + 48 + $actions = id(new PhabricatorActionListView()) 49 + ->setUser($user) 50 + ->setObject($mock); 51 + 52 + $properties = new PhabricatorPropertyListView(); 53 + 54 + $content = array( 55 + $header, 56 + $actions, 57 + $properties 58 + ); 59 + 60 + return $this->buildApplicationPage( 61 + $content, 62 + array( 63 + 'title' => $title, 64 + )); 65 + } 66 + 67 + }
+26
src/applications/pholio/editor/PholioMockEditor.php
··· 1 + <?php 2 + 3 + /* 4 + * Copyright 2012 Facebook, Inc. 5 + * 6 + * Licensed under the Apache License, Version 2.0 (the "License"); 7 + * you may not use this file except in compliance with the License. 8 + * You may obtain a copy of the License at 9 + * 10 + * http://www.apache.org/licenses/LICENSE-2.0 11 + * 12 + * Unless required by applicable law or agreed to in writing, software 13 + * distributed under the License is distributed on an "AS IS" BASIS, 14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 + * See the License for the specific language governing permissions and 16 + * limitations under the License. 17 + */ 18 + 19 + /** 20 + * @group pholio 21 + */ 22 + final class PholioMockEditor extends PhabricatorEditor { 23 + 24 + 25 + 26 + }
+44
src/applications/pholio/indexer/PholioIndexer.php
··· 1 + <?php 2 + 3 + /* 4 + * Copyright 2012 Facebook, Inc. 5 + * 6 + * Licensed under the Apache License, Version 2.0 (the "License"); 7 + * you may not use this file except in compliance with the License. 8 + * You may obtain a copy of the License at 9 + * 10 + * http://www.apache.org/licenses/LICENSE-2.0 11 + * 12 + * Unless required by applicable law or agreed to in writing, software 13 + * distributed under the License is distributed on an "AS IS" BASIS, 14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 + * See the License for the specific language governing permissions and 16 + * limitations under the License. 17 + */ 18 + 19 + /** 20 + * @group pholio 21 + */ 22 + final class PholioIndexer extends PhabricatorSearchDocumentIndexer { 23 + 24 + public static function indexMock(PholioMock $mock) { 25 + $doc = new PhabricatorSearchAbstractDocument(); 26 + $doc->setPHID($mock->getPHID()); 27 + $doc->setDocumentType(phid_get_type($mock->getPHID())); 28 + $doc->setDocumentTitle($mock->getName()); 29 + $doc->setDocumentCreated($mock->getDateCreated()); 30 + $doc->setDocumentModified($mock->getDateModified()); 31 + 32 + $doc->addField( 33 + PhabricatorSearchField::FIELD_BODY, 34 + $mock->getDescription()); 35 + 36 + $doc->addRelationship( 37 + PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, 38 + $mock->getAuthorPHID(), 39 + PhabricatorPHIDConstants::PHID_TYPE_USER, 40 + $mock->getDateCreated()); 41 + 42 + self::reindexAbstractDocument($doc); 43 + } 44 + }
+88
src/applications/pholio/query/PholioMockQuery.php
··· 1 + <?php 2 + 3 + /* 4 + * Copyright 2012 Facebook, Inc. 5 + * 6 + * Licensed under the Apache License, Version 2.0 (the "License"); 7 + * you may not use this file except in compliance with the License. 8 + * You may obtain a copy of the License at 9 + * 10 + * http://www.apache.org/licenses/LICENSE-2.0 11 + * 12 + * Unless required by applicable law or agreed to in writing, software 13 + * distributed under the License is distributed on an "AS IS" BASIS, 14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 + * See the License for the specific language governing permissions and 16 + * limitations under the License. 17 + */ 18 + 19 + /** 20 + * @group pholio 21 + */ 22 + final class PholioMockQuery 23 + extends PhabricatorCursorPagedPolicyAwareQuery { 24 + 25 + private $ids; 26 + private $phids; 27 + private $authorPHIDs; 28 + 29 + public function withIDs(array $ids) { 30 + $this->ids = $ids; 31 + return $this; 32 + } 33 + 34 + public function withPHIDs(array $phids) { 35 + $this->phids = $phids; 36 + return $this; 37 + } 38 + 39 + public function withAuthorPHIDs(array $author_phids) { 40 + $this->authorPHIDs = $author_phids; 41 + return $this; 42 + } 43 + 44 + public function loadPage() { 45 + $table = new PholioMock(); 46 + $conn_r = $table->establishConnection('r'); 47 + 48 + $data = queryfx_all( 49 + $conn_r, 50 + 'SELECT * FROM %T %Q %Q %Q', 51 + $table->getTableName(), 52 + $this->buildWhereClause($conn_r), 53 + $this->buildOrderClause($conn_r), 54 + $this->buildLimitClause($conn_r)); 55 + 56 + return $table->loadAllFromArray($data); 57 + } 58 + 59 + private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 60 + $where = array(); 61 + 62 + $where[] = $this->buildPagingClause($conn_r); 63 + 64 + if ($this->ids) { 65 + $where[] = qsprintf( 66 + $conn_r, 67 + 'id IN (%Ld)', 68 + $this->ids); 69 + } 70 + 71 + if ($this->phids) { 72 + $where[] = qsprintf( 73 + $conn_r, 74 + 'phid IN (%Ls)', 75 + $this->phids); 76 + } 77 + 78 + if ($this->authorPHIDs) { 79 + $where[] = qsprintf( 80 + $conn_r, 81 + 'authorPHID in (%Ls)', 82 + $this->authorPHIDs); 83 + } 84 + 85 + return $this->formatWhereClause($where); 86 + } 87 + 88 + }
+28
src/applications/pholio/storage/PholioDAO.php
··· 1 + <?php 2 + 3 + /* 4 + * Copyright 2012 Facebook, Inc. 5 + * 6 + * Licensed under the Apache License, Version 2.0 (the "License"); 7 + * you may not use this file except in compliance with the License. 8 + * You may obtain a copy of the License at 9 + * 10 + * http://www.apache.org/licenses/LICENSE-2.0 11 + * 12 + * Unless required by applicable law or agreed to in writing, software 13 + * distributed under the License is distributed on an "AS IS" BASIS, 14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 + * See the License for the specific language governing permissions and 16 + * limitations under the License. 17 + */ 18 + 19 + /** 20 + * @group pholio 21 + */ 22 + abstract class PholioDAO extends PhabricatorLiskDAO { 23 + 24 + public function getApplicationName() { 25 + return 'pholio'; 26 + } 27 + 28 + }
+58
src/applications/pholio/storage/PholioImage.php
··· 1 + <?php 2 + 3 + /* 4 + * Copyright 2012 Facebook, Inc. 5 + * 6 + * Licensed under the Apache License, Version 2.0 (the "License"); 7 + * you may not use this file except in compliance with the License. 8 + * You may obtain a copy of the License at 9 + * 10 + * http://www.apache.org/licenses/LICENSE-2.0 11 + * 12 + * Unless required by applicable law or agreed to in writing, software 13 + * distributed under the License is distributed on an "AS IS" BASIS, 14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 + * See the License for the specific language governing permissions and 16 + * limitations under the License. 17 + */ 18 + 19 + /** 20 + * @group pholio 21 + */ 22 + final class PholioImage extends PholioDAO 23 + implements PhabricatorMarkupInterface { 24 + 25 + const MARKUP_FIELD_DESCRIPTION = 'markup:description'; 26 + 27 + protected $mockID; 28 + protected $filePHID; 29 + protected $name; 30 + protected $description; 31 + protected $sequence; 32 + 33 + 34 + /* -( PhabricatorMarkupInterface )----------------------------------------- */ 35 + 36 + 37 + public function getMarkupFieldKey($field) { 38 + $hash = PhabricatorHash::digest($this->getMarkupText($field)); 39 + return 'M:'.$hash; 40 + } 41 + 42 + public function newMarkupEngine($field) { 43 + return PhabricatorMarkupEngine::newMarkupEngine(array()); 44 + } 45 + 46 + public function getMarkupText($field) { 47 + return $this->getDescription(); 48 + } 49 + 50 + public function didMarkupText($field, $output, PhutilMarkupEngine $engine) { 51 + return $output; 52 + } 53 + 54 + public function shouldUseMarkupCache($field) { 55 + return (bool)$this->getID(); 56 + } 57 + 58 + }
+113
src/applications/pholio/storage/PholioMock.php
··· 1 + <?php 2 + 3 + /* 4 + * Copyright 2012 Facebook, Inc. 5 + * 6 + * Licensed under the Apache License, Version 2.0 (the "License"); 7 + * you may not use this file except in compliance with the License. 8 + * You may obtain a copy of the License at 9 + * 10 + * http://www.apache.org/licenses/LICENSE-2.0 11 + * 12 + * Unless required by applicable law or agreed to in writing, software 13 + * distributed under the License is distributed on an "AS IS" BASIS, 14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 + * See the License for the specific language governing permissions and 16 + * limitations under the License. 17 + */ 18 + 19 + /** 20 + * @group pholio 21 + */ 22 + final class PholioMock extends PholioDAO 23 + implements 24 + PhabricatorMarkupInterface, 25 + PhabricatorPolicyInterface, 26 + PhabricatorSubscribableInterface { 27 + 28 + const MARKUP_FIELD_DESCRIPTION = 'markup:description'; 29 + 30 + protected $authorPHID; 31 + protected $viewPolicy; 32 + 33 + protected $name; 34 + protected $originalName; 35 + protected $description; 36 + protected $coverPHID; 37 + protected $mailKey; 38 + 39 + public function getConfiguration() { 40 + return array( 41 + self::CONFIG_AUX_PHID => true, 42 + ) + parent::getConfiguration(); 43 + } 44 + 45 + public function generatePHID() { 46 + return PhabricatorPHID::generateNewPHID('MOCK'); 47 + } 48 + 49 + public function save() { 50 + if (!$this->getMailKey()) { 51 + $this->setMailKey(Filesystem::readRandomCharacters(20)); 52 + } 53 + return parent::save(); 54 + } 55 + 56 + 57 + /* -( PhabricatorSubscribableInterface Implementation )-------------------- */ 58 + 59 + 60 + public function isAutomaticallySubscribed($phid) { 61 + return ($this->authorPHID == $phid); 62 + } 63 + 64 + 65 + /* -( PhabricatorPolicyInterface Implementation )-------------------------- */ 66 + 67 + 68 + public function getCapabilities() { 69 + return array( 70 + PhabricatorPolicyCapability::CAN_VIEW, 71 + PhabricatorPolicyCapability::CAN_EDIT, 72 + ); 73 + } 74 + 75 + public function getPolicy($capability) { 76 + switch ($capability) { 77 + case PhabricatorPolicyCapability::CAN_VIEW: 78 + return $this->getViewPolicy(); 79 + case PhabricatorPolicyCapability::CAN_EDIT: 80 + return PhabricatorPolicies::POLICY_NOONE; 81 + } 82 + } 83 + 84 + public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { 85 + return ($viewer->getPHID() == $this->getAuthorPHID()); 86 + } 87 + 88 + 89 + /* -( PhabricatorMarkupInterface )----------------------------------------- */ 90 + 91 + 92 + public function getMarkupFieldKey($field) { 93 + $hash = PhabricatorHash::digest($this->getMarkupText($field)); 94 + return 'M:'.$hash; 95 + } 96 + 97 + public function newMarkupEngine($field) { 98 + return PhabricatorMarkupEngine::newMarkupEngine(array()); 99 + } 100 + 101 + public function getMarkupText($field) { 102 + return $this->getDescription(); 103 + } 104 + 105 + public function didMarkupText($field, $output, PhutilMarkupEngine $engine) { 106 + return $output; 107 + } 108 + 109 + public function shouldUseMarkupCache($field) { 110 + return (bool)$this->getID(); 111 + } 112 + 113 + }
+62
src/applications/pholio/storage/PholioPixelComment.php
··· 1 + <?php 2 + 3 + /* 4 + * Copyright 2012 Facebook, Inc. 5 + * 6 + * Licensed under the Apache License, Version 2.0 (the "License"); 7 + * you may not use this file except in compliance with the License. 8 + * You may obtain a copy of the License at 9 + * 10 + * http://www.apache.org/licenses/LICENSE-2.0 11 + * 12 + * Unless required by applicable law or agreed to in writing, software 13 + * distributed under the License is distributed on an "AS IS" BASIS, 14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 + * See the License for the specific language governing permissions and 16 + * limitations under the License. 17 + */ 18 + 19 + /** 20 + * @group pholio 21 + */ 22 + final class PholioPixelComment extends PholioDAO 23 + implements PhabricatorMarkupInterface { 24 + 25 + const MARKUP_FIELD_COMMENT = 'markup:comment'; 26 + 27 + protected $mockID; 28 + protected $transactionID; 29 + protected $authorPHID; 30 + protected $imageID; 31 + 32 + protected $x; 33 + protected $y; 34 + protected $width; 35 + protected $height; 36 + protected $comment; 37 + 38 + 39 + /* -( PhabricatorMarkupInterface )----------------------------------------- */ 40 + 41 + 42 + public function getMarkupFieldKey($field) { 43 + return 'MP:'.$this->getID(); 44 + } 45 + 46 + public function newMarkupEngine($field) { 47 + return PhabricatorMarkupEngine::newMarkupEngine(array()); 48 + } 49 + 50 + public function getMarkupText($field) { 51 + return $this->getComment(); 52 + } 53 + 54 + public function didMarkupText($field, $output, PhutilMarkupEngine $engine) { 55 + return $output; 56 + } 57 + 58 + public function shouldUseMarkupCache($field) { 59 + return ($this->getID() && $this->getTransactionID()); 60 + } 61 + 62 + }
+111
src/applications/pholio/storage/PholioTransaction.php
··· 1 + <?php 2 + 3 + /* 4 + * Copyright 2012 Facebook, Inc. 5 + * 6 + * Licensed under the Apache License, Version 2.0 (the "License"); 7 + * you may not use this file except in compliance with the License. 8 + * You may obtain a copy of the License at 9 + * 10 + * http://www.apache.org/licenses/LICENSE-2.0 11 + * 12 + * Unless required by applicable law or agreed to in writing, software 13 + * distributed under the License is distributed on an "AS IS" BASIS, 14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 + * See the License for the specific language governing permissions and 16 + * limitations under the License. 17 + */ 18 + 19 + /** 20 + * @group pholio 21 + */ 22 + final class PholioTransaction extends PholioDAO 23 + implements PhabricatorMarkupInterface { 24 + 25 + const MARKUP_FIELD_COMMENT = 'markup:comment'; 26 + 27 + protected $mockID; 28 + protected $authorPHID; 29 + protected $transactionType; 30 + protected $oldValue; 31 + protected $newValue; 32 + protected $comment; 33 + protected $metadata = array(); 34 + protected $contentSource; 35 + 36 + public function getConfiguration() { 37 + return array( 38 + self::CONFIG_SERIALIZATION => array( 39 + 'oldValue' => self::SERIALIZATION_JSON, 40 + 'newValue' => self::SERIALIZATION_JSON, 41 + 'metadata' => self::SERIALIZATION_JSON, 42 + ), 43 + ) + parent::getConfiguration(); 44 + } 45 + 46 + public function setContentSource(PhabricatorContentSource $content_source) { 47 + $this->contentSource = $content_source->serialize(); 48 + return $this; 49 + } 50 + 51 + public function getContentSource() { 52 + return PhabricatorContentSource::newFromSerialized($this->contentSource); 53 + } 54 + 55 + 56 + /* -( PhabricatorSubscribableInterface Implementation )-------------------- */ 57 + 58 + 59 + public function isAutomaticallySubscribed($phid) { 60 + return ($this->authorPHID == $phid); 61 + } 62 + 63 + 64 + /* -( PhabricatorPolicyInterface Implementation )-------------------------- */ 65 + 66 + 67 + public function getCapabilities() { 68 + return array( 69 + PhabricatorPolicyCapability::CAN_VIEW, 70 + PhabricatorPolicyCapability::CAN_EDIT, 71 + ); 72 + } 73 + 74 + public function getPolicy($capability) { 75 + switch ($capability) { 76 + case PhabricatorPolicyCapability::CAN_VIEW: 77 + return $this->getViewPolicy(); 78 + case PhabricatorPolicyCapability::CAN_EDIT: 79 + return PhabricatorPolicies::POLICY_NOONE; 80 + } 81 + } 82 + 83 + public function hasAutomaticCapbility($capability, PhabricatorUser $viewer) { 84 + return ($viewer->getPHID() == $this->getAuthorPHID()); 85 + } 86 + 87 + 88 + /* -( PhabricatorMarkupInterface )----------------------------------------- */ 89 + 90 + 91 + public function getMarkupFieldKey($field) { 92 + return 'MX:'.$this->getID(); 93 + } 94 + 95 + public function newMarkupEngine($field) { 96 + return PhabricatorMarkupEngine::newMarkupEngine(array()); 97 + } 98 + 99 + public function getMarkupText($field) { 100 + return $this->getComment(); 101 + } 102 + 103 + public function didMarkupText($field, $output, PhutilMarkupEngine $engine) { 104 + return $output; 105 + } 106 + 107 + public function shouldUseMarkupCache($field) { 108 + return (bool)$this->getID(); 109 + } 110 + 111 + }
+2
src/infrastructure/edges/constants/PhabricatorEdgeConfig.php
··· 107 107 PhabricatorPHIDConstants::PHID_TYPE_POST => 'PhamePost', 108 108 PhabricatorPHIDConstants::PHID_TYPE_QUES => 'PonderQuestion', 109 109 PhabricatorPHIDConstants::PHID_TYPE_ANSW => 'PonderAnswer', 110 + PhabricatorPHIDConstants::PHID_TYPE_MOCK => 'PholioMock', 111 + 110 112 ); 111 113 112 114 $class = idx($class_map, $phid_type);
+8
src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php
··· 155 155 'type' => 'db', 156 156 'name' => 'xhprof', 157 157 ), 158 + 'db.pholio' => array( 159 + 'type' => 'db', 160 + 'name' => 'pholio', 161 + ), 158 162 '0000.legacy.sql' => array( 159 163 'type' => 'sql', 160 164 'name' => $this->getPatchPath('0000.legacy.sql'), ··· 1031 1035 'liskcounters-task.sql' => array( 1032 1036 'type' => 'sql', 1033 1037 'name' => $this->getPatchPath('liskcounters-task.sql'), 1038 + ), 1039 + 'pholio.sql' => array( 1040 + 'type' => 'sql', 1041 + 'name' => $this->getPatchPath('pholio.sql'), 1034 1042 ), 1035 1043 ); 1036 1044 }
+1 -1
src/view/layout/PhabricatorPinboardView.php
··· 4 4 5 5 private $items = array(); 6 6 7 - public function addItem(PhabricatorPinBoardItemView $item) { 7 + public function addItem(PhabricatorPinboardItemView $item) { 8 8 $this->items[] = $item; 9 9 return $this; 10 10 }