joomla / joomla-cms

Home of the Joomla! Content Management System
https://www.joomla.org
GNU General Public License v2.0
4.78k stars 3.65k forks source link

Delete non existing files on update #44482

Closed brianteeman closed 6 days ago

brianteeman commented 6 days ago

Steps to reproduce the issue

I tried to update a live site running 5.2.1 to the nightly release of 5.3 Debug mode was on the images/sampledata folder did not contain the cassiopeia folder

Expected result

On completion there was an error in the browser and the update log contained the following

2024-11-19T09:32:06+00:00   INFO 94.10.24.158   update  Deleting removed files and folders.
2024-11-19T09:32:06+00:00   INFO 94.10.24.158   update  Fixing permissions for files and folders.
2024-11-19T09:32:06+00:00   ERROR 94.10.24.158  update  An error has occurred while running "deleteUnexistingFiles". Code: 0. Message: Joomla\Filesystem\Folder::files: Path is not a folder. Path: [ROOT]/images/sampledata/cassiopeia.
2024-11-19T09:32:06+00:00   DEBUG 94.10.24.158  update  An error trace: [ROOT]/libraries/vendor/joomla/filesystem/src/Folder.php:341
#0 [ROOT]/administrator/components/com_admin/script.php(3553): Joomla\Filesystem\Folder::files()
#1 [ROOT]/administrator/components/com_admin/script.php(2671): JoomlaInstallerScript->fixFilesystemPermissions()
#2 [ROOT]/administrator/components/com_admin/script.php(140): JoomlaInstallerScript->deleteUnexistingFiles()
#3 [ROOT]/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php(819): JoomlaInstallerScript->update()
#4 [ROOT]/administrator/components/com_joomlaupdate/src/Controller/UpdateController.php(154): Joomla\Component\Joomlaupdate\Administrator\Model\UpdateModel->finaliseUpgrade()
#5 [ROOT]/libraries/src/MVC/Controller/BaseController.php(730): Joomla\Component\Joomlaupdate\Administrator\Controller\UpdateController->finalise()
#6 [ROOT]/libraries/src/Dispatcher/ComponentDispatcher.php(143): Joomla\CMS\MVC\Controller\BaseController->execute()
#7 [ROOT]/libraries/src/Component/ComponentHelper.php(361): Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch()
#8 [ROOT]/libraries/src/Application/AdministratorApplication.php(150): Joomla\CMS\Component\ComponentHelper::renderComponent()
#9 [ROOT]/libraries/src/Application/AdministratorApplication.php(195): Joomla\CMS\Application\AdministratorApplication->dispatch()
#10 [ROOT]/libraries/src/Application/CMSApplication.php(306): Joomla\CMS\Application\AdministratorApplication->doExecute()
#11 [ROOT]/administrator/includes/app.php(58): Joomla\CMS\Application\CMSApplication->execute()
#12 [ROOT]/administrator/index.php(32): require_once('...')
#13 {main}.
2024-11-19T09:32:07+00:00   INFO 94.10.24.158   update  Cleaning up after installation.
2024-11-19T09:32:07+00:00   INFO 94.10.24.158   update  Update to version 5.3.0-alpha1-dev is complete.

cc @richard67

richard67 commented 6 days ago

@brianteeman Confirmed from reading my code. I will provide a fix as soon as I can find the time. Having that images/sampledata/cassiopeia folder deleted seems to be a valid use case to me.

richard67 commented 6 days ago

Fix is ready: #44483 Only testing instructions and a bit details in the description are to be completed. I will do that in some 1 or 2 hours. I will leave this issue open until that is done.

richard67 commented 6 days ago

Closing as having a pull request. Please test #44483 . Thanks in advance, and thanks for reporting this issue.