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]

CommentFileSizeAuthor
#5 boost-507348-1.patch777 bytesmikeytown2
#1 boost-507348.patch1.68 KBmikeytown2

Comments

mikeytown2’s picture

StatusFileSize
new1.68 KB

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.

chrisakeley’s picture

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

mikeytown2’s picture

Status: Needs review » Reviewed & tested by the community
mikeytown2’s picture

Title: *.xml and *.html files deleted at document root » *.xml and *.html files could be deleted at document root
Priority: Critical » Normal
Status: Reviewed & tested by the community » Active

committed the patch, keeping this open so I can add more logic to the actual file deletion function.

mikeytown2’s picture

Status: Active » Needs review
StatusFileSize
new777 bytes

Added another sanity check

mikeytown2’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.