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]
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | boost-507348-1.patch | 777 bytes | mikeytown2 |
| #1 | boost-507348.patch | 1.68 KB | mikeytown2 |
Comments
Comment #1
mikeytown2 commentedwow, 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.
Comment #2
chrisakeley commentedI 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
Comment #3
mikeytown2 commentedComment #4
mikeytown2 commentedcommitted the patch, keeping this open so I can add more logic to the actual file deletion function.
Comment #5
mikeytown2 commentedAdded another sanity check
Comment #6
mikeytown2 commentedcommitted 2 days ago
http://drupal.org/cvs?commit=233182