Page MenuHomePhabricator

D10582.id25411.diff
No OneTemporary

D10582.id25411.diff

diff --git a/resources/sql/autopatches/20140926.schema.07.droppondcom.sql b/resources/sql/autopatches/20140926.schema.07.droppondcom.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20140926.schema.07.droppondcom.sql
@@ -0,0 +1 @@
+DROP TABLE {$NAMESPACE}_ponder.ponder_comment;
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
@@ -2688,8 +2688,6 @@
'PonderAnswerTransaction' => 'applications/ponder/storage/PonderAnswerTransaction.php',
'PonderAnswerTransactionComment' => 'applications/ponder/storage/PonderAnswerTransactionComment.php',
'PonderAnswerTransactionQuery' => 'applications/ponder/query/PonderAnswerTransactionQuery.php',
- 'PonderComment' => 'applications/ponder/storage/PonderComment.php',
- 'PonderCommentQuery' => 'applications/ponder/query/PonderCommentQuery.php',
'PonderConstants' => 'applications/ponder/constants/PonderConstants.php',
'PonderController' => 'applications/ponder/controller/PonderController.php',
'PonderDAO' => 'applications/ponder/storage/PonderDAO.php',
@@ -2712,6 +2710,7 @@
'PonderQuestionTransactionQuery' => 'applications/ponder/query/PonderQuestionTransactionQuery.php',
'PonderQuestionViewController' => 'applications/ponder/controller/PonderQuestionViewController.php',
'PonderRemarkupRule' => 'applications/ponder/remarkup/PonderRemarkupRule.php',
+ 'PonderSchemaSpec' => 'applications/ponder/storage/PonderSchemaSpec.php',
'PonderSearchIndexer' => 'applications/ponder/search/PonderSearchIndexer.php',
'PonderTransactionFeedStory' => 'applications/ponder/feed/PonderTransactionFeedStory.php',
'PonderVotableInterface' => 'applications/ponder/storage/PonderVotableInterface.php',
@@ -5759,11 +5758,6 @@
'PonderAnswerTransaction' => 'PhabricatorApplicationTransaction',
'PonderAnswerTransactionComment' => 'PhabricatorApplicationTransactionComment',
'PonderAnswerTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
- 'PonderComment' => array(
- 'PonderDAO',
- 'PhabricatorMarkupInterface',
- ),
- 'PonderCommentQuery' => 'PhabricatorQuery',
'PonderController' => 'PhabricatorController',
'PonderDAO' => 'PhabricatorLiskDAO',
'PonderEditor' => 'PhabricatorApplicationTransactionEditor',
@@ -5795,6 +5789,7 @@
'PonderQuestionTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PonderQuestionViewController' => 'PonderController',
'PonderRemarkupRule' => 'PhabricatorObjectRemarkupRule',
+ 'PonderSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PonderSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
'PonderTransactionFeedStory' => 'PhabricatorApplicationTransactionFeedStory',
'PonderVotableView' => 'AphrontView',
diff --git a/src/applications/config/controller/PhabricatorConfigDatabaseIssueController.php b/src/applications/config/controller/PhabricatorConfigDatabaseIssueController.php
--- a/src/applications/config/controller/PhabricatorConfigDatabaseIssueController.php
+++ b/src/applications/config/controller/PhabricatorConfigDatabaseIssueController.php
@@ -144,8 +144,10 @@
new PhutilNumber($counts[PhabricatorConfigStorageSchema::STATUS_NOTE]));
}
+ $title = pht('Database Issues');
+
$table_box = id(new PHUIObjectBoxView())
- ->setHeaderText(pht('Database Issues'))
+ ->setHeaderText($title)
->setFormErrors($errors)
->appendChild($table);
@@ -160,7 +162,7 @@
return $this->buildApplicationPage(
$nav,
array(
- 'title' => 'all',
+ 'title' => $title,
));
}
diff --git a/src/applications/config/schema/PhabricatorConfigSchemaSpec.php b/src/applications/config/schema/PhabricatorConfigSchemaSpec.php
--- a/src/applications/config/schema/PhabricatorConfigSchemaSpec.php
+++ b/src/applications/config/schema/PhabricatorConfigSchemaSpec.php
@@ -233,6 +233,9 @@
case 'uint32':
$column_type = 'int(10) unsigned';
break;
+ case 'sint32':
+ $column_type = 'int(10)';
+ break;
case 'id64':
case 'uint64':
$column_type = 'bigint(20) unsigned';
diff --git a/src/applications/ponder/query/PonderCommentQuery.php b/src/applications/ponder/query/PonderCommentQuery.php
deleted file mode 100644
--- a/src/applications/ponder/query/PonderCommentQuery.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-
-final class PonderCommentQuery extends PhabricatorQuery {
-
- private $ids;
- private $authorPHID;
- private $targetPHIDs;
-
- public function withIDs($qids) {
- $this->ids = $qids;
- return $this;
- }
-
- public function withTargetPHIDs($phids) {
- $this->targetPHIDs = $phids;
- return $this;
- }
-
- public function withAuthorPHID($phid) {
- $this->authorPHID = $phid;
- return $this;
- }
-
- private function buildWhereClause($conn_r) {
- $where = array();
- if ($this->ids) {
- $where[] = qsprintf($conn_r, 'id in (%Ls)', $this->ids);
- }
- if ($this->authorPHID) {
- $where[] = qsprintf($conn_r, 'authorPHID = %s', $this->authorPHID);
- }
- if ($this->targetPHIDs) {
- $where[] = qsprintf($conn_r, 'targetPHID in (%Ls)', $this->targetPHIDs);
- }
-
- return $this->formatWhereClause($where);
- }
-
- private function buildOrderByClause($conn_r) {
- return 'ORDER BY id';
- }
-
- public function execute() {
- $comment = new PonderComment();
- $conn_r = $comment->establishConnection('r');
-
- $select = qsprintf(
- $conn_r,
- 'SELECT r.* FROM %T r',
- $comment->getTableName());
-
- $where = $this->buildWhereClause($conn_r);
- $order_by = $this->buildOrderByClause($conn_r);
-
- return $comment->loadAllFromArray(
- queryfx_all(
- $conn_r,
- '%Q %Q %Q',
- $select,
- $where,
- $order_by));
- }
-
-
-}
diff --git a/src/applications/ponder/storage/PonderAnswer.php b/src/applications/ponder/storage/PonderAnswer.php
--- a/src/applications/ponder/storage/PonderAnswer.php
+++ b/src/applications/ponder/storage/PonderAnswer.php
@@ -67,6 +67,28 @@
public function getConfiguration() {
return array(
self::CONFIG_AUX_PHID => true,
+ self::CONFIG_COLUMN_SCHEMA => array(
+ 'voteCount' => 'sint32',
+ 'content' => 'text',
+ 'contentSource' => 'text',
+ ),
+ self::CONFIG_KEY_SCHEMA => array(
+ 'key_phid' => null,
+ 'phid' => array(
+ 'columns' => array('phid'),
+ 'unique' => true,
+ ),
+ 'key_oneanswerperquestion' => array(
+ 'columns' => array('questionID', 'authorPHID'),
+ 'unique' => true,
+ ),
+ 'questionID' => array(
+ 'columns' => array('questionID'),
+ ),
+ 'authorPHID' => array(
+ 'columns' => array('authorPHID'),
+ ),
+ ),
) + parent::getConfiguration();
}
diff --git a/src/applications/ponder/storage/PonderComment.php b/src/applications/ponder/storage/PonderComment.php
deleted file mode 100644
--- a/src/applications/ponder/storage/PonderComment.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-
-final class PonderComment extends PonderDAO
- implements PhabricatorMarkupInterface {
-
- const MARKUP_FIELD_CONTENT = 'markup:content';
-
- protected $targetPHID;
- protected $authorPHID;
- protected $content;
-
- public function getMarkupFieldKey($field) {
- $hash = PhabricatorHash::digest($this->getMarkupText($field));
- $id = $this->getID();
- return "ponder:c{$id}:{$field}:{$hash}";
- }
-
- public function getMarkupText($field) {
- return $this->getContent();
- }
-
- public function newMarkupEngine($field) {
- return PhabricatorMarkupEngine::getEngine();
- }
-
- public function didMarkupText(
- $field,
- $output,
- PhutilMarkupEngine $engine) {
- return $output;
- }
-
- public function shouldUseMarkupCache($field) {
- return (bool)$this->getID();
- }
-
- public function getMarkupField() {
- return self::MARKUP_FIELD_CONTENT;
- }
-}
diff --git a/src/applications/ponder/storage/PonderQuestion.php b/src/applications/ponder/storage/PonderQuestion.php
--- a/src/applications/ponder/storage/PonderQuestion.php
+++ b/src/applications/ponder/storage/PonderQuestion.php
@@ -33,6 +33,32 @@
public function getConfiguration() {
return array(
self::CONFIG_AUX_PHID => true,
+ self::CONFIG_COLUMN_SCHEMA => array(
+ 'title' => 'text255',
+ 'voteCount' => 'sint32',
+ 'status' => 'uint32',
+ 'content' => 'text',
+ 'contentSource' => 'text',
+ 'heat' => 'double',
+ 'answerCount' => 'uint32',
+ 'mailKey' => 'bytes20',
+ ),
+ self::CONFIG_KEY_SCHEMA => array(
+ 'key_phid' => null,
+ 'phid' => array(
+ 'columns' => array('phid'),
+ 'unique' => true,
+ ),
+ 'authorPHID' => array(
+ 'columns' => array('authorPHID'),
+ ),
+ 'heat' => array(
+ 'columns' => array('heat'),
+ ),
+ 'status' => array(
+ 'columns' => array('status'),
+ ),
+ ),
) + parent::getConfiguration();
}
@@ -49,27 +75,6 @@
return PhabricatorContentSource::newFromSerialized($this->contentSource);
}
- public function attachRelated() {
- $this->answers = $this->loadRelatives(new PonderAnswer(), 'questionID');
- $qa_phids = mpull($this->answers, 'getPHID') + array($this->getPHID());
-
- if ($qa_phids) {
- $comments = id(new PonderCommentQuery())
- ->withTargetPHIDs($qa_phids)
- ->execute();
-
- $comments = mgroup($comments, 'getTargetPHID');
- } else {
- $comments = array();
- }
-
- $this->setComments(idx($comments, $this->getPHID(), array()));
- foreach ($this->answers as $answer) {
- $answer->attachQuestion($this);
- $answer->setComments(idx($comments, $answer->getPHID(), array()));
- }
- }
-
public function attachVotes($user_phid) {
$qa_phids = mpull($this->answers, 'getPHID') + array($this->getPHID());
diff --git a/src/applications/ponder/storage/PonderSchemaSpec.php b/src/applications/ponder/storage/PonderSchemaSpec.php
new file mode 100644
--- /dev/null
+++ b/src/applications/ponder/storage/PonderSchemaSpec.php
@@ -0,0 +1,19 @@
+<?php
+
+final class PonderSchemaSpec extends PhabricatorConfigSchemaSpec {
+
+ public function buildSchemata() {
+ $this->buildLiskSchemata('PonderDAO');
+
+ $this->buildEdgeSchemata(new PonderQuestion());
+
+ $this->buildTransactionSchema(
+ new PonderQuestionTransaction(),
+ new PonderQuestionTransactionComment());
+
+ $this->buildTransactionSchema(
+ new PonderAnswerTransaction(),
+ new PonderAnswerTransactionComment());
+ }
+
+}

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 16, 2:09 AM (17 h, 47 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6995807
Default Alt Text
D10582.id25411.diff (10 KB)

Event Timeline