summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2013-02-27 23:36:52 +0100
committerLukas Reschke <lukas@statuscode.ch>2013-02-27 23:36:52 +0100
commitb93ebe18602b6113f778f148a3f0a83f6dd1d391 (patch)
tree6f3c8321befc71185093189d88e9b18d12f81dbd
parent7311c2bb5d724c7c5e3c5ade6b26e3358597a04e (diff)
parent2f036bcc5425bc1b67f7caad4da78ab3efd0fba2 (diff)
downloadnextcloud-server-b93ebe18602b6113f778f148a3f0a83f6dd1d391.tar.gz
nextcloud-server-b93ebe18602b6113f778f148a3f0a83f6dd1d391.zip
Merge master
-rw-r--r--apps/files/templates/part.list.php4
-rw-r--r--core/ajax/update.php3
-rw-r--r--lib/base.php2
-rw-r--r--lib/db.php20
-rwxr-xr-xlib/request.php15
5 files changed, 36 insertions, 8 deletions
diff --git a/apps/files/templates/part.list.php b/apps/files/templates/part.list.php
index cdd157b27e4..712625ce631 100644
--- a/apps/files/templates/part.list.php
+++ b/apps/files/templates/part.list.php
@@ -28,9 +28,9 @@
>
<?php if(!isset($_['readonly']) || !$_['readonly']): ?><input type="checkbox" /><?php endif; ?>
<?php if($file['type'] == 'dir'): ?>
- <a class="name" href="<?php p($_['baseURL'].$directory.'/'.$name); ?>" title="">
+ <a class="name" href="<?php p(rtrim($_['baseURL'],'/').'/'.trim($directory,'/').'/'.$name); ?>" title="">
<?php else: ?>
- <a class="name" href="<?php p($_['downloadURL'].$directory.'/'.$name); ?>" title="">
+ <a class="name" href="<?php p(rtrim($_['downloadURL'],'/').'/'.trim($directory,'/').'/'.$name); ?>" title="">
<?php endif; ?>
<span class="nametext">
<?php if($file['type'] == 'dir'):?>
diff --git a/core/ajax/update.php b/core/ajax/update.php
index 20ab045c892..b112cf6266b 100644
--- a/core/ajax/update.php
+++ b/core/ajax/update.php
@@ -4,6 +4,7 @@ $RUNTIME_NOAPPS = true;
require_once '../../lib/base.php';
if (OC::checkUpgrade(false)) {
+ \OC_DB::enableCaching(false);
$updateEventSource = new OC_EventSource();
$watcher = new UpdateWatcher($updateEventSource);
OC_Hook::connect('update', 'success', $watcher, 'success');
@@ -64,4 +65,4 @@ class UpdateWatcher {
$this->eventSource->close();
}
-} \ No newline at end of file
+}
diff --git a/lib/base.php b/lib/base.php
index 0e751c0f0ec..f70496912df 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -597,7 +597,7 @@ class OC {
if (!self::$CLI) {
try {
OC_App::loadApps();
- OC::getRouter()->match(OC_Request::getPathInfo());
+ OC::getRouter()->match(OC_Request::getRawPathInfo());
return;
} catch (Symfony\Component\Routing\Exception\ResourceNotFoundException $e) {
//header('HTTP/1.0 404 Not Found');
diff --git a/lib/db.php b/lib/db.php
index fb2c027cdb9..347deac8519 100644
--- a/lib/db.php
+++ b/lib/db.php
@@ -42,6 +42,7 @@ class OC_DB {
const BACKEND_MDB2=1;
static private $preparedQueries = array();
+ static private $cachingEnabled = true;
/**
* @var MDB2_Driver_Common
@@ -356,7 +357,7 @@ class OC_DB {
}
}
} else {
- if (isset(self::$preparedQueries[$query])) {
+ if (isset(self::$preparedQueries[$query]) and self::$cachingEnabled) {
return self::$preparedQueries[$query];
}
}
@@ -382,8 +383,11 @@ class OC_DB {
}
$result=new PDOStatementWrapper($result);
}
- if (is_null($limit) || $limit == -1) {
- self::$preparedQueries[$rawQuery] = $result;
+ if ((is_null($limit) || $limit == -1) and self::$cachingEnabled ) {
+ $type = OC_Config::getValue( "dbtype", "sqlite" );
+ if( $type != 'sqlite' && $type != 'sqlite3' ) {
+ self::$preparedQueries[$rawQuery] = $result;
+ }
}
return $result;
}
@@ -915,6 +919,16 @@ class OC_DB {
}
return $msg;
}
+
+ /**
+ * @param bool $enabled
+ */
+ static public function enableCaching($enabled) {
+ if (!$enabled) {
+ self::$preparedQueries = array();
+ }
+ self::$cachingEnabled = $enabled;
+ }
}
/**
diff --git a/lib/request.php b/lib/request.php
index 30a25df23ab..9f74cf9beb5 100755
--- a/lib/request.php
+++ b/lib/request.php
@@ -107,7 +107,7 @@ class OC_Request {
if (array_key_exists('PATH_INFO', $_SERVER)) {
$path_info = $_SERVER['PATH_INFO'];
}else{
- $path_info = substr($_SERVER['REQUEST_URI'], strlen($_SERVER['SCRIPT_NAME']));
+ $path_info = self::getRawPathInfo();
// following is taken from Sabre_DAV_URLUtil::decodePathSegment
$path_info = rawurldecode($path_info);
$encoding = mb_detect_encoding($path_info, array('UTF-8', 'ISO-8859-1'));
@@ -124,6 +124,19 @@ class OC_Request {
}
/**
+ * @brief get Path info from request, not urldecoded
+ * @returns string Path info or false when not found
+ */
+ public static function getRawPathInfo() {
+ $path_info = substr($_SERVER['REQUEST_URI'], strlen($_SERVER['SCRIPT_NAME']));
+ // Remove the query string from REQUEST_URI
+ if ($pos = strpos($path_info, '?')) {
+ $path_info = substr($path_info, 0, $pos);
+ }
+ return $path_info;
+ }
+
+ /**
* @brief Check if this is a no-cache request
* @returns true for no-cache
*/