1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 21:02:41 +01:00
phorge-phorge/resources/sql/patches/20130703.legalpaddocdenorm.php
Joshua Spence 0a62f13464 Change double quotes to single quotes.
Summary: Ran `arc lint --apply-patches --everything` over rP, mainly to change double quotes to single quotes where appropriate. These changes also validate that the `ArcanistXHPASTLinter::LINT_DOUBLE_QUOTE` rule is working as expected.

Test Plan: Eyeballed it.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin, hach-que

Differential Revision: https://secure.phabricator.com/D9431
2014-06-09 11:36:50 -07:00

46 lines
1.2 KiB
PHP

<?php
echo 'Populating Legalpad Documents with ',
"titles, recentContributorPHIDs, and contributorCounts...\n";
$table = new LegalpadDocument();
$table->openTransaction();
foreach (new LiskMigrationIterator($table) as $document) {
$updated = false;
$id = $document->getID();
echo "Document {$id}: ";
if (!$document->getTitle()) {
$document_body = id(new LegalpadDocumentBody())
->loadOneWhere('phid = %s', $document->getDocumentBodyPHID());
$title = $document_body->getTitle();
$document->setTitle($title);
$updated = true;
echo "Added title: $title\n";
} else {
echo "-\n";
}
if (!$document->getContributorCount() ||
!$document->getRecentContributorPHIDs()) {
$updated = true;
$type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_CONTRIBUTOR;
$contributors = PhabricatorEdgeQuery::loadDestinationPHIDs(
$document->getPHID(),
$type);
$document->setRecentContributorPHIDs(array_slice($contributors, 0, 3));
echo "Added recent contributor phids.\n";
$document->setContributorCount(count($contributors));
echo "Added contributor count.\n";
}
if (!$updated) {
echo "-\n";
continue;
}
$document->save();
}
$table->saveTransaction();
echo "Done.\n";