Page MenuHomePhorge

D25622.1740196444.diff
No OneTemporary

D25622.1740196444.diff

diff --git a/src/applications/files/transform/PhabricatorFileTransform.php b/src/applications/files/transform/PhabricatorFileTransform.php
--- a/src/applications/files/transform/PhabricatorFileTransform.php
+++ b/src/applications/files/transform/PhabricatorFileTransform.php
@@ -27,6 +27,22 @@
return $this->getDefaultTransform($file);
}
+ /**
+ * Wrapper of executeTransform() that also persists the relationship
+ * between the original file and the transform.
+ */
+ public function executeTransformExplicit(PhabricatorFile $file) {
+ $xform = $this->executeTransform($file);
+
+ id(new PhabricatorTransformedFile())
+ ->setOriginalPHID($file->getPHID())
+ ->setTransformedPHID($xform->getPHID())
+ ->setTransform($this->getTransformKey())
+ ->save();
+
+ return $xform;
+ }
+
public static function getAllTransforms() {
return id(new PhutilClassMapQuery())
->setAncestorClass(__CLASS__)
diff --git a/src/applications/maniphest/xaction/ManiphestTaskCoverImageTransaction.php b/src/applications/maniphest/xaction/ManiphestTaskCoverImageTransaction.php
--- a/src/applications/maniphest/xaction/ManiphestTaskCoverImageTransaction.php
+++ b/src/applications/maniphest/xaction/ManiphestTaskCoverImageTransaction.php
@@ -30,14 +30,7 @@
// Generate an image transformation, usually smaller (orphan now).
$xform_key = PhabricatorFileThumbnailTransform::TRANSFORM_WORKCARD;
$xform = PhabricatorFileTransform::getTransformByKey($xform_key)
- ->executeTransform($file);
-
- // Make that image transformation non-orphan.
- id(new PhabricatorTransformedFile())
- ->setOriginalPHID($file_phid)
- ->setTransformedPHID($xform->getPHID())
- ->setTransform($xform_key)
- ->save();
+ ->executeTransformExplicit($file);
$object->setProperty('cover.filePHID', $file->getPHID());
$object->setProperty('cover.thumbnailPHID', $xform->getPHID());
diff --git a/src/applications/people/controller/PhabricatorPeopleProfilePictureController.php b/src/applications/people/controller/PhabricatorPeopleProfilePictureController.php
--- a/src/applications/people/controller/PhabricatorPeopleProfilePictureController.php
+++ b/src/applications/people/controller/PhabricatorPeopleProfilePictureController.php
@@ -69,7 +69,7 @@
} else {
$xform = PhabricatorFileTransform::getTransformByKey(
PhabricatorFileThumbnailTransform::TRANSFORM_PROFILE);
- $xformed = $xform->executeTransform($file);
+ $xformed = $xform->executeTransformExplicit($file);
}
}

File Metadata

Mime Type
text/plain
Expires
Sat, Feb 22, 03:54 (3 h, 3 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1180867
Default Alt Text
D25622.1740196444.diff (2 KB)

Event Timeline