From ca9b4e467fe112d45be5454a69d0cba62d1fa660 Mon Sep 17 00:00:00 2001 From: Bartek Przybylski Date: Fri, 9 Mar 2012 16:45:57 +0100 Subject: [PATCH] filescan by mimetype scan --- lib/filecache.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/filecache.php b/lib/filecache.php index 7cea878042..5d72c4898d 100644 --- a/lib/filecache.php +++ b/lib/filecache.php @@ -540,14 +540,15 @@ class OC_FileCache{ }elseif($root=='/'){ $root=''; } - $rootLen=strlen($root); + $rootLen=strlen($root); + $root .= '%'; $user=OC_User::getUser(); if(!$part2){ - $query=OC_DB::prepare('SELECT path FROM *PREFIX*fscache WHERE mimepart=? AND user=?'); - $result=$query->execute(array($part1,$user)); + $query=OC_DB::prepare('SELECT path FROM *PREFIX*fscache WHERE mimepart=? AND user=? AND path LIKE ?'); + $result=$query->execute(array($part1,$user, $root)); }else{ - $query=OC_DB::prepare('SELECT path FROM *PREFIX*fscache WHERE mimetype=? AND user=?'); - $result=$query->execute(array($part1.'/'.$part2,$user)); + $query=OC_DB::prepare('SELECT path FROM *PREFIX*fscache WHERE mimetype=? AND user=? AND path LIKE ? '); + $result=$query->execute(array($part1.'/'.$part2,$user, $root)); } $names=array(); while($row=$result->fetchRow()){