summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorFrank Karlitschek <frank@owncloud.org>2013-02-10 06:47:44 -0800
committerFrank Karlitschek <frank@owncloud.org>2013-02-10 06:47:44 -0800
commitdc12dd523e450fdb9aa41d845b0cf5cb6d373642 (patch)
tree797b1da3be4a4e0cbb2d2e22d371fe8c9a4217ee /lib
parent980c197fbf6df9466e2236947f290e372f3e6f86 (diff)
parent0c05244f8bdc083f54b01cbde05c3df7bd97e618 (diff)
downloadnextcloud-server-dc12dd523e450fdb9aa41d845b0cf5cb6d373642.tar.gz
nextcloud-server-dc12dd523e450fdb9aa41d845b0cf5cb6d373642.zip
Merge pull request #1581 from owncloud/mapper_md5
Mapper: use md5 hashes for database indexes
Diffstat (limited to 'lib')
-rw-r--r--lib/files/mapper.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/files/mapper.php b/lib/files/mapper.php
index 90e4e1ca669..71b665e49bb 100644
--- a/lib/files/mapper.php
+++ b/lib/files/mapper.php
@@ -114,8 +114,8 @@ class Mapper
private function resolveLogicPath($logicPath) {
$logicPath = $this->stripLast($logicPath);
- $query = \OC_DB::prepare('SELECT * FROM `*PREFIX*file_map` WHERE `logic_path` = ?');
- $result = $query->execute(array($logicPath));
+ $query = \OC_DB::prepare('SELECT * FROM `*PREFIX*file_map` WHERE `logic_path_hash` = ?');
+ $result = $query->execute(array(md5($logicPath)));
$result = $result->fetchRow();
return $result['physic_path'];
@@ -123,8 +123,8 @@ class Mapper
private function resolvePhysicalPath($physicalPath) {
$physicalPath = $this->stripLast($physicalPath);
- $query = \OC_DB::prepare('SELECT * FROM `*PREFIX*file_map` WHERE `physic_path` = ?');
- $result = $query->execute(array($physicalPath));
+ $query = \OC_DB::prepare('SELECT * FROM `*PREFIX*file_map` WHERE `physic_path_hash` = ?');
+ $result = $query->execute(array(md5($physicalPath)));
$result = $result->fetchRow();
return $result['logic_path'];
@@ -151,8 +151,8 @@ class Mapper
}
private function insert($logicPath, $physicalPath) {
- $query = \OC_DB::prepare('INSERT INTO `*PREFIX*file_map`(`logic_path`,`physic_path`) VALUES(?,?)');
- $query->execute(array($logicPath, $physicalPath));
+ $query = \OC_DB::prepare('INSERT INTO `*PREFIX*file_map`(`logic_path`, `physic_path`, `logic_path_hash`, `physic_path_hash`) VALUES(?, ?, ?, ?)');
+ $query->execute(array($logicPath, $physicalPath, md5($logicPath), md5($physicalPath)));
}
private function slugifyPath($path, $index=null) {