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

[Issue] Can't able to delete/rename sitemap.xml in file system #37468

Closed
5 tasks
m2-assistant bot opened this issue May 5, 2023 · 2 comments · Fixed by #36323
Closed
5 tasks

[Issue] Can't able to delete/rename sitemap.xml in file system #37468

m2-assistant bot opened this issue May 5, 2023 · 2 comments · Fixed by #36323
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

Comments

@m2-assistant
Copy link

m2-assistant bot commented May 5, 2023

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 -

/vendor/magento/module-sitemap/Controller/Adminhtml/Sitemap/Delete.php

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.

delete-controller-execute-method

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 -

/vendor/magento/module-sitemap/Controller/Adminhtml/Sitemap/Save.php

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.

save-controller-clearSiteMap-method

So, We need to use the PUB directory at both places.

Related Pull Requests

None

Fixed Issues (if relevant)

None

Manual testing scenarios (*)

  1. Go to Marketing -> Sitemap and create a sitemap.
  2. Add a Sitemap by clicking on the 'Add Sitemap' button. And fill up the field like the attached image and save the sitemap.

New-Site-Map-Site-Admin

  1. Now generate a sitemap from the grid by clicking on the generate link.
  2. Sitemap is generated in the pub directory. Now open that sitemap on the admin side and delete it.
  3. Check in the pub directory. The sitemap is still there.

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)
@m2-assistant m2-assistant bot added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label May 5, 2023
@m2-community-project m2-community-project bot added this to Pull Request In Progress in High Priority Backlog May 5, 2023
@engcom-Lima engcom-Lima added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Component: Sitemap Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Reported on 2.4.x Indicates original Magento version for the Issue report. Area: Framework labels May 5, 2023
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.adobe.com/browse/AC-8708 is successfully created for this GitHub issue.

@m2-assistant
Copy link
Author

m2-assistant bot commented May 5, 2023

✅ Confirmed by @engcom-Lima. Thank you for verifying the issue.
Issue Available: @engcom-Lima, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Development

Successfully merging a pull request may close this issue.

2 participants