Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#3833 Update CRM_Extension_Downloader to not use dynamic properties #24438

Merged
merged 1 commit into from
Sep 1, 2022

Conversation

braders
Copy link
Contributor

@braders braders commented Sep 1, 2022

Overview

Update CRM_Extension_Downloader to not use dynamic properties.

First of many required changes for dev/core#3833

Before

The CRM_Extension_Downloader class used dynamic properties which are going to be deprecated in PHP 8.2, and which harm readability.

After

$manager and containerDir are no longer dynamic properties.

I've re-arranged some of the properties and methods so that the constructor comes first, and so that the property order better matches the order in which they are defined.

Whilst in this file I've also removed the line $destDir = $this->containerDir . DIRECTORY_SEPARATOR . $key; as $destDir was not being used.

Technical Details

I've decided to make manager and containerDir private, as I could not see a need for them to be public. That said it required some thinking about, and happy to hear arguments to the contrary. This highlights both why resolving #3833 will be a good excercise, but also why it may be difficult and time-consuming.

I also think guzzleClient could be private rather than protected, but didn't change it incase there is a reason I am not seeing.

@civibot
Copy link

civibot bot commented Sep 1, 2022

(Standard links)

@civibot civibot bot added the master label Sep 1, 2022
@braders braders changed the title Update CRM_Extension_Downloader to not use dynamic properties dev/core#3833 Update CRM_Extension_Downloader to not use dynamic properties Sep 1, 2022
@totten
Copy link
Member

totten commented Sep 1, 2022

Change looks sensible. 👍

I've decided to make manager and containerDir private...

Yeah, There shouldn't be anyone else accessing these two properties. The canonical way for other classes to lookup extension data is through CRM_Extension_System. (And in a quick grep for >manager and >containerDir, I don't see anyone else reading these properties from Downloader.)

In terms of QA - I don't think there's much unit-test coverage, but (once the test-run finishes) we can probably cover most risks with a light r-run (Administer => System =>Extensions => Add new => Civirules...) on the autobuild site.

@totten
Copy link
Member

totten commented Sep 1, 2022

Test failure is not related. Basic r-run on autobuild site worked fine. Merging.

@totten totten merged commit 9af186f into civicrm:master Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants