Merge master

This commit is contained in:
Lukas Reschke 2013-02-27 23:36:52 +01:00
commit b93ebe1860
5 changed files with 36 additions and 8 deletions

View File

@ -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'):?>

View File

@ -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();
}
}
}

View File

@ -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');

View File

@ -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;
}
}
/**

View File

@ -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'));
@ -123,6 +123,19 @@ class OC_Request {
return $path_info;
}
/**
* @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