Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15383637
D19092.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D19092.id.diff
View Options
diff --git a/resources/sql/autopatches/20180215.phriction.01.phidcol.sql b/resources/sql/autopatches/20180215.phriction.01.phidcol.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20180215.phriction.01.phidcol.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_phriction.phriction_content
+ ADD phid VARBINARY(64) NOT NULL;
diff --git a/resources/sql/autopatches/20180215.phriction.02.phidvalues.php b/resources/sql/autopatches/20180215.phriction.02.phidvalues.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20180215.phriction.02.phidvalues.php
@@ -0,0 +1,17 @@
+<?php
+
+$table = new PhrictionContent();
+$conn = $table->establishConnection('w');
+
+foreach (new LiskMigrationIterator($table) as $row) {
+ if (strlen($row->getPHID())) {
+ continue;
+ }
+
+ queryfx(
+ $conn,
+ 'UPDATE %T SET phid = %s WHERE id = %d',
+ $table->getTableName(),
+ $table->generatePHID(),
+ $row->getID());
+}
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
@@ -4845,6 +4845,8 @@
'PhrictionConduitAPIMethod' => 'applications/phriction/conduit/PhrictionConduitAPIMethod.php',
'PhrictionConstants' => 'applications/phriction/constants/PhrictionConstants.php',
'PhrictionContent' => 'applications/phriction/storage/PhrictionContent.php',
+ 'PhrictionContentPHIDType' => 'applications/phriction/phid/PhrictionContentPHIDType.php',
+ 'PhrictionContentQuery' => 'applications/phriction/query/PhrictionContentQuery.php',
'PhrictionController' => 'applications/phriction/controller/PhrictionController.php',
'PhrictionCreateConduitAPIMethod' => 'applications/phriction/conduit/PhrictionCreateConduitAPIMethod.php',
'PhrictionDAO' => 'applications/phriction/storage/PhrictionDAO.php',
@@ -10757,6 +10759,8 @@
'PhrictionDAO',
'PhabricatorMarkupInterface',
),
+ 'PhrictionContentPHIDType' => 'PhabricatorPHIDType',
+ 'PhrictionContentQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhrictionController' => 'PhabricatorController',
'PhrictionCreateConduitAPIMethod' => 'PhrictionConduitAPIMethod',
'PhrictionDAO' => 'PhabricatorLiskDAO',
diff --git a/src/applications/phriction/phid/PhrictionContentPHIDType.php b/src/applications/phriction/phid/PhrictionContentPHIDType.php
new file mode 100644
--- /dev/null
+++ b/src/applications/phriction/phid/PhrictionContentPHIDType.php
@@ -0,0 +1,38 @@
+<?php
+
+final class PhrictionContentPHIDType
+ extends PhabricatorPHIDType {
+
+ const TYPECONST = 'WRDS';
+
+ public function getTypeName() {
+ return pht('Phriction Content');
+ }
+
+ public function newObject() {
+ return new PhrictionContent();
+ }
+
+ public function getPHIDTypeApplicationClass() {
+ return 'PhabricatorPhrictionApplication';
+ }
+
+ protected function buildQueryForObjects(
+ PhabricatorObjectQuery $query,
+ array $phids) {
+
+ return id(new PhrictionContentQuery())
+ ->withPHIDs($phids);
+ }
+
+ public function loadHandles(
+ PhabricatorHandleQuery $query,
+ array $handles,
+ array $objects) {
+
+ foreach ($handles as $phid => $handle) {
+ $content = $objects[$phid];
+ }
+ }
+
+}
diff --git a/src/applications/phriction/query/PhrictionContentQuery.php b/src/applications/phriction/query/PhrictionContentQuery.php
new file mode 100644
--- /dev/null
+++ b/src/applications/phriction/query/PhrictionContentQuery.php
@@ -0,0 +1,51 @@
+<?php
+
+final class PhrictionContentQuery
+ extends PhabricatorCursorPagedPolicyAwareQuery {
+
+ private $ids;
+ private $phids;
+
+ public function withIDs(array $ids) {
+ $this->ids = $ids;
+ return $this;
+ }
+
+ public function withPHIDs(array $phids) {
+ $this->phids = $phids;
+ return $this;
+ }
+
+ public function newResultObject() {
+ return new PhrictionContent();
+ }
+
+ protected function loadPage() {
+ return $this->loadStandardPage($this->newResultObject());
+ }
+
+ protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
+ $where = parent::buildWhereClauseParts($conn);
+
+ if ($this->ids !== null) {
+ $where[] = qsprintf(
+ $conn,
+ 'id IN (%Ld)',
+ $this->ids);
+ }
+
+ if ($this->phids !== null) {
+ $where[] = qsprintf(
+ $conn,
+ 'phid IN (%Ls)',
+ $this->phids);
+ }
+
+ return $where;
+ }
+
+ public function getQueryApplicationClass() {
+ return 'PhabricatorPhrictionApplication';
+ }
+
+}
diff --git a/src/applications/phriction/storage/PhrictionContent.php b/src/applications/phriction/storage/PhrictionContent.php
--- a/src/applications/phriction/storage/PhrictionContent.php
+++ b/src/applications/phriction/storage/PhrictionContent.php
@@ -3,7 +3,8 @@
/**
* @task markup Markup Interface
*/
-final class PhrictionContent extends PhrictionDAO
+final class PhrictionContent
+ extends PhrictionDAO
implements PhabricatorMarkupInterface {
const MARKUP_FIELD_BODY = 'markup:body';
@@ -33,6 +34,7 @@
protected function getConfiguration() {
return array(
+ self::CONFIG_AUX_PHID => true,
self::CONFIG_COLUMN_SCHEMA => array(
'version' => 'uint32',
'title' => 'sort',
@@ -60,6 +62,10 @@
) + parent::getConfiguration();
}
+ public function getPHIDType() {
+ return PhrictionContentPHIDType::TYPECONST;
+ }
+
/* -( Markup Interface )--------------------------------------------------- */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 15, 5:26 PM (1 w, 16 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7472414
Default Alt Text
D19092.id.diff (5 KB)
Attached To
Mode
D19092: Give PhrictionContent objects (older versions of wiki pages) legitimate PHIDs
Attached
Detach File
Event Timeline
Log In to Comment