Sharing: partailly fix searchByMime
This commit is contained in:
parent
86e5a9cd73
commit
a67f11c8af
|
@ -1,23 +1,23 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* ownCloud
|
* ownCloud
|
||||||
*
|
*
|
||||||
* @author Michael Gapczynski
|
* @author Michael Gapczynski
|
||||||
* @copyright 2012 Michael Gapczynski mtgap@owncloud.com
|
* @copyright 2012 Michael Gapczynski mtgap@owncloud.com
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
* License as published by the Free Software Foundation; either
|
* License as published by the Free Software Foundation; either
|
||||||
* version 3 of the License, or any later version.
|
* version 3 of the License, or any later version.
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public
|
* You should have received a copy of the GNU Affero General Public
|
||||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OC\Files\Cache;
|
namespace OC\Files\Cache;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class Shared_Cache extends Cache {
|
||||||
private function getSourceCache($target) {
|
private function getSourceCache($target) {
|
||||||
$source = \OC_Share_Backend_File::getSource($target);
|
$source = \OC_Share_Backend_File::getSource($target);
|
||||||
if (isset($source['path'])) {
|
if (isset($source['path'])) {
|
||||||
$source['path'] = '/'.$source['uid_owner'].'/'.$source['path'];
|
$source['path'] = '/' . $source['uid_owner'] . '/' . $source['path'];
|
||||||
\OC\Files\Filesystem::initMountPoints($source['uid_owner']);
|
\OC\Files\Filesystem::initMountPoints($source['uid_owner']);
|
||||||
list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source['path']);
|
list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source['path']);
|
||||||
if ($storage) {
|
if ($storage) {
|
||||||
|
@ -170,7 +170,7 @@ class Shared_Cache extends Cache {
|
||||||
if ($cache = $this->getSourceCache($source)) {
|
if ($cache = $this->getSourceCache($source)) {
|
||||||
$targetPath = \OC_Share_Backend_File::getSourcePath(dirname($target));
|
$targetPath = \OC_Share_Backend_File::getSourcePath(dirname($target));
|
||||||
if ($targetPath) {
|
if ($targetPath) {
|
||||||
$targetPath .= '/'.basename($target);
|
$targetPath .= '/' . basename($target);
|
||||||
$cache->move($this->files[$source], $targetPath);
|
$cache->move($this->files[$source], $targetPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,11 +222,12 @@ class Shared_Cache extends Cache {
|
||||||
} else {
|
} else {
|
||||||
$where = '`mimepart` = ?';
|
$where = '`mimepart` = ?';
|
||||||
}
|
}
|
||||||
|
$mimetype = $this->getMimetypeId($mimetype);
|
||||||
$ids = $this->getAll();
|
$ids = $this->getAll();
|
||||||
$placeholders = join(',', array_fill(0, count($ids), '?'));
|
$placeholders = join(',', array_fill(0, count($ids), '?'));
|
||||||
$query = \OC_DB::prepare('
|
$query = \OC_DB::prepare('
|
||||||
SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`
|
SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`
|
||||||
FROM `*PREFIX*filecache` WHERE ' . $where . ' AND `fileid` IN = ('.$placeholders.')'
|
FROM `*PREFIX*filecache` WHERE ' . $where . ' AND `fileid` IN (' . $placeholders . ')'
|
||||||
);
|
);
|
||||||
$result = $query->execute(array_merge(array($mimetype), $ids));
|
$result = $query->execute(array_merge(array($mimetype), $ids));
|
||||||
return $result->fetchAll();
|
return $result->fetchAll();
|
||||||
|
|
Loading…
Reference in New Issue