1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-14 02:42:40 +01:00
phorge-phorge/resources/sql/autopatches/20140521.projectslug.2.mig.php
Joshua Spence 36e2d02d6e phtize all the things
Summary: `pht`ize a whole bunch of strings in rP.

Test Plan: Intense eyeballing.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: hach-que, Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12797
2015-05-22 21:16:39 +10:00

33 lines
963 B
PHP

<?php
$project_table = new PhabricatorProject();
$table_name = $project_table->getTableName();
$conn_w = $project_table->establishConnection('w');
$slug_table_name = id(new PhabricatorProjectSlug())->getTableName();
$time = time();
echo pht('Migrating project phriction slugs...')."\n";
foreach (new LiskMigrationIterator($project_table) as $project) {
$id = $project->getID();
echo pht('Migrating project %d...', $id)."\n";
$phriction_slug = rtrim($project->getPhrictionSlug(), '/');
$slug = id(new PhabricatorProjectSlug())
->loadOneWhere('slug = %s', $phriction_slug);
if ($slug) {
echo pht('Already migrated %d... Continuing.', $id)."\n";
continue;
}
queryfx(
$conn_w,
'INSERT INTO %T (projectPHID, slug, dateCreated, dateModified) '.
'VALUES (%s, %s, %d, %d)',
$slug_table_name,
$project->getPHID(),
$phriction_slug,
$time,
$time);
echo pht('Migrated %d.', $id)."\n";
}
echo pht('Done.')."\n";