Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93006725
20140722.audit.4.migtext.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, 13:11
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Nov 27, 13:11 (2 d)
Engine
blob
Format
Raw Data
Handle
22556478
Attached To
rPH Phabricator
20140722.audit.4.migtext.php
View Options
<?php
$conn_w
=
id
(
new
PhabricatorAuditTransaction
())->
establishConnection
(
'w'
);
$rows
=
new
LiskRawMigrationIterator
(
$conn_w
,
'audit_comment'
);
$content_source
=
PhabricatorContentSource
::
newForSource
(
PhabricatorContentSource
::
SOURCE_LEGACY
,
array
())->
serialize
();
echo
pht
(
'Migrating Audit comment text to modern storage...'
).
"
\n
"
;
foreach
(
$rows
as
$row
)
{
$id
=
$row
[
'id'
];
echo
pht
(
'Migrating Audit comment %d...'
,
$id
).
"
\n
"
;
if
(!
strlen
(
$row
[
'content'
]))
{
echo
pht
(
'Comment has no text, continuing.'
).
"
\n
"
;
continue
;
}
$xaction_phid
=
PhabricatorPHID
::
generateNewPHID
(
PhabricatorApplicationTransactionTransactionPHIDType
::
TYPECONST
,
PhabricatorRepositoryCommitPHIDType
::
TYPECONST
);
$comment_phid
=
PhabricatorPHID
::
generateNewPHID
(
PhabricatorPHIDConstants
::
PHID_TYPE_XCMT
,
PhabricatorRepositoryCommitPHIDType
::
TYPECONST
);
queryfx
(
$conn_w
,
'INSERT IGNORE INTO %T
(phid, transactionPHID, authorPHID, viewPolicy, editPolicy,
commentVersion, content, contentSource, isDeleted,
dateCreated, dateModified, commitPHID, pathID,
legacyCommentID)
VALUES (%s, %s, %s, %s, %s,
%d, %s, %s, %d,
%d, %d, %s, %nd,
%d)'
,
'audit_transaction_comment'
,
// phid, transactionPHID, authorPHID, viewPolicy, editPolicy
$comment_phid
,
$xaction_phid
,
$row
[
'actorPHID'
],
'public'
,
$row
[
'actorPHID'
],
// commentVersion, content, contentSource, isDeleted
1
,
$row
[
'content'
],
$content_source
,
0
,
// dateCreated, dateModified, commitPHID, pathID, legacyCommentID
$row
[
'dateCreated'
],
$row
[
'dateModified'
],
$row
[
'targetPHID'
],
null
,
$row
[
'id'
]);
}
echo
pht
(
'Done.'
).
"
\n
"
;
Event Timeline
Log In to Comment