Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F109900694
20131004.dxreviewers.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Apr 23, 21:56
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Apr 25, 21:56 (2 d)
Engine
blob
Format
Raw Data
Handle
25752014
Attached To
rPH Phabricator
20131004.dxreviewers.php
View Options
<?php
$table
=
new
DifferentialRevision
();
$conn_w
=
$table
->
establishConnection
(
'w'
);
// NOTE: We migrate by revision because the relationship table doesn't have
// an "id" column.
foreach
(
new
LiskMigrationIterator
(
$table
)
as
$revision
)
{
$revision_id
=
$revision
->
getID
();
$revision_phid
=
$revision
->
getPHID
();
echo
"Migrating reviewers for D{$revision_id}...
\n
"
;
$reviewer_phids
=
queryfx_all
(
$conn_w
,
'SELECT objectPHID FROM %T WHERE revisionID = %d
AND relation = %s ORDER BY sequence'
,
'differential_relationship'
,
$revision_id
,
'revw'
);
$reviewer_phids
=
ipull
(
$reviewer_phids
,
'objectPHID'
);
if
(!
$reviewer_phids
)
{
continue
;
}
$editor
=
id
(
new
PhabricatorEdgeEditor
())
->
setActor
(
PhabricatorUser
::
getOmnipotentUser
());
foreach
(
$reviewer_phids
as
$dst
)
{
$editor
->
addEdge
(
$revision_phid
,
PhabricatorEdgeConfig
::
TYPE_DREV_HAS_REVIEWER
,
$dst
,
array
(
'data'
=>
array
(
'status'
=>
DifferentialReviewerStatus
::
STATUS_ADDED
,
),
));
}
$editor
->
save
();
}
echo
"Done.
\n
"
;
Event Timeline
Log In to Comment