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

[5.0] Fix uninstalling the demo tasks plugin on update #41065

Merged

Conversation

richard67
Copy link
Member

@richard67 richard67 commented Jun 27, 2023

Pull Request for Issue # .

Summary of Changes

With pull request (PR) #40768 , a function for uninstalling and optionally migrating extensions on update has been added to script.php, and with PR #40147 that function is used to uninstall the demo tasks plugin.

However, this results in an alert about an error when trying to delete the plugin's folder and in PHP notices at the end of the update.

The reason is that the "deleteUnexistingFiles" method is not only called from function "update" in script.php but also from the "finalisation.php" file of the update component.

That means the plugin's files and folders are deleted before the function to uninstall the plugin is executed.

We once had similar problems in 4.x when uninstalling the eos310 plugin on update, and the solution was to not include the files and folders of the plugin in the lists of deleted files and folders. See #34898 .

This PR here solves it in the same way by removing the files and folders from the deleted files and folders lists and add them as exceptions to the "deleted_file_check.php" file so they will not be added again to the lists later due to that script reporting them as to be deleted.

Testing Instructions

On a current 4.4-dev or 4.4 nightly build or 5.0.0-alpha1, set error reporting to maximum and make sure that PHP errors are logged into a file.

Update to the latest 5.0 nightly build to get the actual result, and update with the same starting conditions to the update package built by Drone for this PR to get the expected result.

Actual result BEFORE applying this Pull Request

2023-06-27_j5-error-on-update

In the PHP error log file:

Warning:  Attempt to read property "files" on null in /home/richard/lamp/public_html/test-1/libraries/src/Installer/Adapter/PluginAdapter.php on line 291

(and others of this kind)

However, the update succeeds despite of these issues.

Expected result AFTER applying this Pull Request

Update succeeds without PHP notices and without the alert about deleting the folder.

Link to documentations

Please select:

  • No documentation changes for docs.joomla.org needed

  • No documentation changes for manual.joomla.org needed

@HLeithner HLeithner merged commit 3278a54 into joomla:5.0-dev Jun 27, 2023
@richard67 richard67 deleted the 5.0-dev-fix-plugin-uninstallation-on-update branch June 27, 2023 15:11
@HLeithner HLeithner added this to the Joomla! 5.0 milestone Jun 27, 2023
richard67 added a commit to richard67/joomla-cms that referenced this pull request Jul 3, 2023
richard67 added a commit to richard67/joomla-cms that referenced this pull request Jul 22, 2023
@richard67
Copy link
Member Author

I just see that excluding the files /administrator/language/en-GB/plg_task_demotasks.ini and /administrator/language/en-GB/plg_task_demotasks.sys.ini in file deleted_file_check.php doesn't work. I should not have added them to the $filesToKeep array and not to the $previousReleaseExclude array, which is only working for folders but not for files. I will create a PR to fix that.

HLeithner pushed a commit that referenced this pull request Jul 22, 2023
richard67 added a commit to richard67/joomla-cms that referenced this pull request Jul 22, 2023
richard67 added a commit to richard67/joomla-cms that referenced this pull request Jul 23, 2023
richard67 added a commit to richard67/joomla-cms that referenced this pull request Jul 24, 2023
richard67 added a commit to richard67/joomla-cms that referenced this pull request Aug 12, 2023
GeraintEdwards pushed a commit to GeraintEdwards/joomla-cms that referenced this pull request Aug 14, 2023
GeraintEdwards pushed a commit to GeraintEdwards/joomla-cms that referenced this pull request Aug 14, 2023
richard67 added a commit to richard67/joomla-cms that referenced this pull request Aug 19, 2023
richard67 added a commit to richard67/joomla-cms that referenced this pull request Sep 1, 2023
richard67 added a commit to richard67/joomla-cms that referenced this pull request Sep 4, 2023
richard67 added a commit to richard67/joomla-cms that referenced this pull request Sep 4, 2023
richard67 added a commit to richard67/joomla-cms that referenced this pull request Sep 4, 2023
richard67 added a commit to richard67/joomla-cms that referenced this pull request Sep 5, 2023
richard67 added a commit to richard67/joomla-cms that referenced this pull request Sep 14, 2023
richard67 added a commit to richard67/joomla-cms that referenced this pull request Sep 19, 2023
richard67 added a commit to richard67/joomla-cms that referenced this pull request Sep 26, 2023
richard67 added a commit to richard67/joomla-cms that referenced this pull request Sep 26, 2023
richard67 added a commit to richard67/joomla-cms that referenced this pull request Sep 26, 2023
richard67 added a commit to richard67/joomla-cms that referenced this pull request Sep 26, 2023
richard67 added a commit to richard67/joomla-cms that referenced this pull request Oct 1, 2023
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