*.xml and *.html files could be deleted at document root
lapith - July 1, 2009 - 16:34
| Project: | Boost |
| Version: | 6.x-1.0-beta2 |
| Component: | Expiration logic |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
We currently have a .xml file and a couple of static .html files (for apache errors as an example). We had noticed that these files were randomly being deleted from the document root. As a result of some digging I was able to determine that the problem lies with the combination of the glob() call and the boost_file_path function.
$tempA = glob(boost_file_path($path, FALSE, NULL) . (($wildcard) ? '*' : '') . BOOST_FILE_EXTENSION, GLOB_NOSORT);
$tempB = glob(boost_file_path($path, FALSE, NULL) . (($wildcard) ? '*' : '') . BOOST_XML_EXTENSION, GLOB_NOSORT);in some instances the boost_file_path function returns false (especially since the $query param is FALSE). As a temporary solution to this I wrapped these in a conditional:
if(boost_file_path($path, FALSE, NULL) !== FALSE) {
$tempA = glob(boost_file_path($path, FALSE, NULL) . (($wildcard) ? '*' : '') . BOOST_FILE_EXTENSION, GLOB_NOSORT);
$tempB = glob(boost_file_path($path, FALSE, NULL) . (($wildcard) ? '*' : '') . BOOST_XML_EXTENSION, GLOB_NOSORT);
}This will ensure that there is always a path before the *.[ext]

#1
wow, talk about an ugly bug. Thanks for tracking this down! Looks like I really should change this glob() to a database LIKE search in the future. Here's my take on your patch; testing would be appreciated.
#2
I tested this version, along with some similar lines based on the original suggestion. It works like a champ with no ill effect on boost functionality. I'm going to install it tonight on weei.com
#3
#4
committed the patch, keeping this open so I can add more logic to the actual file deletion function.
#5
Added another sanity check
#6
committed 2 days ago
http://drupal.org/cvs?commit=233182
#7
Automatically closed -- issue fixed for 2 weeks with no activity.