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();