Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2890234
20141222.maniphestprojtxn.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
20141222.maniphestprojtxn.php
View Options
<?php
$table
=
new
ManiphestTransaction
(
)
;
$conn_w
=
$table
->
establishConnection
(
'w'
)
;
echo
pht
(
"Converting Maniphest project transactions to modern edge transactions...\n"
)
;
$metadata
=
array
(
'edge:type'
=>
PhabricatorProjectObjectHasProjectEdgeType
::
EDGECONST
,
)
;
foreach
(
new
LiskMigrationIterator
(
$table
)
as
$txn
)
{
if
(
$txn
->
getTransactionType
(
)
!=
'projects'
)
{
continue
;
}
$old_value
=
mig20141222_build_edge_data
(
$txn
->
getOldValue
(
)
,
$txn
->
getObjectPHID
(
)
)
;
$new_value
=
mig20141222_build_edge_data
(
$txn
->
getNewValue
(
)
,
$txn
->
getObjectPHID
(
)
)
;
queryfx
(
$conn_w
,
'UPDATE %T SET '
.
'transactionType = %s, oldValue = %s, newValue = %s, metaData = %s '
.
'WHERE id = %d'
,
$table
->
getTableName
(
)
,
PhabricatorTransactions
::
TYPE_EDGE
,
json_encode
(
$old_value
)
,
json_encode
(
$new_value
)
,
json_encode
(
$metadata
)
,
$txn
->
getID
(
)
)
;
}
echo
pht
(
'Done.'
)
.
"\n"
;
function
mig20141222_build_edge_data
(
$project_phids
,
$task_phid
)
{
$edge_data
=
array
(
)
;
// See T9464. If we didn't get a proper array value out of the transaction,
// just return an empty value so we can move forward.
if
(
!
is_array
(
$project_phids
)
)
{
return
$edge_data
;
}
foreach
(
$project_phids
as
$project_phid
)
{
if
(
!
is_scalar
(
$project_phid
)
)
{
continue
;
}
$edge_data
[
$project_phid
]
=
array
(
'src'
=>
$task_phid
,
'type'
=>
PhabricatorProjectObjectHasProjectEdgeType
::
EDGECONST
,
'dst'
=>
$project_phid
,
)
;
}
return
$edge_data
;
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 13:14 (3 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1124968
Default Alt Text
20141222.maniphestprojtxn.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment