Page MenuHomePhabricator

D17060.diff
No OneTemporary

D17060.diff

diff --git a/resources/sql/autopatches/20140521.projectslug.2.mig.php b/resources/sql/autopatches/20140521.projectslug.2.mig.php
--- a/resources/sql/autopatches/20140521.projectslug.2.mig.php
+++ b/resources/sql/autopatches/20140521.projectslug.2.mig.php
@@ -4,27 +4,30 @@
$table_name = $project_table->getTableName();
$conn_w = $project_table->establishConnection('w');
$slug_table_name = id(new PhabricatorProjectSlug())->getTableName();
-$time = time();
+$time = PhabricatorTime::getNow();
-echo pht('Migrating project phriction slugs...')."\n";
+echo pht('Migrating projects to 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_text = PhabricatorSlug::normalizeProjectSlug($project->getName());
$slug = id(new PhabricatorProjectSlug())
- ->loadOneWhere('slug = %s', $phriction_slug);
+ ->loadOneWhere('slug = %s', $slug_text);
+
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,
+ $slug_text,
$time,
$time);
echo pht('Migrated %d.', $id)."\n";
diff --git a/resources/sql/patches/090.forceuniqueprojectnames.php b/resources/sql/patches/090.forceuniqueprojectnames.php
--- a/resources/sql/patches/090.forceuniqueprojectnames.php
+++ b/resources/sql/patches/090.forceuniqueprojectnames.php
@@ -96,7 +96,9 @@
if ($other->getID() == $project->getID()) {
continue;
}
- if ($other->getPhrictionSlug() == $new_slug) {
+
+ $other_slug = PhabricatorSlug::normalizeProjectSlug($other->getName());
+ if ($other_slug == $new_slug) {
$okay = false;
break;
}

File Metadata

Mime Type
text/plain
Expires
Mon, Mar 10, 5:05 AM (12 h, 20 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7401649
Default Alt Text
D17060.diff (1 KB)

Event Timeline