1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 03:20:59 +01:00

No-op the Conpherence thumbnail resizing migration

Summary:
Fixes T12628. After later changes to `PhabricatorFile`, this migration no longer runs if you upgrade through it to a recent `HEAD` while your data has some room images.

Since this isn't critical and has been available for ~6 months, I just nuked it as a first pass. I can find a more careful approach which lets us continue to run this migration instead if you're hesitant to skip this step, although it may be a little involved.

In 95% of cases we avoid this by updating the storage table as it existed at the time the migraiton ran, but Files are much too complicated for that to be realistic.

Test Plan: Ran `bin/storage upgrade -f --apply phabricator:20161005.conpherence.image.2.php`, saw it do nothing.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12628

Differential Revision: https://secure.phabricator.com/D17770
This commit is contained in:
epriestley 2017-04-23 04:38:38 -07:00
parent bc9291b327
commit 52c4715bbc

View file

@ -1,34 +1,4 @@
<?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']);
}
// This migration once resized room images for Conpherence, but the File table
// later changed significantly. See T12628.