Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F1063244
20130926.dinline.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
20130926.dinline.php
View Options
<?php
$revision_table
=
new
DifferentialRevision
();
$conn_w
=
$revision_table
->
establishConnection
(
'w'
);
$conn_w
->
openTransaction
();
$src_table
=
'differential_inlinecomment'
;
$dst_table
=
'differential_transaction_comment'
;
echo
"Migrating Differential inline comments to new format...
\n
"
;
$content_source
=
PhabricatorContentSource
::
newForSource
(
PhabricatorContentSource
::
SOURCE_LEGACY
,
array
())->
serialize
();
$rows
=
new
LiskRawMigrationIterator
(
$conn_w
,
$src_table
);
foreach
(
$rows
as
$row
)
{
$id
=
$row
[
'id'
];
$revision_id
=
$row
[
'revisionID'
];
echo
"Migrating inline #{$id} (D{$revision_id})...
\n
"
;
$revision_row
=
queryfx_one
(
$conn_w
,
'SELECT phid FROM %T WHERE id = %d'
,
$revision_table
->
getTableName
(),
$revision_id
);
if
(!
$revision_row
)
{
continue
;
}
$revision_phid
=
$revision_row
[
'phid'
];
if
(
$row
[
'commentID'
])
{
$xaction_phid
=
PhabricatorPHID
::
generateNewPHID
(
PhabricatorApplicationTransactionPHIDTypeTransaction
::
TYPECONST
,
DifferentialPHIDTypeRevision
::
TYPECONST
);
}
else
{
$xaction_phid
=
null
;
}
$comment_phid
=
PhabricatorPHID
::
generateNewPHID
(
PhabricatorPHIDConstants
::
PHID_TYPE_XCMT
,
DifferentialPHIDTypeRevision
::
TYPECONST
);
queryfx
(
$conn_w
,
'INSERT IGNORE INTO %T
(id, phid, transactionPHID, authorPHID, viewPolicy, editPolicy,
commentVersion, content, contentSource, isDeleted,
dateCreated, dateModified, revisionPHID, changesetID,
isNewFile, lineNumber, lineLength, hasReplies, legacyCommentID)
VALUES (%d, %s, %ns, %s, %s, %s,
%d, %s, %s, %d,
%d, %d, %s, %nd,
%d, %d, %d, %d, %nd)'
,
$dst_table
,
// id, phid, transactionPHID, authorPHID, viewPolicy, editPolicy
$row
[
'id'
],
$comment_phid
,
$xaction_phid
,
$row
[
'authorPHID'
],
'public'
,
$row
[
'authorPHID'
],
// commentVersion, content, contentSource, isDeleted
1
,
$row
[
'content'
],
$content_source
,
0
,
// dateCreated, dateModified, revisionPHID, changesetID
$row
[
'dateCreated'
],
$row
[
'dateModified'
],
$revision_phid
,
$row
[
'changesetID'
],
// isNewFile, lineNumber, lineLength, hasReplies, legacyCommentID
$row
[
'isNewFile'
],
$row
[
'lineNumber'
],
$row
[
'lineLength'
],
0
,
$row
[
'commentID'
]);
}
$conn_w
->
saveTransaction
();
echo
"Done.
\n
"
;
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jun 29, 10:28 AM (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
259186
Default Alt Text
20130926.dinline.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment