Skip to content

[4.0] Trigger deprecation notices in the CacheController, minor code restructuring for legacy loader#24705

Merged
wilsonge merged 1 commit intojoomla:4.0-devfrom
mbabker:cache-controller-cleanup
Apr 24, 2019
Merged

[4.0] Trigger deprecation notices in the CacheController, minor code restructuring for legacy loader#24705
wilsonge merged 1 commit intojoomla:4.0-devfrom
mbabker:cache-controller-cleanup

Conversation

@mbabker
Copy link
Contributor

@mbabker mbabker commented Apr 23, 2019

Summary of Changes

  1. Move the legacy controller loading code into the catch block, it's rather easy when reading the file to think all of that code should be executed but in reality it is a fallback if the factory fails to create a controller

  2. Trigger deprecation notices when adding new paths or loading controllers through the legacy code path

Testing Instructions

Code review, the odds of anyone having some pre-existing code implementing a custom cache controller laying around are pretty slim.

@@ -102,29 +102,35 @@ public static function getInstance($type = 'output', $options = array())
}
catch (\RuntimeException $e)
Copy link
Contributor

@wilsonge wilsonge Apr 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're doing this can we change this to a PSR KeyNotFoundException please

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a container exception. The default cache controller factory is throwing RuntimeException, it might be better to define a Joomla\CMS\Cache\Exception\ControllerNotFoundException to be thrown by the factory but that's beyond scope of this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Plus that new Exception could be the type thrown by the legacy load path if the class isn't resolved)

@wilsonge wilsonge merged commit 9814aa7 into joomla:4.0-dev Apr 24, 2019
@wilsonge
Copy link
Contributor

Thanks!

@wilsonge wilsonge added this to the Joomla 4.0 milestone Apr 24, 2019
fancyFranci pushed a commit to fancyFranci/joomla-cms that referenced this pull request Apr 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants