Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99499855
20161005.conpherence.image.2.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 25, 01:06
Size
873 B
Mime Type
text/x-php
Expires
Mon, Jan 27, 01:06 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23813366
Attached To
rPH Phabricator
20161005.conpherence.image.2.php
View Options
<?php
// Rebuild all Conpherence Room images to profile standards
//
$table
=
new
ConpherenceThread
();
$conn
=
$table
->
establishConnection
(
'w'
);
$table_name
=
'conpherence_thread'
;
foreach
(
new
LiskRawMigrationIterator
(
$conn
,
$table_name
)
as
$row
)
{
$images
=
phutil_json_decode
(
$row
[
'imagePHIDs'
]);
if
(!
$images
)
{
continue
;
}
$file_phid
=
idx
(
$images
,
'original'
);
$file
=
id
(
new
PhabricatorFileQuery
())
->
setViewer
(
PhabricatorUser
::
getOmnipotentUser
())
->
withPHIDs
(
array
(
$file_phid
))
->
executeOne
();
$xform
=
PhabricatorFileTransform
::
getTransformByKey
(
PhabricatorFileThumbnailTransform
::
TRANSFORM_PROFILE
);
$xformed
=
$xform
->
executeTransform
(
$file
);
$new_phid
=
$xformed
->
getPHID
();
queryfx
(
$conn
,
'UPDATE %T SET profileImagePHID = %s WHERE id = %d'
,
$table
->
getTableName
(),
$new_phid
,
$row
[
'id'
]);
}
Event Timeline
Log In to Comment