John Smith wrote: If you look at the PHP manual you'll see the first line is
The glob() function searches for all the pathnames matching pattern according to the rules used by the libc glob() function
But, as far as I am aware, glibc doesn't support '**' natively.
As far as I can see in the PHP glob page all the recursive examples are using /**/ or **/** to return something slightly more than what the built in functionality provides but for example you will see
$ar=glob_recursive($s."**/**");
being called and then looking at the glob_recursive function we have
function glob_recursive($pattern, $flags = 0){
// forked from https://github.com/rodurma/PHP-Functions/
// blob/master/glob_recursive.php
$files = glob($pattern, $flags);
.....
where you see that the $pattern of $s."**/**" is being passed straight into glob() in the first statement
True, but you need to look further at the glob_recursive function and see that the next part then traverses recursively the directories. That first glob call (in effect) just gets any matching names at the top-level or 1 sub-directory down (depending on the pattern).
Looking at the xerte directory on our web server I can see that there are several '*.info' files (13 in all), some of which are several sub-directories down. Using a simple PHP script at the top-level:
<?php
foreach (glob(dirname(__FILE__) . "/**/*.info") as $infoFile) {
echo $infoFile, "<br>";
}
?>
this should return all of those files if '**' recurses the sub-directories. The output though is blank. I suspect because PHP (probably like glibc) is treating '**' as '*', and there are no '*.info' files present in any sub-directory one level down. If I change the pattern to
dirname(__FILE__) . "/modules/**/templates/**/*.info"
as specified in the config file, then it shows most of the '*.info' files present. If I change this to
dirname(__FILE__) . "/modules/*/templates/*/*.info"
I get the same output.
As far as I can tell '**' is not supported, and does not natively recurse directories. The code in config.php works because the required parts of the pathname are present in the pattern (i.e. 'modules/' and 'templates/').
Overall it's a minor point, and as far as I can see makes no difference to the xerte code.
John.