Quantcast
Channel: Issues for XML sitemap
Viewing all articles
Browse latest Browse all 1238

Improve recursive delete function

$
0
0

Problem/Motivation

This is both a bug fix and an improvement.

For the bug fix, the _xmlsitemap_delete_recursive function is a backport of what D7 does for file_unmanaged_delete_recursive. I'm assuming this must have been copied a long time ago, because it references the function as having two parameters, when it currently only has one. Have removed the second parameter.

For the improvement, have modified the return function to check if $path value is empty. We were regularly seeing warning messages in watchdog from xmlsitemap cron runs that "The file was not deleted, because it does not exist.".

Granted, core's file_unmanaged_delete_recursive function will render this warning in watchdog if the $path is empty. However, the xmlsitemap version of this function has already been edited to check if $delete_root exists when running the return drupal_rmdir($path) line.

I think a similar change should be made for the file_unmanaged_delete step to eliminate the extraneous watchdog messages.

Steps to reproduce

Rebuild xmlsitemap for a site that will return an empty path during regeneration.

Proposed resolution

See attached patch.

Remaining tasks

Review patch and provide feedback. Will modify as necessary. Thanks.


Viewing all articles
Browse latest Browse all 1238

Trending Articles