Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2883007
D25622.1737136818.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
6 KB
Referenced Files
None
Subscribers
None
D25622.1737136818.diff
View Options
diff --git a/src/applications/auth/controller/PhabricatorAuthRegisterController.php b/src/applications/auth/controller/PhabricatorAuthRegisterController.php
--- a/src/applications/auth/controller/PhabricatorAuthRegisterController.php
+++ b/src/applications/auth/controller/PhabricatorAuthRegisterController.php
@@ -706,7 +706,7 @@
$xform = PhabricatorFileTransform::getTransformByKey(
PhabricatorFileThumbnailTransform::TRANSFORM_PROFILE);
- return $xform->executeTransform($file);
+ return $xform->executeTransformExplicit($file);
}
protected function renderError($message) {
diff --git a/src/applications/conpherence/controller/ConpherenceRoomPictureController.php b/src/applications/conpherence/controller/ConpherenceRoomPictureController.php
--- a/src/applications/conpherence/controller/ConpherenceRoomPictureController.php
+++ b/src/applications/conpherence/controller/ConpherenceRoomPictureController.php
@@ -66,7 +66,7 @@
} else {
$xform = PhabricatorFileTransform::getTransformByKey(
PhabricatorFileThumbnailTransform::TRANSFORM_PROFILE);
- $xformed = $xform->executeTransform($file);
+ $xformed = $xform->executeTransformExplicit($file);
}
}
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryProfilePictureController.php b/src/applications/diffusion/controller/DiffusionRepositoryProfilePictureController.php
--- a/src/applications/diffusion/controller/DiffusionRepositoryProfilePictureController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryProfilePictureController.php
@@ -67,7 +67,7 @@
} else {
$xform = PhabricatorFileTransform::getTransformByKey(
PhabricatorFileThumbnailTransform::TRANSFORM_PROFILE);
- $xformed = $xform->executeTransform($file);
+ $xformed = $xform->executeTransformExplicit($file);
}
}
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,30 @@
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);
+
+ // Persist relationship between the original file and its transform.
+ // Expept transforms that are derived from builtin files, just
+ // as cautionary measure. Since they are so many, and this information
+ // probably does not add anything useful.
+ // Also, we don't know if the UX that lists transforms scales well
+ // with a lot of them. For example, this page: /file/transforms/1/
+ if (!$file->isBuiltIn()) {
+ 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);
}
}
diff --git a/src/applications/phame/controller/blog/PhameBlogProfilePictureController.php b/src/applications/phame/controller/blog/PhameBlogProfilePictureController.php
--- a/src/applications/phame/controller/blog/PhameBlogProfilePictureController.php
+++ b/src/applications/phame/controller/blog/PhameBlogProfilePictureController.php
@@ -66,7 +66,7 @@
} else {
$xform = PhabricatorFileTransform::getTransformByKey(
PhabricatorFileThumbnailTransform::TRANSFORM_PROFILE);
- $xformed = $xform->executeTransform($file);
+ $xformed = $xform->executeTransformExplicit($file);
}
}
diff --git a/src/applications/phortune/controller/merchant/PhortuneMerchantPictureController.php b/src/applications/phortune/controller/merchant/PhortuneMerchantPictureController.php
--- a/src/applications/phortune/controller/merchant/PhortuneMerchantPictureController.php
+++ b/src/applications/phortune/controller/merchant/PhortuneMerchantPictureController.php
@@ -56,7 +56,7 @@
} else {
$xform = PhabricatorFileTransform::getTransformByKey(
PhabricatorFileThumbnailTransform::TRANSFORM_PROFILE);
- $xformed = $xform->executeTransform($file);
+ $xformed = $xform->executeTransformExplicit($file);
}
}
diff --git a/src/applications/project/controller/PhabricatorProjectEditPictureController.php b/src/applications/project/controller/PhabricatorProjectEditPictureController.php
--- a/src/applications/project/controller/PhabricatorProjectEditPictureController.php
+++ b/src/applications/project/controller/PhabricatorProjectEditPictureController.php
@@ -68,7 +68,7 @@
} else {
$xform = PhabricatorFileTransform::getTransformByKey(
PhabricatorFileThumbnailTransform::TRANSFORM_PROFILE);
- $xformed = $xform->executeTransform($file);
+ $xformed = $xform->executeTransformExplicit($file);
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 17, 18:00 (1 d, 6 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1120404
Default Alt Text
D25622.1737136818.diff (6 KB)
Attached To
Mode
D25622: Transformed Pictures: make them non-orphan
Attached
Detach File
Event Timeline
Log In to Comment