Skip to content

Commit

Permalink
API Add deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Oct 20, 2024
1 parent 6b6fcbc commit c947166
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/Storage/DBFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -503,16 +504,32 @@ 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
{
Deprecation::withSuppressedNotice(function () {
Deprecation::notice('2.4.0', 'Will be renamed to validateFilename()');
});
if (empty($filename)) {
$filename = $this->getFilename();
}
Expand Down

0 comments on commit c947166

Please sign in to comment.