Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93011798
131.migraterevisionquery.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
Mon, Nov 25, 14:01
Size
823 B
Mime Type
text/x-php
Expires
Wed, Nov 27, 14:01 (2 d)
Engine
blob
Format
Raw Data
Handle
22557356
Attached To
rPH Phabricator
131.migraterevisionquery.php
View Options
<?php
$table
=
new
DifferentialRevision
();
$table
->
openTransaction
();
$table
->
beginReadLocking
();
$conn_w
=
$table
->
establishConnection
(
'w'
);
echo
pht
(
'Migrating revisions'
).
"
\n
"
;
do
{
$revisions
=
$table
->
loadAllWhere
(
'branchName IS NULL LIMIT 1000'
);
foreach
(
$revisions
as
$revision
)
{
echo
'.'
;
$diff
=
$revision
->
loadActiveDiff
();
if
(!
$diff
)
{
continue
;
}
$branch_name
=
$diff
->
getBranch
();
$arc_project_phid
=
$diff
->
getArcanistProjectPHID
();
queryfx
(
$conn_w
,
'UPDATE %T SET branchName = %s, arcanistProjectPHID = %s WHERE id = %d'
,
$table
->
getTableName
(),
$branch_name
,
$arc_project_phid
,
$revision
->
getID
());
}
}
while
(
count
(
$revisions
)
==
1000
);
$table
->
endReadLocking
();
$table
->
saveTransaction
();
echo
"
\n
"
.
pht
(
'Done.'
).
"
\n
"
;
Event Timeline
Log In to Comment