From 908c59b621c212cb1724c283807730458c8431ca Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Mon, 21 Oct 2024 11:48:27 +1300 Subject: [PATCH] API Add deprecation --- src/Storage/DBFile.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Storage/DBFile.php b/src/Storage/DBFile.php index d75e61ec..1888d79c 100644 --- a/src/Storage/DBFile.php +++ b/src/Storage/DBFile.php @@ -7,6 +7,7 @@ use SilverStripe\Assets\Thumbnail; use SilverStripe\Control\Director; use SilverStripe\Core\Injector\Injector; +use SilverStripe\Dev\Deprecation; use SilverStripe\ORM\FieldType\DBComposite; use SilverStripe\ORM\ValidationException; use SilverStripe\ORM\ValidationResult; @@ -503,15 +504,28 @@ protected function assertFilenameValid($filename) } } - /** * Hook to validate this record against a validation result * * @param ValidationResult $result * @param string $filename Optional filename to validate. If omitted, the current value is validated. * @return bool Valid flag + * @deprecated 2.4.0 Use validateFilename() instead */ public function validate(ValidationResult $result, $filename = null) + { + Deprecation::withSuppressedNotice(function () { + Deprecation::notice('2.4.0', 'Use validateFilename() instead'); + }); + return $this->validateFilename($result, $filename); + } + + /** + * Hook to validate this record against a validation result + * + * @param string $filename Optional filename to validate. If omitted, the current value is validated. + */ + public function validateFilename(ValidationResult $result, $filename = null): bool { if (empty($filename)) { $filename = $this->getFilename();