Skip to content

Commit 973bb0c

Browse files
author
epriestley
committedAug 21, 2013
Remove ReleephRequestEvent
Summary: Ref T3663. This is obsolete code which is used only in this migration, which Facebook has already performed and which isn't relevant for any other installs. Test Plan: `grep` Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T3663 Differential Revision: https://secure.phabricator.com/D6777
1 parent 43b35a0 commit 973bb0c

File tree

4 files changed

+5
-232
lines changed

4 files changed

+5
-232
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,8 @@
11
<?php
22

3-
echo "Migrating Releeph requests events to transactions...\n";
3+
// Previously, this migrated ReleephRequestEvents into ApplicationTransactions.
4+
// Only Facebook ever generated meaningful ReleephRequestEvent data, and has
5+
// already migrated, so this was cleaned up when ReleephRequestEvent was
6+
// removed.
47

5-
$table = new ReleephRequest();
6-
$table->openTransaction();
7-
$table->beginReadLocking();
8-
9-
foreach (new LiskMigrationIterator($table) as $rq) {
10-
printf("RQ%d:", $rq->getID());
11-
12-
$intents_cursor = array();
13-
$last_pick_status = null;
14-
$last_commit_id = null;
15-
16-
foreach ($rq->loadEvents() as $event) {
17-
$author = $event->getActorPHID();
18-
$details = $event->getDetails();
19-
20-
$content_source = PhabricatorContentSource::newForSource(
21-
PhabricatorContentSource::SOURCE_UNKNOWN,
22-
array('ReleephRequestEventID' => $event->getID()));
23-
24-
$xaction = id(new ReleephRequestTransaction())
25-
->setObjectPHID($rq->getPHID())
26-
->setAuthorPHID($author)
27-
->setContentSource($content_source)
28-
->setDateCreated($event->getDateCreated())
29-
->setDateModified($event->getDateModified())
30-
->setViewPolicy(PhabricatorPolicies::POLICY_PUBLIC)
31-
->setEditPolicy($author);
32-
33-
printf(" %s(#%d)", $event->getType(), $event->getID());
34-
35-
switch ($event->getType()) {
36-
case ReleephRequestEvent::TYPE_COMMENT:
37-
$xaction
38-
->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)
39-
->save(); // to generate a PHID
40-
$comment = id(new ReleephRequestTransactionComment())
41-
->setAuthorPHID($author)
42-
->setTransactionPHID($xaction->getPHID())
43-
->setViewPolicy(PhabricatorPolicies::POLICY_PUBLIC)
44-
->setEditPolicy($author)
45-
->setCommentVersion(1)
46-
->setContent($event->getComment())
47-
->setContentSource($content_source)
48-
->save();
49-
$xaction
50-
->setCommentPHID($comment->getPHID())
51-
->setCommentVersion(1);
52-
break;
53-
54-
case ReleephRequestEvent::TYPE_STATUS:
55-
// Ignore STATUS events; these are legacy events that we no longer
56-
// support anyway!
57-
continue 2;
58-
59-
case ReleephRequestEvent::TYPE_USER_INTENT:
60-
$old_intent = idx($intents_cursor, $author);
61-
$new_intent = $event->getDetail('newIntent');
62-
$xaction
63-
->setTransactionType(ReleephRequestTransaction::TYPE_USER_INTENT)
64-
->setMetadataValue('isAuthoritative', $event->getDetail('wasPusher'))
65-
->setOldValue($old_intent)
66-
->setNewValue($new_intent);
67-
$intents_cursor[$author] = $new_intent;
68-
break;
69-
70-
case ReleephRequestEvent::TYPE_PICK_STATUS:
71-
$new_pick_status = $event->getDetail('newPickStatus');
72-
$xaction
73-
->setTransactionType(ReleephRequestTransaction::TYPE_PICK_STATUS)
74-
->setOldValue($last_pick_status)
75-
->setNewValue($new_pick_status);
76-
$last_pick_status = $new_pick_status;
77-
break;
78-
79-
case ReleephRequestEvent::TYPE_COMMIT:
80-
$new_commit_id = $event->getDetail('newCommitIdentifier');
81-
$xaction
82-
->setTransactionType(ReleephRequestTransaction::TYPE_COMMIT)
83-
->setMetadataValue('action', $event->getDetail('action'))
84-
->setOldValue($last_commit_id)
85-
->setNewValue($new_commit_id);
86-
$last_commit_id = $new_commit_id;
87-
break;
88-
89-
case ReleephRequestEvent::TYPE_DISCOVERY:
90-
$xaction
91-
->setTransactionType(ReleephRequestTransaction::TYPE_DISCOVERY)
92-
->setNewValue($event->getDetail('newCommitPHID'));
93-
break;
94-
95-
case ReleephRequestEvent::TYPE_CREATE:
96-
$xaction
97-
->setTransactionType(ReleephRequestTransaction::TYPE_REQUEST)
98-
->setOldValue(null)
99-
->setNewValue($rq->getRequestCommitPHID());
100-
break;
101-
102-
case ReleephRequestEvent::TYPE_MANUAL_ACTION:
103-
$xaction
104-
->setTransactionType(
105-
ReleephRequestTransaction::TYPE_MANUAL_IN_BRANCH);
106-
switch ($event->getDetail('action')) {
107-
case 'pick':
108-
$xaction->setNewValue(1);
109-
break;
110-
111-
case 'revert':
112-
$xaction->setNewValue(0);
113-
break;
114-
}
115-
break;
116-
117-
default:
118-
throw new Exception(sprintf(
119-
"Unhandled ReleephRequestEvent type '%s' in RQ%d",
120-
$event->getType(),
121-
$rq->getID()));
122-
}
123-
124-
$xaction->save();
125-
}
126-
echo("\n");
127-
}
128-
129-
$table->endReadLocking();
130-
$table->saveTransaction();
131-
echo "Done.\n";
8+
echo "(This migration is obsolete.)\n";

‎src/__phutil_library_map__.php

-2
Original file line numberDiff line numberDiff line change
@@ -1987,7 +1987,6 @@
19871987
'ReleephRequestCommentController' => 'applications/releeph/controller/request/ReleephRequestCommentController.php',
19881988
'ReleephRequestDifferentialCreateController' => 'applications/releeph/controller/request/ReleephRequestDifferentialCreateController.php',
19891989
'ReleephRequestEditController' => 'applications/releeph/controller/request/ReleephRequestEditController.php',
1990-
'ReleephRequestEvent' => 'applications/releeph/storage/request/ReleephRequestEvent.php',
19911990
'ReleephRequestException' => 'applications/releeph/storage/request/exception/ReleephRequestException.php',
19921991
'ReleephRequestHeaderListView' => 'applications/releeph/view/request/header/ReleephRequestHeaderListView.php',
19931992
'ReleephRequestHeaderView' => 'applications/releeph/view/request/header/ReleephRequestHeaderView.php',
@@ -4189,7 +4188,6 @@
41894188
'ReleephRequestCommentController' => 'ReleephProjectController',
41904189
'ReleephRequestDifferentialCreateController' => 'ReleephProjectController',
41914190
'ReleephRequestEditController' => 'ReleephProjectController',
4192-
'ReleephRequestEvent' => 'ReleephDAO',
41934191
'ReleephRequestException' => 'Exception',
41944192
'ReleephRequestHeaderListView' => 'AphrontView',
41954193
'ReleephRequestHeaderView' => 'AphrontView',

‎src/applications/releeph/storage/ReleephRequest.php

-8
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,6 @@ public function loadReleephProject() {
234234
return $this->loadReleephBranch()->loadReleephProject();
235235
}
236236

237-
public function loadEvents() {
238-
return $this->loadRelatives(
239-
new ReleephRequestEvent(),
240-
'releephRequestID',
241-
'getID',
242-
'(1 = 1) ORDER BY dateCreated, id');
243-
}
244-
245237
public function loadPhabricatorRepositoryCommit() {
246238
return $this->loadOneRelative(
247239
new PhabricatorRepositoryCommit(),

‎src/applications/releeph/storage/request/ReleephRequestEvent.php

-94
This file was deleted.

0 commit comments

Comments
 (0)
Failed to load comments.