hubzero / hubzero-cms

Platform for Scientific Collaboration
https://hubzero.org
GNU General Public License v2.0
46 stars 58 forks source link

Changes to the custom component update from git repo #1605

Closed dbenham closed 1 year ago

dbenham commented 1 year ago

Fix is not perfect, the code in question needs refactoring.

However, the most common use case that was seeing a frequent error now works.

nkissebe commented 1 year ago

Can you describe what the issue is and what you did to fix it. I don't see any problem code wise, just want to know what is being fixed.

dbenham commented 1 year ago

I disliked making either of these changes, because the failures were not some obscure edge case that was overlooked, it was pretty basic stuff that wasn't working. And why did it work before (assuming it did) and not now? I don't have a good answer for that.

dbenham commented 1 year ago

Reasoning for changes

core/components/com_installer/admin/controllers/customexts.php

Change at line 628

The custom extension page said the componet was up to date. This was an error, when there are changes upstream, $fetch_respoonse was non empty, and it's contents had to be displayed in order to show the changes to the user and enable the 'merge' button on the form to allow the user to merge the changes. This addition accomplished this.

Change at line 687

Originally this code just did a preg_grep, but a successful update could return an empty $update_response, and that resulted in a php error that $update_response was undefined. I added a check to prevent this, plus, I added a check for a completely blank update_response to indicate a successful update as well.

Incidentally, I never saw the case where $update_response was non empty and the regular expression check for "updating the repository" returned true, but I left that seeing no need to remove it.

core/components/com_installer/admin/views/customexts/tmpl/fetched.php

Change at line 34

Code simply wasn’t needed, it resulted in a double display of the success message.