From e2d3225e5aff343bf62b6dbb62eb3526e525cb6b Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Mon, 29 Jul 2013 18:24:05 +0200 Subject: [PATCH] implement a platform independent version of basename --- lib/files/cache/cache.php | 2 +- lib/util.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/files/cache/cache.php b/lib/files/cache/cache.php index 3818fdbd840..5b8dc46b771 100644 --- a/lib/files/cache/cache.php +++ b/lib/files/cache/cache.php @@ -200,7 +200,7 @@ class Cache { $data['path'] = $file; $data['parent'] = $this->getParentId($file); - $data['name'] = basename($file); + $data['name'] = \OC_Util::basename($file); $data['encrypted'] = isset($data['encrypted']) ? ((int)$data['encrypted']) : 0; list($queryParts, $params) = $this->buildParts($data); diff --git a/lib/util.php b/lib/util.php index 981b05b2b46..004470908d1 100755 --- a/lib/util.php +++ b/lib/util.php @@ -892,4 +892,10 @@ class OC_Util { return $value; } + + public static function basename($file) + { + $t = explode('/', $file); + return array_pop($t); + } } -- 2.39.5