This is a minor item but I believe it would yield a small performance gain. The function file_scan_directory (line 884 in Drupal 6.10) takes a $recurse parameter. A few lines into the function (line 891), there is the following check:
if (is_dir("$dir/$file") && $recurse) {
This could be more optimally rendered as:
if ($recurse && is_dir("$dir/$file")) {
Assigning to self as a reminder to write and submit the patch. Posting here first just to be cautious in case there's some sort of PHP4 compat wierdness (or some such thing) that I'm just not aware of.
Comments
Comment #1
MatthijsG commentedI think this 'patch' helped me with the following error message:
is_dir() [function.is-dir]: open_basedir restriction in effect. File(/tmp/magice1Q6r5) is not within the allowed path(s): (/usr/share/php:/home/domain.com/:/usr/share/pear:/usr/sbin:/usr/bin:/bin:/tmp:/etc/phpmyadmin:/usr/lib/php4:/usr/lib/php5:/opt/ioncube/lib) in /home/domain.com/public_html/drupal6/includes/file.inc on line 891.
Comment #2
RikiB commentedwow, after many hours searching and trying things, this actually fixed the same error I was getting. Cept mine was stated like this:
warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/tmp/mysql.sock) is not within the allowed path(s): (/home/xxxx:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/xxxx/public_html/includes/file.inc on line 891.
I dont know how or why it fixed it but I hope someone is reading this and will put it in core!!
Comment #4
quietone commentedUpdating tags per Issue tags field and Issue tags -- special tags and for issue #3565085: Drupal core issue tag cleanup.