Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F94030915
20130703.legalpaddocdenorm.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
Tue, Dec 3, 09:16
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Dec 5, 09:16 (2 d)
Engine
blob
Format
Raw Data
Handle
22717060
Attached To
rPH Phabricator
20130703.legalpaddocdenorm.php
View Options
<?php
echo
pht
(
"Populating Legalpad Documents with titles, %s, and %s...
\n
"
,
'recentContributorPHIDs'
,
'contributorCounts'
);
$table
=
new
LegalpadDocument
();
$table
->
openTransaction
();
foreach
(
new
LiskMigrationIterator
(
$table
)
as
$document
)
{
$updated
=
false
;
$id
=
$document
->
getID
();
echo
pht
(
'Document %d: '
,
$id
);
if
(!
$document
->
getTitle
())
{
$document_body
=
id
(
new
LegalpadDocumentBody
())
->
loadOneWhere
(
'phid = %s'
,
$document
->
getDocumentBodyPHID
());
$title
=
$document_body
->
getTitle
();
$document
->
setTitle
(
$title
);
$updated
=
true
;
echo
pht
(
'Added title: %s'
,
$title
).
"
\n
"
;
}
else
{
echo
"-
\n
"
;
}
if
(!
$document
->
getContributorCount
()
||
!
$document
->
getRecentContributorPHIDs
())
{
$updated
=
true
;
$type
=
PhabricatorObjectHasContributorEdgeType
::
EDGECONST
;
$contributors
=
PhabricatorEdgeQuery
::
loadDestinationPHIDs
(
$document
->
getPHID
(),
$type
);
$document
->
setRecentContributorPHIDs
(
array_slice
(
$contributors
,
0
,
3
));
echo
pht
(
'Added recent contributor PHIDs.'
).
"
\n
"
;
$document
->
setContributorCount
(
count
(
$contributors
));
echo
pht
(
'Added contributor count.'
).
"
\n
"
;
}
if
(!
$updated
)
{
echo
"-
\n
"
;
continue
;
}
$document
->
save
();
}
$table
->
saveTransaction
();
echo
pht
(
'Done.'
).
"
\n
"
;
Event Timeline
Log In to Comment