From 79355f0417b12c45a6581c8101caef6f6794c968 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 1 May 2009 19:15:44 +0000 Subject: [PATCH] "fix for bug reported on the english user list: limit on the number of cascaded folders in Filemanager --> MySQL 5.0 has a nesting limit for subqueries --> working around that by limiting the nesting level to 10" --- phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php b/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php index e6a9186d56..0f592dec36 100644 --- a/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php +++ b/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php @@ -977,6 +977,19 @@ class sqlfs_stream_wrapper implements iface_stream_wrapper } elseif ($n < count($parts)-1) { + // MySQL 5.0 has a nesting limit for subqueries + // --> we replace the so far cumulated subqueries with their result + // no idea about the other DBMS, but this does NOT hurt ... + if ($n > 1 && !(($n-1) % 10) && !($query = self::$pdo->query($query)->fetchColumn())) + { + if (self::LOG_LEVEL > 1) + { + self::_remove_password($url); + error_log(__METHOD__."('$url',$flags) file or directory not found!"); + } + // we also store negatives (all methods creating new files/dirs have to unset the stat-cache!) + return self::$stat_cache[$path] = false; + } $query = 'SELECT fs_id FROM '.self::TABLE.' WHERE fs_dir=('.$query.') AND fs_name='.self::$pdo->quote($name); // if we are not root AND have no extended acl access, we need to make sure the user has the right to tranverse all parent directories (read-rights)