Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F76146979
20140521.projectslug.2.mig.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, Aug 6, 11:25
Size
982 B
Mime Type
text/x-php
Expires
Thu, Aug 8, 11:25 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
19670522
Attached To
rPH Phabricator
20140521.projectslug.2.mig.php
View Options
<?php
$project_table
=
new
PhabricatorProject
();
$table_name
=
$project_table
->
getTableName
();
$conn_w
=
$project_table
->
establishConnection
(
'w'
);
$slug_table_name
=
id
(
new
PhabricatorProjectSlug
())->
getTableName
();
$time
=
PhabricatorTime
::
getNow
();
echo
pht
(
'Migrating projects to slugs...'
).
"
\n
"
;
foreach
(
new
LiskMigrationIterator
(
$project_table
)
as
$project
)
{
$id
=
$project
->
getID
();
echo
pht
(
'Migrating project %d...'
,
$id
).
"
\n
"
;
$slug_text
=
PhabricatorSlug
::
normalizeProjectSlug
(
$project
->
getName
());
$slug
=
id
(
new
PhabricatorProjectSlug
())
->
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
(),
$slug_text
,
$time
,
$time
);
echo
pht
(
'Migrated %d.'
,
$id
).
"
\n
"
;
}
echo
pht
(
'Done.'
).
"
\n
"
;
Event Timeline
Log In to Comment