silverstripe / silverstripe-assets

Silverstripe Assets component
BSD 3-Clause "New" or "Revised" License
9 stars 65 forks source link

Add deprecation messages in FlysystemAssetStore #521

Closed emteknetnz closed 1 year ago

emteknetnz commented 1 year ago

This is currently blocking https://github.com/silverstripe/silverstripe-assets/pull/522

There are a bunch of @deprecated 1.4.0 phpdoc's on methods in FlysystemAssetStore

As part of https://github.com/silverstripe/silverstripe-framework/issues/10531, we need to add standardized message to all phpdocs. i.e.

* @deprecated 1.4.0 My message

Use either of the following standardized messages:

Acceptance criteria

Pull request

maxime-rainville commented 1 year ago

What's been deprecated, why and what the alternative is (if any)

Legacy filename

Prior to the 4.4 release, there was something called legacy filename that would allow you to output filename without the hash. That was completely busted and become redundant once we enable NaturalFileIDs. We kept some of the methods around because they were part of the API but they effectively do nothing now.

These should be deprecated and throw warning from now on.

https://github.com/silverstripe/silverstripe-assets/blob/ce9464b6282c34e37324987ea2dd74cae89c50ca/src/Flysystem/FlysystemAssetStore.php#L88

https://github.com/silverstripe/silverstripe-assets/blob/ce9464b6282c34e37324987ea2dd74cae89c50ca/src/Flysystem/FlysystemAssetStore.php#L1226-L1229

Methods that became part of the FileID helpers

Asset Store used to be very directive because it would assume that all the files would be contained hashes. Those methods were moved to file ID helpers. But some hackish implementation were kept on the asset store ... because SEMVER.

These methods should throw warnings now and be removed altogether.

https://github.com/silverstripe/silverstripe-assets/blob/ce9464b6282c34e37324987ea2dd74cae89c50ca/src/Flysystem/FlysystemAssetStore.php#L262

https://github.com/silverstripe/silverstripe-assets/blob/ce9464b6282c34e37324987ea2dd74cae89c50ca/src/Flysystem/FlysystemAssetStore.php#L708

https://github.com/silverstripe/silverstripe-assets/blob/ce9464b6282c34e37324987ea2dd74cae89c50ca/src/Flysystem/FlysystemAssetStore.php#L914

https://github.com/silverstripe/silverstripe-assets/blob/ce9464b6282c34e37324987ea2dd74cae89c50ca/src/Flysystem/FlysystemAssetStore.php#L1061

https://github.com/silverstripe/silverstripe-assets/blob/ce9464b6282c34e37324987ea2dd74cae89c50ca/src/Flysystem/FlysystemAssetStore.php#L1353

https://github.com/silverstripe/silverstripe-assets/blob/ce9464b6282c34e37324987ea2dd74cae89c50ca/src/Flysystem/FlysystemAssetStore.php#L1367

https://github.com/silverstripe/silverstripe-assets/blob/ce9464b6282c34e37324987ea2dd74cae89c50ca/src/Flysystem/FlysystemAssetStore.php#L1381

https://github.com/silverstripe/silverstripe-assets/blob/ce9464b6282c34e37324987ea2dd74cae89c50ca/src/Flysystem/FlysystemAssetStore.php#L1394

https://github.com/silverstripe/silverstripe-assets/blob/ce9464b6282c34e37324987ea2dd74cae89c50ca/src/Flysystem/FlysystemAssetStore.php#L1407

This method is not currently marked as deprecated, but should be.

https://github.com/silverstripe/silverstripe-assets/blob/ce9464b6282c34e37324987ea2dd74cae89c50ca/src/Flysystem/FlysystemAssetStore.php#L772

Task that need to be removed

These task are no longer needed and should be deprecated/removed

Legacy File resolution

To be able to migrate and resolve SS3 file URLs, we had to create a lot of of legacy abstraction (aka replicating the SS3 file resolution logic in SS4).

That legacy logic is no longer needed.

This class should be deprecated: LegacyFileIDHelper.php

This bit of config can be simplified in CMS5:

This will however mean that everyone who wants to upgrade to CMS5 and had a site created prior to CMS4.4 will have to had run the FileMigrationHelper at some point.

https://github.com/silverstripe/silverstripe-assets/blob/ce9464b6282c34e37324987ea2dd74cae89c50ca/_config/asset.yml#L26-L43

Scope creep to annoy @emteknetnz

In CMS4.4, I introduced ParsedFileID. Until then, we would use tuple which were essentially arrays with a filename, hash and variant keys.

ParsedFileID contains all of that, but in a class with types for everything. We should replace any reference to tuple with a ParsedFileID.

Even more scope creep

Flysystem's Filesystem object implements the FilesystemOperator. I think everywhere we expect a Filesystem we could just as easily expect a FilesystemOperator.

This would open some possibilities for some people https://github.com/silverstripe/silverstripe-assets/issues/368

maxime-rainville commented 1 year ago

This PR will handle the deprecations: https://github.com/silverstripe/silverstripe-assets/pull/525

I'll spin up my other side concerns into their own card.

GuySartorelli commented 1 year ago

@max please create a PR for the 4.12.0 changelog for the things that are being newly deprecated.

GuySartorelli commented 1 year ago

This is all done