Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F76383
D7370.diff
All Users
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
29 KB
Referenced Files
None
Subscribers
None
D7370.diff
View Options
diff --git a/resources/sql/patches/20131020.pxaction.sql b/resources/sql/patches/20131020.pxaction.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/patches/20131020.pxaction.sql
@@ -0,0 +1,24 @@
+RENAME TABLE {$NAMESPACE}_project.project_transaction
+ TO {$NAMESPACE}_project.project_legacytransaction;
+
+CREATE TABLE {$NAMESPACE}_project.project_transaction (
+ id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ phid VARCHAR(64) NOT NULL COLLATE utf8_bin,
+ authorPHID VARCHAR(64) NOT NULL COLLATE utf8_bin,
+ objectPHID VARCHAR(64) NOT NULL COLLATE utf8_bin,
+ viewPolicy VARCHAR(64) NOT NULL COLLATE utf8_bin,
+ editPolicy VARCHAR(64) NOT NULL COLLATE utf8_bin,
+ commentPHID VARCHAR(64) COLLATE utf8_bin,
+ commentVersion INT UNSIGNED NOT NULL,
+ transactionType VARCHAR(32) NOT NULL COLLATE utf8_bin,
+ oldValue LONGTEXT NOT NULL COLLATE utf8_bin,
+ newValue LONGTEXT NOT NULL COLLATE utf8_bin,
+ contentSource LONGTEXT NOT NULL COLLATE utf8_bin,
+ metadata LONGTEXT NOT NULL COLLATE utf8_bin,
+ dateCreated INT UNSIGNED NOT NULL,
+ dateModified INT UNSIGNED NOT NULL,
+
+ UNIQUE KEY `key_phid` (phid),
+ KEY `key_object` (objectPHID)
+
+) ENGINE=InnoDB, COLLATE utf8_general_ci;
diff --git a/resources/sql/patches/20131020.pxactionmig.php b/resources/sql/patches/20131020.pxactionmig.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/patches/20131020.pxactionmig.php
@@ -0,0 +1,92 @@
+<?php
+
+$project_table = new PhabricatorProject();
+$conn_w = $project_table->establishConnection('w');
+$conn_w->openTransaction();
+
+$src_table = 'project_legacytransaction';
+$dst_table = 'project_transaction';
+
+echo "Migrating Project transactions to new format...\n";
+
+$content_source = PhabricatorContentSource::newForSource(
+ PhabricatorContentSource::SOURCE_LEGACY,
+ array())->serialize();
+
+$rows = new LiskRawMigrationIterator($conn_w, $src_table);
+foreach ($rows as $row) {
+ $id = $row['id'];
+
+ $project_id = $row['projectID'];
+
+ echo "Migrating transaction #{$id} (Project {$project_id})...\n";
+
+ $project_row = queryfx_one(
+ $conn_w,
+ 'SELECT phid FROM %T WHERE id = %d',
+ $project_table->getTableName(),
+ $project_id);
+ if (!$project_row) {
+ continue;
+ }
+
+ $project_phid = $project_row['phid'];
+
+ $type_map = array(
+ 'name' => PhabricatorProjectTransaction::TYPE_NAME,
+ 'members' => PhabricatorProjectTransaction::TYPE_MEMBERS,
+ 'status' => PhabricatorProjectTransaction::TYPE_STATUS,
+ 'canview' => PhabricatorTransactions::TYPE_VIEW_POLICY,
+ 'canedit' => PhabricatorTransactions::TYPE_EDIT_POLICY,
+ 'canjoin' => PhabricatorTransactions::TYPE_JOIN_POLICY,
+ );
+
+ $new_type = idx($type_map, $row['transactionType']);
+ if (!$new_type) {
+ continue;
+ }
+
+ $xaction_phid = PhabricatorPHID::generateNewPHID(
+ PhabricatorApplicationTransactionPHIDTypeTransaction::TYPECONST,
+ PhabricatorProjectPHIDTypeProject::TYPECONST);
+
+ queryfx(
+ $conn_w,
+ 'INSERT IGNORE INTO %T
+ (phid, authorPHID, objectPHID,
+ viewPolicy, editPolicy, commentPHID, commentVersion, transactionType,
+ oldValue, newValue, contentSource, metadata,
+ dateCreated, dateModified)
+ VALUES
+ (%s, %s, %s,
+ %s, %s, %ns, %d, %s,
+ %s, %s, %s, %s,
+ %d, %d)',
+ $dst_table,
+
+ // PHID, Author, Object
+ $xaction_phid,
+ $row['authorPHID'],
+ $project_phid,
+
+ // View, Edit, Comment, Version, Type
+ 'public',
+ $row['authorPHID'],
+ null,
+ 0,
+ $new_type,
+
+ // Old, New, Source, Meta,
+ $row['oldValue'],
+ $row['newValue'],
+ $content_source,
+ '{}',
+
+ // Created, Modified
+ $row['dateCreated'],
+ $row['dateModified']);
+
+}
+
+$conn_w->saveTransaction();
+echo "Done.\n";
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
@@ -1205,7 +1205,6 @@
'PhabricatorFeedStoryManiphestAggregate' => 'applications/feed/story/PhabricatorFeedStoryManiphestAggregate.php',
'PhabricatorFeedStoryNotification' => 'applications/notification/storage/PhabricatorFeedStoryNotification.php',
'PhabricatorFeedStoryPhriction' => 'applications/feed/story/PhabricatorFeedStoryPhriction.php',
- 'PhabricatorFeedStoryProject' => 'applications/feed/story/PhabricatorFeedStoryProject.php',
'PhabricatorFeedStoryPublisher' => 'applications/feed/PhabricatorFeedStoryPublisher.php',
'PhabricatorFeedStoryReference' => 'applications/feed/storage/PhabricatorFeedStoryReference.php',
'PhabricatorFeedStoryStatus' => 'applications/feed/story/PhabricatorFeedStoryStatus.php',
@@ -1542,7 +1541,6 @@
'PhabricatorProjectStatus' => 'applications/project/constants/PhabricatorProjectStatus.php',
'PhabricatorProjectTestDataGenerator' => 'applications/project/lipsum/PhabricatorProjectTestDataGenerator.php',
'PhabricatorProjectTransaction' => 'applications/project/storage/PhabricatorProjectTransaction.php',
- 'PhabricatorProjectTransactionType' => 'applications/project/constants/PhabricatorProjectTransactionType.php',
'PhabricatorProjectUpdateController' => 'applications/project/controller/PhabricatorProjectUpdateController.php',
'PhabricatorQuery' => 'infrastructure/query/PhabricatorQuery.php',
'PhabricatorRecaptchaConfigOptions' => 'applications/config/option/PhabricatorRecaptchaConfigOptions.php',
@@ -3401,7 +3399,6 @@
'PhabricatorFeedStoryManiphestAggregate' => 'PhabricatorFeedStoryAggregate',
'PhabricatorFeedStoryNotification' => 'PhabricatorFeedDAO',
'PhabricatorFeedStoryPhriction' => 'PhabricatorFeedStory',
- 'PhabricatorFeedStoryProject' => 'PhabricatorFeedStory',
'PhabricatorFeedStoryReference' => 'PhabricatorFeedDAO',
'PhabricatorFeedStoryStatus' => 'PhabricatorFeedStory',
'PhabricatorFeedStoryTypeConstants' => 'PhabricatorFeedConstants',
@@ -3772,8 +3769,7 @@
'PhabricatorProjectSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhabricatorProjectSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
'PhabricatorProjectTestDataGenerator' => 'PhabricatorTestDataGenerator',
- 'PhabricatorProjectTransaction' => 'PhabricatorProjectDAO',
- 'PhabricatorProjectTransactionType' => 'PhabricatorProjectConstants',
+ 'PhabricatorProjectTransaction' => 'PhabricatorApplicationTransaction',
'PhabricatorProjectUpdateController' => 'PhabricatorProjectController',
'PhabricatorRecaptchaConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorRedirectController' => 'PhabricatorController',
diff --git a/src/applications/feed/constants/PhabricatorFeedStoryTypeConstants.php b/src/applications/feed/constants/PhabricatorFeedStoryTypeConstants.php
--- a/src/applications/feed/constants/PhabricatorFeedStoryTypeConstants.php
+++ b/src/applications/feed/constants/PhabricatorFeedStoryTypeConstants.php
@@ -3,11 +3,7 @@
final class PhabricatorFeedStoryTypeConstants
extends PhabricatorFeedConstants {
- const STORY_STATUS = 'PhabricatorFeedStoryStatus';
- const STORY_DIFFERENTIAL = 'PhabricatorFeedStoryDifferential';
const STORY_PHRICTION = 'PhabricatorFeedStoryPhriction';
- const STORY_MANIPHEST = 'PhabricatorFeedStoryManiphest';
- const STORY_PROJECT = 'PhabricatorFeedStoryProject';
const STORY_AUDIT = 'PhabricatorFeedStoryAudit';
const STORY_COMMIT = 'PhabricatorFeedStoryCommit';
diff --git a/src/applications/feed/story/PhabricatorFeedStoryProject.php b/src/applications/feed/story/PhabricatorFeedStoryProject.php
deleted file mode 100644
--- a/src/applications/feed/story/PhabricatorFeedStoryProject.php
+++ /dev/null
@@ -1,224 +0,0 @@
-<?php
-
-final class PhabricatorFeedStoryProject extends PhabricatorFeedStory {
-
- public function getPrimaryObjectPHID() {
- return $this->getValue('projectPHID');
- }
-
- public function getRequiredHandlePHIDs() {
- $req_phids = array();
- $data = $this->getStoryData();
- switch ($data->getValue('type')) {
- case PhabricatorProjectTransactionType::TYPE_MEMBERS:
- $old = $data->getValue('old');
- $new = $data->getValue('new');
- $add = array_diff($new, $old);
- $rem = array_diff($old, $new);
- $req_phids = array_merge($add, $rem);
- break;
- }
- return array_merge($req_phids, parent::getRequiredHandlePHIDs());
- }
-
- public function renderView() {
- $data = $this->getStoryData();
-
- $view = $this->newStoryView();
- $view->setAppIcon('projects-dark');
-
- $type = $data->getValue('type');
- $old = $data->getValue('old');
- $new = $data->getValue('new');
- $proj_phid = $data->getValue('projectPHID');
-
- $author_phid = $data->getAuthorPHID();
- $author_link = $this->linkTo($author_phid);
-
- switch ($type) {
- case PhabricatorProjectTransactionType::TYPE_NAME:
- if (strlen($old)) {
- $action = pht(
- '%s renamed project %s from %s to %s.',
- $author_link,
- $this->linkTo($proj_phid),
- $this->renderString($old),
- $this->renderString($new));
- } else {
- $action = pht(
- '%s created project %s (as %s).',
- $author_link,
- $this->linkTo($proj_phid),
- $this->renderString($new));
- }
- break;
- case PhabricatorProjectTransactionType::TYPE_STATUS:
- $old_name = PhabricatorProjectStatus::getNameForStatus($old);
- $new_name = PhabricatorProjectStatus::getNameForStatus($new);
- $action = pht(
- '%s changed project %s status from %s to %s.',
- $author_link,
- $this->linkTo($proj_phid),
- $this->renderString($old_name),
- $this->renderString($new_name));
- break;
- case PhabricatorProjectTransactionType::TYPE_MEMBERS:
- $add = array_diff($new, $old);
- $rem = array_diff($old, $new);
-
- if ((count($add) == 1) && (count($rem) == 0) &&
- (head($add) == $author_phid)) {
- $action = pht(
- '%s joined project %s.',
- $author_link,
- $this->linkTo($proj_phid));
- } else if ((count($add) == 0) && (count($rem) == 1) &&
- (head($rem) == $author_phid)) {
- $action = pht(
- '%s left project %s.',
- $author_link,
- $this->linkTo($proj_phid));
- } else if (empty($rem)) {
- $action = pht(
- '%s added members to project %s: %s.',
- $author_link,
- $this->linkTo($proj_phid),
- $this->renderHandleList($add));
- } else if (empty($add)) {
- $action = pht(
- '%s removed members from project %s: %s.',
- $author_link,
- $this->linkTo($proj_phid),
- $this->renderHandleList($rem));
- } else {
- $action = pht(
- '%s changed members of project %s, added: %s; removed: %s.',
- $author_link,
- $this->linkTo($proj_phid),
- $this->renderHandleList($add),
- $this->renderHandleList($rem));
- }
- break;
- case PhabricatorProjectTransactionType::TYPE_CAN_VIEW:
- $action = pht(
- '%s changed the visibility for %s.',
- $author_link,
- $this->linkTo($proj_phid));
- break;
- case PhabricatorProjectTransactionType::TYPE_CAN_EDIT:
- $action = pht(
- '%s changed the edit policy for %s.',
- $author_link,
- $this->linkTo($proj_phid));
- break;
- case PhabricatorProjectTransactionType::TYPE_CAN_JOIN:
- $action = pht(
- '%s changed the join policy for %s.',
- $author_link,
- $this->linkTo($proj_phid));
- break;
- default:
- $action = pht(
- '%s updated project %s.',
- $author_link,
- $this->linkTo($proj_phid));
- break;
- }
-
- $view->setTitle($action);
- $view->setImage($this->getHandle($author_phid)->getImageURI());
-
- return $view;
- }
-
- public function renderText() {
- $type = $this->getValue('type');
- $old = $this->getValue('old');
- $new = $this->getValue('new');
-
- $proj_handle = $this->getHandle($this->getPrimaryObjectPHID());
- $proj_name = $proj_handle->getLinkName();
- $proj_uri = PhabricatorEnv::getURI($proj_handle->getURI());
-
- $author_phid = $this->getAuthorPHID();
- $author_name = $this->linkTo($author_phid);
-
- switch ($type) {
- case PhabricatorProjectTransactionType::TYPE_NAME:
- if (strlen($old)) {
- $text =
- pht('%s renamed project %s from %s to %s %s',
- $author_name,
- $proj_name,
- $old,
- $new,
- $proj_uri);
- } else {
- $text =
- pht('%s created project %s (as %s) %s',
- $author_name,
- $proj_name,
- $new,
- $proj_uri);
- }
- break;
- case PhabricatorProjectTransactionType::TYPE_STATUS:
- $text =
- pht('%s changed project %s status from %s to %s %s',
- $author_name,
- $proj_name,
- $old,
- $new,
- $proj_uri);
- break;
- case PhabricatorProjectTransactionType::TYPE_MEMBERS:
- $add = array_diff($new, $old);
- $rem = array_diff($old, $new);
-
- if ((count($add) == 1) && (count($rem) == 0) &&
- (head($add) == $author_phid)) {
- $text =
- pht('%s joined project %s %s',
- $author_name,
- $proj_name,
- $proj_uri);
- } else if ((count($add) == 0) && (count($rem) == 1) &&
- (head($rem) == $author_phid)) {
- $text =
- pht('%s left project %s %s',
- $author_name,
- $proj_name,
- $proj_uri);
- } else if (empty($rem)) {
- $text =
- pht('%s added members to project %s %s',
- $author_name,
- $proj_name,
- $proj_uri);
- } else if (empty($add)) {
- $text =
- pht('%s removed members from project %s %s',
- $author_name,
- $proj_name,
- $proj_uri);
- } else {
- $text =
- pht('%s changed members of project %s %s',
- $author_name,
- $proj_name,
- $proj_uri);
- }
- break;
- default:
- $text =
- pht('%s updated project %s %s',
- $author_name,
- $proj_name,
- $proj_uri);
- break;
- }
-
- return $text;
- }
-
-}
diff --git a/src/applications/project/constants/PhabricatorProjectTransactionType.php b/src/applications/project/constants/PhabricatorProjectTransactionType.php
deleted file mode 100644
--- a/src/applications/project/constants/PhabricatorProjectTransactionType.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-final class PhabricatorProjectTransactionType
- extends PhabricatorProjectConstants {
-
- const TYPE_NAME = 'name';
- const TYPE_MEMBERS = 'members';
- const TYPE_STATUS = 'status';
- const TYPE_CAN_VIEW = 'canview';
- const TYPE_CAN_EDIT = 'canedit';
- const TYPE_CAN_JOIN = 'canjoin';
-
-}
diff --git a/src/applications/project/controller/PhabricatorProjectCreateController.php b/src/applications/project/controller/PhabricatorProjectCreateController.php
--- a/src/applications/project/controller/PhabricatorProjectCreateController.php
+++ b/src/applications/project/controller/PhabricatorProjectCreateController.php
@@ -26,13 +26,13 @@
$xaction = new PhabricatorProjectTransaction();
$xaction->setTransactionType(
- PhabricatorProjectTransactionType::TYPE_NAME);
+ PhabricatorProjectTransaction::TYPE_NAME);
$xaction->setNewValue($request->getStr('name'));
$xactions[] = $xaction;
$xaction = new PhabricatorProjectTransaction();
$xaction->setTransactionType(
- PhabricatorProjectTransactionType::TYPE_MEMBERS);
+ PhabricatorProjectTransaction::TYPE_MEMBERS);
$xaction->setNewValue(array($user->getPHID()));
$xactions[] = $xaction;
diff --git a/src/applications/project/controller/PhabricatorProjectMembersEditController.php b/src/applications/project/controller/PhabricatorProjectMembersEditController.php
--- a/src/applications/project/controller/PhabricatorProjectMembersEditController.php
+++ b/src/applications/project/controller/PhabricatorProjectMembersEditController.php
@@ -54,7 +54,7 @@
if ($changed_something) {
$xaction = new PhabricatorProjectTransaction();
$xaction->setTransactionType(
- PhabricatorProjectTransactionType::TYPE_MEMBERS);
+ PhabricatorProjectTransaction::TYPE_MEMBERS);
$xaction->setNewValue(array_keys($member_map));
$xactions[] = $xaction;
}
diff --git a/src/applications/project/controller/PhabricatorProjectProfileEditController.php b/src/applications/project/controller/PhabricatorProjectProfileEditController.php
--- a/src/applications/project/controller/PhabricatorProjectProfileEditController.php
+++ b/src/applications/project/controller/PhabricatorProjectProfileEditController.php
@@ -39,31 +39,31 @@
$xactions = array();
$xaction = new PhabricatorProjectTransaction();
$xaction->setTransactionType(
- PhabricatorProjectTransactionType::TYPE_NAME);
+ PhabricatorProjectTransaction::TYPE_NAME);
$xaction->setNewValue($request->getStr('name'));
$xactions[] = $xaction;
$xaction = new PhabricatorProjectTransaction();
$xaction->setTransactionType(
- PhabricatorProjectTransactionType::TYPE_STATUS);
+ PhabricatorProjectTransaction::TYPE_STATUS);
$xaction->setNewValue($request->getStr('status'));
$xactions[] = $xaction;
$xaction = new PhabricatorProjectTransaction();
$xaction->setTransactionType(
- PhabricatorProjectTransactionType::TYPE_CAN_VIEW);
+ PhabricatorTransactions::TYPE_VIEW_POLICY);
$xaction->setNewValue($request->getStr('can_view'));
$xactions[] = $xaction;
$xaction = new PhabricatorProjectTransaction();
$xaction->setTransactionType(
- PhabricatorProjectTransactionType::TYPE_CAN_EDIT);
+ PhabricatorTransactions::TYPE_EDIT_POLICY);
$xaction->setNewValue($request->getStr('can_edit'));
$xactions[] = $xaction;
$xaction = new PhabricatorProjectTransaction();
$xaction->setTransactionType(
- PhabricatorProjectTransactionType::TYPE_CAN_JOIN);
+ PhabricatorTransactions::TYPE_JOIN_POLICY);
$xaction->setNewValue($request->getStr('can_join'));
$xactions[] = $xaction;
diff --git a/src/applications/project/editor/PhabricatorProjectEditor.php b/src/applications/project/editor/PhabricatorProjectEditor.php
--- a/src/applications/project/editor/PhabricatorProjectEditor.php
+++ b/src/applications/project/editor/PhabricatorProjectEditor.php
@@ -28,7 +28,7 @@
self::applyOneTransaction(
$project,
$user,
- PhabricatorProjectTransactionType::TYPE_MEMBERS,
+ PhabricatorProjectTransaction::TYPE_MEMBERS,
$members);
}
@@ -43,7 +43,7 @@
self::applyOneTransaction(
$project,
$user,
- PhabricatorProjectTransactionType::TYPE_MEMBERS,
+ PhabricatorProjectTransaction::TYPE_MEMBERS,
$members);
}
@@ -149,15 +149,16 @@
foreach ($transactions as $xaction) {
$xaction->setAuthorPHID($actor->getPHID());
- $xaction->setProjectID($project->getID());
+ $xaction->setObjectPHID($project->getPHID());
+ $xaction->setViewPolicy('public');
+ $xaction->setEditPolicy($actor->getPHID());
+ $xaction->setContentSource(
+ PhabricatorContentSource::newForSource(
+ PhabricatorContentSource::SOURCE_LEGACY,
+ array()));
$xaction->save();
}
$project->saveTransaction();
-
- foreach ($transactions as $xaction) {
- $this->publishTransactionStory($project, $xaction);
- }
-
} catch (AphrontQueryDuplicateKeyException $ex) {
// We already validated the slug, but might race. Try again to see if
// that's the issue. If it is, we'll throw a more specific exception. If
@@ -206,13 +207,13 @@
$type = $xaction->getTransactionType();
switch ($type) {
- case PhabricatorProjectTransactionType::TYPE_NAME:
+ case PhabricatorProjectTransaction::TYPE_NAME:
$xaction->setOldValue($project->getName());
break;
- case PhabricatorProjectTransactionType::TYPE_STATUS:
+ case PhabricatorProjectTransaction::TYPE_STATUS:
$xaction->setOldValue($project->getStatus());
break;
- case PhabricatorProjectTransactionType::TYPE_MEMBERS:
+ case PhabricatorProjectTransaction::TYPE_MEMBERS:
$member_phids = $project->getMemberPHIDs();
$old_value = array_values($member_phids);
@@ -224,13 +225,13 @@
$new_value = array_values($new_value);
$xaction->setNewValue($new_value);
break;
- case PhabricatorProjectTransactionType::TYPE_CAN_VIEW:
+ case PhabricatorTransactions::TYPE_VIEW_POLICY:
$xaction->setOldValue($project->getViewPolicy());
break;
- case PhabricatorProjectTransactionType::TYPE_CAN_EDIT:
+ case PhabricatorTransactions::TYPE_EDIT_POLICY:
$xaction->setOldValue($project->getEditPolicy());
break;
- case PhabricatorProjectTransactionType::TYPE_CAN_JOIN:
+ case PhabricatorTransactions::TYPE_JOIN_POLICY:
$xaction->setOldValue($project->getJoinPolicy());
break;
default:
@@ -245,7 +246,7 @@
$type = $xaction->getTransactionType();
switch ($type) {
- case PhabricatorProjectTransactionType::TYPE_NAME:
+ case PhabricatorProjectTransaction::TYPE_NAME:
$old_slug = $project->getFullPhrictionSlug();
$project->setName($xaction->getNewValue());
$project->setPhrictionSlug($xaction->getNewValue());
@@ -279,63 +280,38 @@
}
$this->validateName($project);
break;
- case PhabricatorProjectTransactionType::TYPE_STATUS:
+ case PhabricatorProjectTransaction::TYPE_STATUS:
$project->setStatus($xaction->getNewValue());
break;
- case PhabricatorProjectTransactionType::TYPE_MEMBERS:
+ case PhabricatorProjectTransaction::TYPE_MEMBERS:
$old = array_fill_keys($xaction->getOldValue(), true);
$new = array_fill_keys($xaction->getNewValue(), true);
$this->addEdges = array_keys(array_diff_key($new, $old));
$this->remEdges = array_keys(array_diff_key($old, $new));
if ($new === array()) {
$this->setShouldArchive(true);
}
break;
- case PhabricatorProjectTransactionType::TYPE_CAN_VIEW:
+ case PhabricatorTransactions::TYPE_VIEW_POLICY:
$project->setViewPolicy($xaction->getNewValue());
break;
- case PhabricatorProjectTransactionType::TYPE_CAN_EDIT:
+ case PhabricatorTransactions::TYPE_EDIT_POLICY:
$project->setEditPolicy($xaction->getNewValue());
// You can't edit away your ability to edit the project.
PhabricatorPolicyFilter::mustRetainCapability(
$this->getActor(),
$project,
PhabricatorPolicyCapability::CAN_EDIT);
break;
- case PhabricatorProjectTransactionType::TYPE_CAN_JOIN:
+ case PhabricatorTransactions::TYPE_JOIN_POLICY:
$project->setJoinPolicy($xaction->getNewValue());
break;
default:
throw new Exception("Unknown transaction type '{$type}'!");
}
}
- private function publishTransactionStory(
- PhabricatorProject $project,
- PhabricatorProjectTransaction $xaction) {
-
- $related_phids = array(
- $project->getPHID(),
- $xaction->getAuthorPHID(),
- );
-
- id(new PhabricatorFeedStoryPublisher())
- ->setStoryType(PhabricatorFeedStoryTypeConstants::STORY_PROJECT)
- ->setStoryData(
- array(
- 'projectPHID' => $project->getPHID(),
- 'transactionID' => $xaction->getID(),
- 'type' => $xaction->getTransactionType(),
- 'old' => $xaction->getOldValue(),
- 'new' => $xaction->getNewValue(),
- ))
- ->setStoryTime(time())
- ->setStoryAuthorPHID($xaction->getAuthorPHID())
- ->setRelatedPHIDs($related_phids)
- ->publish();
- }
-
private function transactionHasEffect(
PhabricatorProjectTransaction $xaction) {
return ($xaction->getOldValue() !== $xaction->getNewValue());
@@ -375,12 +351,12 @@
PhabricatorProjectTransaction $xaction) {
$type = $xaction->getTransactionType();
- if ($type != PhabricatorProjectTransactionType::TYPE_MEMBERS) {
+ if ($type != PhabricatorProjectTransaction::TYPE_MEMBERS) {
return null;
}
switch ($type) {
- case PhabricatorProjectTransactionType::TYPE_MEMBERS:
+ case PhabricatorProjectTransaction::TYPE_MEMBERS:
$old = $xaction->getOldValue();
$new = $xaction->getNewValue();
diff --git a/src/applications/project/editor/__tests__/PhabricatorProjectEditorTestCase.php b/src/applications/project/editor/__tests__/PhabricatorProjectEditorTestCase.php
--- a/src/applications/project/editor/__tests__/PhabricatorProjectEditorTestCase.php
+++ b/src/applications/project/editor/__tests__/PhabricatorProjectEditorTestCase.php
@@ -94,7 +94,7 @@
$new_name = $proj->getName().' '.mt_rand();
$xaction = new PhabricatorProjectTransaction();
- $xaction->setTransactionType(PhabricatorProjectTransactionType::TYPE_NAME);
+ $xaction->setTransactionType(PhabricatorProjectTransaction::TYPE_NAME);
$xaction->setNewValue($new_name);
$editor = new PhabricatorProjectEditor($proj);
diff --git a/src/applications/project/lipsum/PhabricatorProjectTestDataGenerator.php b/src/applications/project/lipsum/PhabricatorProjectTestDataGenerator.php
--- a/src/applications/project/lipsum/PhabricatorProjectTestDataGenerator.php
+++ b/src/applications/project/lipsum/PhabricatorProjectTestDataGenerator.php
@@ -14,22 +14,22 @@
->setAuthorPHID($authorPHID);
$this->addTransaction(
- PhabricatorProjectTransactionType::TYPE_NAME,
+ PhabricatorProjectTransaction::TYPE_NAME,
$title);
$this->addTransaction(
- PhabricatorProjectTransactionType::TYPE_MEMBERS,
+ PhabricatorProjectTransaction::TYPE_MEMBERS,
$this->loadMembersWithAuthor($authorPHID));
$this->addTransaction(
- PhabricatorProjectTransactionType::TYPE_STATUS,
+ PhabricatorProjectTransaction::TYPE_STATUS,
$this->generateProjectStatus());
$this->addTransaction(
- PhabricatorProjectTransactionType::TYPE_CAN_VIEW,
+ PhabricatorTransactions::TYPE_VIEW_POLICY,
PhabricatorPolicies::POLICY_PUBLIC);
$this->addTransaction(
- PhabricatorProjectTransactionType::TYPE_CAN_EDIT,
+ PhabricatorTransactions::TYPE_EDIT_POLICY,
PhabricatorPolicies::POLICY_PUBLIC);
$this->addTransaction(
- PhabricatorProjectTransactionType::TYPE_CAN_JOIN,
+ PhabricatorTransactions::TYPE_JOIN_POLICY,
PhabricatorPolicies::POLICY_PUBLIC);
$editor = id(new PhabricatorProjectEditor($project))
diff --git a/src/applications/project/storage/PhabricatorProjectTransaction.php b/src/applications/project/storage/PhabricatorProjectTransaction.php
--- a/src/applications/project/storage/PhabricatorProjectTransaction.php
+++ b/src/applications/project/storage/PhabricatorProjectTransaction.php
@@ -1,23 +1,18 @@
<?php
-/**
- * @group project
- */
-final class PhabricatorProjectTransaction extends PhabricatorProjectDAO {
+final class PhabricatorProjectTransaction
+ extends PhabricatorApplicationTransaction {
- protected $projectID;
- protected $authorPHID;
- protected $transactionType;
- protected $oldValue;
- protected $newValue;
+ const TYPE_NAME = 'project:name';
+ const TYPE_MEMBERS = 'project:members';
+ const TYPE_STATUS = 'project:status';
- public function getConfiguration() {
- return array(
- self::CONFIG_SERIALIZATION => array(
- 'oldValue' => self::SERIALIZATION_JSON,
- 'newValue' => self::SERIALIZATION_JSON,
- ),
- ) + parent::getConfiguration();
+ public function getApplicationName() {
+ return 'project';
+ }
+
+ public function getApplicationTransactionType() {
+ return PhabricatorProjectPHIDTypeProject::TYPECONST;
}
}
diff --git a/src/applications/transactions/constants/PhabricatorTransactions.php b/src/applications/transactions/constants/PhabricatorTransactions.php
--- a/src/applications/transactions/constants/PhabricatorTransactions.php
+++ b/src/applications/transactions/constants/PhabricatorTransactions.php
@@ -6,6 +6,7 @@
const TYPE_SUBSCRIBERS = 'core:subscribers';
const TYPE_VIEW_POLICY = 'core:view-policy';
const TYPE_EDIT_POLICY = 'core:edit-policy';
+ const TYPE_JOIN_POLICY = 'core:join-policy';
const TYPE_EDGE = 'core:edge';
const TYPE_CUSTOMFIELD = 'core:customfield';
diff --git a/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php b/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php
--- a/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php
+++ b/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php
@@ -1692,6 +1692,14 @@
'type' => 'sql',
'name' => $this->getPatchPath('20131020.col1.sql'),
),
+ '20131020.pxaction.sql' => array(
+ 'type' => 'sql',
+ 'name' => $this->getPatchPath('20131020.pxaction.sql'),
+ ),
+ '20131020.pxactionmig.php' => array(
+ 'type' => 'php',
+ 'name' => $this->getPatchPath('20131020.pxactionmig.php'),
+ ),
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/hv/2e/h4it2fzp73mrd3e6
Default Alt Text
D7370.diff (29 KB)
Attached To
Mode
D7370: Move Project transaction storage to modern tables
Attached
Detach File
Event Timeline
Log In to Comment