2014-05-22 20:19:03 +02:00
|
|
|
<?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();
|
|
|
|
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Migrating project phriction slugs...')."\n";
|
2014-05-22 20:19:03 +02:00
|
|
|
foreach (new LiskMigrationIterator($project_table) as $project) {
|
|
|
|
$id = $project->getID();
|
|
|
|
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Migrating project %d...', $id)."\n";
|
2014-05-22 20:19:03 +02:00
|
|
|
$phriction_slug = rtrim($project->getPhrictionSlug(), '/');
|
|
|
|
$slug = id(new PhabricatorProjectSlug())
|
|
|
|
->loadOneWhere('slug = %s', $phriction_slug);
|
|
|
|
if ($slug) {
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Already migrated %d... Continuing.', $id)."\n";
|
2014-05-22 20:19:03 +02:00
|
|
|
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);
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Migrated %d.', $id)."\n";
|
2014-05-22 20:19:03 +02:00
|
|
|
}
|
|
|
|
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Done.')."\n";
|