Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
bcebfbfb
Commit
bcebfbfb
authored
13 years ago
by
Robin Appelman
Browse files
Options
Downloads
Patches
Plain Diff
bugfix in searching files by mimetype
parent
36d696c3
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/filecache.php
+15
-7
15 additions, 7 deletions
lib/filecache.php
with
15 additions
and
7 deletions
lib/filecache.php
+
15
−
7
View file @
bcebfbfb
...
@@ -466,6 +466,7 @@ class OC_FileCache{
...
@@ -466,6 +466,7 @@ class OC_FileCache{
* fine files by mimetype
* fine files by mimetype
* @param string $part1
* @param string $part1
* @param string $part2 (optional)
* @param string $part2 (optional)
* @param string root (optional)
* @return array of file paths
* @return array of file paths
*
*
* $part1 and $part2 together form the complete mimetype.
* $part1 and $part2 together form the complete mimetype.
...
@@ -474,17 +475,24 @@ class OC_FileCache{
...
@@ -474,17 +475,24 @@ class OC_FileCache{
* seccond mimetype part can be ommited
* seccond mimetype part can be ommited
* e.g. searchByMime('audio')
* e.g. searchByMime('audio')
*/
*/
public
static
function
searchByMime
(
$part1
,
$part2
=
''
){
public
static
function
searchByMime
(
$part1
,
$part2
=
''
,
$root
=
''
){
if
(
$part2
){
if
(
!
$root
){
$query
=
OC_DB
::
prepare
(
'SELECT path FROM *PREFIX*fscache WHERE mimepart=?'
);
$root
=
OC_Filesystem
::
getRoot
();
$result
=
$query
->
execute
(
array
(
$part1
));
}
elseif
(
$root
=
'/'
){
$root
=
''
;
}
$rootLen
=
strlen
(
$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
));
}
else
{
}
else
{
$query
=
OC_DB
::
prepare
(
'SELECT path FROM *PREFIX*fscache WHERE mimetype=?'
);
$query
=
OC_DB
::
prepare
(
'SELECT path FROM *PREFIX*fscache WHERE mimetype=?
AND user=?
'
);
$result
=
$query
->
execute
(
array
(
$part1
.
'/'
.
$part2
));
$result
=
$query
->
execute
(
array
(
$part1
.
'/'
.
$part2
,
$user
));
}
}
$names
=
array
();
$names
=
array
();
while
(
$row
=
$result
->
fetchRow
()){
while
(
$row
=
$result
->
fetchRow
()){
$names
[]
=
$row
[
'path'
];
$names
[]
=
substr
(
$row
[
'path'
]
,
$rootLen
)
;
}
}
return
$names
;
return
$names
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment