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

Support Ferret engine in Phame

Summary: Ref T12819. Mostly straightforward, with a couple of minor query modernization things.

Test Plan: Indexed and searched for posts and blogs.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12819

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

+129 -16
+9
resources/sql/autopatches/20170907.ferret.13.blog.doc.sql
··· 1 + CREATE TABLE {$NAMESPACE}_phame.phame_blog_fdocument ( 2 + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 3 + objectPHID VARBINARY(64) NOT NULL, 4 + isClosed BOOL NOT NULL, 5 + authorPHID VARBINARY(64), 6 + ownerPHID VARBINARY(64), 7 + epochCreated INT UNSIGNED NOT NULL, 8 + epochModified INT UNSIGNED NOT NULL 9 + ) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
+8
resources/sql/autopatches/20170907.ferret.14.blog.field.sql
··· 1 + CREATE TABLE {$NAMESPACE}_phame.phame_blog_ffield ( 2 + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 3 + documentID INT UNSIGNED NOT NULL, 4 + fieldKey VARCHAR(4) NOT NULL COLLATE {$COLLATE_TEXT}, 5 + rawCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT}, 6 + termCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT}, 7 + normalCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT} 8 + ) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
+5
resources/sql/autopatches/20170907.ferret.15.blog.ngrams.sql
··· 1 + CREATE TABLE {$NAMESPACE}_phame.phame_blog_fngrams ( 2 + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 3 + documentID INT UNSIGNED NOT NULL, 4 + ngram CHAR(3) NOT NULL COLLATE {$COLLATE_TEXT} 5 + ) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
+9
resources/sql/autopatches/20170907.ferret.16.post.doc.sql
··· 1 + CREATE TABLE {$NAMESPACE}_phame.phame_post_fdocument ( 2 + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 3 + objectPHID VARBINARY(64) NOT NULL, 4 + isClosed BOOL NOT NULL, 5 + authorPHID VARBINARY(64), 6 + ownerPHID VARBINARY(64), 7 + epochCreated INT UNSIGNED NOT NULL, 8 + epochModified INT UNSIGNED NOT NULL 9 + ) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
+8
resources/sql/autopatches/20170907.ferret.17.post.field.sql
··· 1 + CREATE TABLE {$NAMESPACE}_phame.phame_post_ffield ( 2 + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 3 + documentID INT UNSIGNED NOT NULL, 4 + fieldKey VARCHAR(4) NOT NULL COLLATE {$COLLATE_TEXT}, 5 + rawCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT}, 6 + termCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT}, 7 + normalCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT} 8 + ) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
+5
resources/sql/autopatches/20170907.ferret.18.post.ngrams.sql
··· 1 + CREATE TABLE {$NAMESPACE}_phame.phame_post_fngrams ( 2 + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 3 + documentID INT UNSIGNED NOT NULL, 4 + ngram CHAR(3) NOT NULL COLLATE {$COLLATE_TEXT} 5 + ) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
+6
src/__phutil_library_map__.php
··· 4371 4371 'PhameBlogEditEngine' => 'applications/phame/editor/PhameBlogEditEngine.php', 4372 4372 'PhameBlogEditor' => 'applications/phame/editor/PhameBlogEditor.php', 4373 4373 'PhameBlogFeedController' => 'applications/phame/controller/blog/PhameBlogFeedController.php', 4374 + 'PhameBlogFerretEngine' => 'applications/phame/search/PhameBlogFerretEngine.php', 4374 4375 'PhameBlogFullDomainTransaction' => 'applications/phame/xaction/PhameBlogFullDomainTransaction.php', 4375 4376 'PhameBlogFulltextEngine' => 'applications/phame/search/PhameBlogFulltextEngine.php', 4376 4377 'PhameBlogHeaderImageTransaction' => 'applications/phame/xaction/PhameBlogHeaderImageTransaction.php', ··· 4411 4412 'PhamePostEditController' => 'applications/phame/controller/post/PhamePostEditController.php', 4412 4413 'PhamePostEditEngine' => 'applications/phame/editor/PhamePostEditEngine.php', 4413 4414 'PhamePostEditor' => 'applications/phame/editor/PhamePostEditor.php', 4415 + 'PhamePostFerretEngine' => 'applications/phame/search/PhamePostFerretEngine.php', 4414 4416 'PhamePostFulltextEngine' => 'applications/phame/search/PhamePostFulltextEngine.php', 4415 4417 'PhamePostHeaderImageTransaction' => 'applications/phame/xaction/PhamePostHeaderImageTransaction.php', 4416 4418 'PhamePostHeaderPictureController' => 'applications/phame/controller/post/PhamePostHeaderPictureController.php', ··· 9995 9997 'PhabricatorApplicationTransactionInterface', 9996 9998 'PhabricatorConduitResultInterface', 9997 9999 'PhabricatorFulltextInterface', 10000 + 'PhabricatorFerretInterface', 9998 10001 ), 9999 10002 'PhameBlog404Controller' => 'PhameLiveController', 10000 10003 'PhameBlogArchiveController' => 'PhameBlogController', ··· 10007 10010 'PhameBlogEditEngine' => 'PhabricatorEditEngine', 10008 10011 'PhameBlogEditor' => 'PhabricatorApplicationTransactionEditor', 10009 10012 'PhameBlogFeedController' => 'PhameBlogController', 10013 + 'PhameBlogFerretEngine' => 'PhabricatorFerretEngine', 10010 10014 'PhameBlogFullDomainTransaction' => 'PhameBlogTransactionType', 10011 10015 'PhameBlogFulltextEngine' => 'PhabricatorFulltextEngine', 10012 10016 'PhameBlogHeaderImageTransaction' => 'PhameBlogTransactionType', ··· 10050 10054 'PhabricatorTokenReceiverInterface', 10051 10055 'PhabricatorConduitResultInterface', 10052 10056 'PhabricatorFulltextInterface', 10057 + 'PhabricatorFerretInterface', 10053 10058 ), 10054 10059 'PhamePostArchiveController' => 'PhamePostController', 10055 10060 'PhamePostBlogTransaction' => 'PhamePostTransactionType', ··· 10059 10064 'PhamePostEditController' => 'PhamePostController', 10060 10065 'PhamePostEditEngine' => 'PhabricatorEditEngine', 10061 10066 'PhamePostEditor' => 'PhabricatorApplicationTransactionEditor', 10067 + 'PhamePostFerretEngine' => 'PhabricatorFerretEngine', 10062 10068 'PhamePostFulltextEngine' => 'PhabricatorFulltextEngine', 10063 10069 'PhamePostHeaderImageTransaction' => 'PhamePostTransactionType', 10064 10070 'PhamePostHeaderPictureController' => 'PhamePostController',
+8 -4
src/applications/phame/query/PhameBlogQuery.php
··· 55 55 if ($this->statuses !== null) { 56 56 $where[] = qsprintf( 57 57 $conn, 58 - 'status IN (%Ls)', 58 + 'b.status IN (%Ls)', 59 59 $this->statuses); 60 60 } 61 61 62 62 if ($this->ids !== null) { 63 63 $where[] = qsprintf( 64 64 $conn, 65 - 'id IN (%Ls)', 65 + 'b.id IN (%Ls)', 66 66 $this->ids); 67 67 } 68 68 69 69 if ($this->phids !== null) { 70 70 $where[] = qsprintf( 71 71 $conn, 72 - 'phid IN (%Ls)', 72 + 'b.phid IN (%Ls)', 73 73 $this->phids); 74 74 } 75 75 76 76 if ($this->domain !== null) { 77 77 $where[] = qsprintf( 78 78 $conn, 79 - 'domain = %s', 79 + 'b.domain = %s', 80 80 $this->domain); 81 81 } 82 82 ··· 141 141 public function getQueryApplicationClass() { 142 142 // TODO: Can we set this without breaking public blogs? 143 143 return null; 144 + } 145 + 146 + protected function getPrimaryTableAlias() { 147 + return 'b'; 144 148 } 145 149 146 150 }
+15 -10
src/applications/phame/query/PhamePostQuery.php
··· 106 106 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { 107 107 $where = parent::buildWhereClauseParts($conn); 108 108 109 - if ($this->ids) { 109 + if ($this->ids !== null) { 110 110 $where[] = qsprintf( 111 111 $conn, 112 - 'id IN (%Ld)', 112 + 'p.id IN (%Ld)', 113 113 $this->ids); 114 114 } 115 115 116 - if ($this->phids) { 116 + if ($this->phids !== null) { 117 117 $where[] = qsprintf( 118 118 $conn, 119 - 'phid IN (%Ls)', 119 + 'p.phid IN (%Ls)', 120 120 $this->phids); 121 121 } 122 122 123 - if ($this->bloggerPHIDs) { 123 + if ($this->bloggerPHIDs !== null) { 124 124 $where[] = qsprintf( 125 125 $conn, 126 - 'bloggerPHID IN (%Ls)', 126 + 'p.bloggerPHID IN (%Ls)', 127 127 $this->bloggerPHIDs); 128 128 } 129 129 130 - if ($this->visibility) { 130 + if ($this->visibility !== null) { 131 131 $where[] = qsprintf( 132 132 $conn, 133 - 'visibility IN (%Ld)', 133 + 'p.visibility IN (%Ld)', 134 134 $this->visibility); 135 135 } 136 136 137 137 if ($this->publishedAfter !== null) { 138 138 $where[] = qsprintf( 139 139 $conn, 140 - 'datePublished > %d', 140 + 'p.datePublished > %d', 141 141 $this->publishedAfter); 142 142 } 143 143 144 144 if ($this->blogPHIDs !== null) { 145 145 $where[] = qsprintf( 146 146 $conn, 147 - 'blogPHID in (%Ls)', 147 + 'p.blogPHID in (%Ls)', 148 148 $this->blogPHIDs); 149 149 } 150 150 ··· 163 163 public function getOrderableColumns() { 164 164 return parent::getOrderableColumns() + array( 165 165 'datePublished' => array( 166 + 'table' => $this->getPrimaryTableAlias(), 166 167 'column' => 'datePublished', 167 168 'type' => 'int', 168 169 'reverse' => false, ··· 184 185 public function getQueryApplicationClass() { 185 186 // TODO: Does setting this break public blogs? 186 187 return null; 188 + } 189 + 190 + protected function getPrimaryTableAlias() { 191 + return 'p'; 187 192 } 188 193 189 194 }
+18
src/applications/phame/search/PhameBlogFerretEngine.php
··· 1 + <?php 2 + 3 + final class PhameBlogFerretEngine 4 + extends PhabricatorFerretEngine { 5 + 6 + public function getApplicationName() { 7 + return 'phame'; 8 + } 9 + 10 + public function getScopeName() { 11 + return 'blog'; 12 + } 13 + 14 + public function newSearchEngine() { 15 + return new PhameBlogSearchEngine(); 16 + } 17 + 18 + }
+18
src/applications/phame/search/PhamePostFerretEngine.php
··· 1 + <?php 2 + 3 + final class PhamePostFerretEngine 4 + extends PhabricatorFerretEngine { 5 + 6 + public function getApplicationName() { 7 + return 'phame'; 8 + } 9 + 10 + public function getScopeName() { 11 + return 'post'; 12 + } 13 + 14 + public function newSearchEngine() { 15 + return new PhamePostSearchEngine(); 16 + } 17 + 18 + }
+10 -1
src/applications/phame/storage/PhameBlog.php
··· 10 10 PhabricatorDestructibleInterface, 11 11 PhabricatorApplicationTransactionInterface, 12 12 PhabricatorConduitResultInterface, 13 - PhabricatorFulltextInterface { 13 + PhabricatorFulltextInterface, 14 + PhabricatorFerretInterface { 14 15 15 16 const MARKUP_FIELD_DESCRIPTION = 'markup:description'; 16 17 ··· 390 391 391 392 public function newFulltextEngine() { 392 393 return new PhameBlogFulltextEngine(); 394 + } 395 + 396 + 397 + /* -( PhabricatorFerretInterface )----------------------------------------- */ 398 + 399 + 400 + public function newFerretEngine() { 401 + return new PhameBlogFerretEngine(); 393 402 } 394 403 395 404 }
+10 -1
src/applications/phame/storage/PhamePost.php
··· 11 11 PhabricatorDestructibleInterface, 12 12 PhabricatorTokenReceiverInterface, 13 13 PhabricatorConduitResultInterface, 14 - PhabricatorFulltextInterface { 14 + PhabricatorFulltextInterface, 15 + PhabricatorFerretInterface { 15 16 16 17 const MARKUP_FIELD_BODY = 'markup:body'; 17 18 const MARKUP_FIELD_SUMMARY = 'markup:summary'; ··· 385 386 386 387 public function newFulltextEngine() { 387 388 return new PhamePostFulltextEngine(); 389 + } 390 + 391 + 392 + /* -( PhabricatorFerretInterface )----------------------------------------- */ 393 + 394 + 395 + public function newFerretEngine() { 396 + return new PhamePostFerretEngine(); 388 397 } 389 398 390 399 }