Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93634356
20140706.harbormasterdepend.1.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
Sat, Nov 30, 07:54
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Dec 2, 07:54 (2 d)
Engine
blob
Format
Raw Data
Handle
22680648
Attached To
rPH Phabricator
20140706.harbormasterdepend.1.php
View Options
<?php
$plan_table
=
new
HarbormasterBuildPlan
();
$step_table
=
new
HarbormasterBuildStep
();
$conn_w
=
$plan_table
->
establishConnection
(
'w'
);
foreach
(
new
LiskMigrationIterator
(
$plan_table
)
as
$plan
)
{
echo
pht
(
"Migrating build plan %d: %s...
\n
"
,
$plan
->
getID
(),
$plan
->
getName
());
// Load all build steps in order using the step sequence.
$steps
=
queryfx_all
(
$conn_w
,
'SELECT id FROM %T WHERE buildPlanPHID = %s ORDER BY sequence ASC;'
,
$step_table
->
getTableName
(),
$plan
->
getPHID
());
$previous_step
=
null
;
foreach
(
$steps
as
$step
)
{
$id
=
$step
[
'id'
];
$loaded_step
=
id
(
new
HarbormasterBuildStep
())->
load
(
$id
);
$depends_on
=
$loaded_step
->
getDetail
(
'dependsOn'
);
if
(
$depends_on
!==
null
)
{
// This plan already contains steps with depends_on set, so
// we skip since there's nothing to migrate.
break
;
}
if
(
$previous_step
===
null
)
{
$depends_on
=
array
();
}
else
{
$depends_on
=
array
(
$previous_step
->
getPHID
());
}
$loaded_step
->
setDetail
(
'dependsOn'
,
$depends_on
);
queryfx
(
$conn_w
,
'UPDATE %T SET details = %s WHERE id = %d'
,
$step_table
->
getTableName
(),
json_encode
(
$loaded_step
->
getDetails
()),
$loaded_step
->
getID
());
$previous_step
=
$loaded_step
;
echo
pht
(
" Migrated build step %d.
\n
"
,
$loaded_step
->
getID
());
}
}
Event Timeline
Log In to Comment