[Issue] Can't able to delete/rename sitemap.xml in file system #37468
Labels
Area: Framework
Component: Sitemap
Issue: Confirmed
Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed
Priority: P2
A defect with this priority could have functionality issues which are not to expectations.
Progress: done
Reported on 2.4.x
Indicates original Magento version for the Issue report.
Reproduced on 2.4.x
The issue has been reproduced on latest 2.4-develop branch
Projects
This issue is automatically created based on existing pull request: #36323: Can't able to delete/rename sitemap.xml in file system
Description (*)
When we try to delete the generated sitemap, it is deleted from the admin side but not deleted from the file system. So, I have checked, and there is a Delete controller for deleting the sitemap from the admin side. Here is the file -
in the execute() function, the
$directory
is using the ROOT (base) directory instead of the PUB directory at line 54. So, it is checking the file in the root instead of the pub directory at line 72 as in the below image.The sitemap file is generated under the pub directory. So, it can't able to delete the sitemap file from the pub directory after deleting it from the admin side.
Also, if we rename the sitemap file and Save and Generate it. Then it will generate a new file and it will keep the old one also in the file system. There is a Save controller for saving the sitemap and here is the file -
in the clearSiteMap() function, doing the same thing as in the Delete controller like the
$directory
is using the ROOT (base) directory instead of the PUB directory at line 131. And that's why when the sitemap is renamed, it can't delete from the file system as in the below image.So, We need to use the PUB directory at both places.
Related Pull Requests
None
Fixed Issues (if relevant)
None
Manual testing scenarios (*)
Questions or comments
Contribution checklist (*)
The text was updated successfully, but these errors were encountered: