Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99000607
20181219.pholio.02.imagemigrate.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
Sat, Jan 18, 09:04
Size
728 B
Mime Type
text/x-php
Expires
Mon, Jan 20, 09:04 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
23683814
Attached To
rPH Phabricator
20181219.pholio.02.imagemigrate.php
View Options
<?php
// Old images used a "mockID" instead of a "mockPHID" to reference mocks.
// Set the "mockPHID" column to the value that corresponds to the "mockID".
$image
=
new
PholioImage
();
$mock
=
new
PholioMock
();
$conn
=
$image
->
establishConnection
(
'w'
);
$iterator
=
new
LiskRawMigrationIterator
(
$conn
,
$image
->
getTableName
());
foreach
(
$iterator
as
$image_row
)
{
if
(
$image_row
[
'mockPHID'
])
{
continue
;
}
$mock_id
=
$image_row
[
'mockID'
];
$mock_row
=
queryfx_one
(
$conn
,
'SELECT phid FROM %R WHERE id = %d'
,
$mock
,
$mock_id
);
if
(!
$mock_row
)
{
continue
;
}
queryfx
(
$conn
,
'UPDATE %R SET mockPHID = %s WHERE id = %d'
,
$image
,
$mock_row
[
'phid'
],
$image_row
[
'id'
]);
}
Event Timeline
Log In to Comment