From 5f11049852faaff2fffc69c7d59ba50c9482190c Mon Sep 17 00:00:00 2001 From: Individual IT Services Date: Fri, 11 Sep 2015 15:07:13 +0545 Subject: reduce amount of db calls needed for file-locks return result of insertIfNotExist() reducing initLockField, throwing exeption in releaseLock don't throw exception in releaseLock() cleaning up whitespaces --- lib/private/lock/dblockingprovider.php | 36 ++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/lib/private/lock/dblockingprovider.php b/lib/private/lock/dblockingprovider.php index bfa86a6920e..a08357a6024 100644 --- a/lib/private/lock/dblockingprovider.php +++ b/lib/private/lock/dblockingprovider.php @@ -58,9 +58,17 @@ class DBLockingProvider extends AbstractLockingProvider { $this->timeFactory = $timeFactory; } - protected function initLockField($path) { + /** + * Insert a file locking row if it does not exists. + * + * @param string $path + * @param int $lock + * @return int number of inserted rows + */ + + protected function initLockField($path, $lock = 0) { $expire = $this->getExpireTime(); - $this->connection->insertIfNotExist('*PREFIX*file_locks', ['key' => $path, 'lock' => 0, 'ttl' => $expire], ['key']); + return $this->connection->insertIfNotExist('*PREFIX*file_locks', ['key' => $path, 'lock' => $lock, 'ttl' => $expire], ['key']); } /** @@ -98,18 +106,23 @@ class DBLockingProvider extends AbstractLockingProvider { $this->logger->warning("Trying to acquire a lock for '$path' while inside a transition"); } - $this->initLockField($path); $expire = $this->getExpireTime(); if ($type === self::LOCK_SHARED) { - $result = $this->connection->executeUpdate( - 'UPDATE `*PREFIX*file_locks` SET `lock` = `lock` + 1, `ttl` = ? WHERE `key` = ? AND `lock` >= 0', - [$expire, $path] - ); + $result = $this->initLockField($path,1); + if ($result <= 0) { + $result = $this->connection->executeUpdate ( + 'UPDATE `*PREFIX*file_locks` SET `lock` = `lock` + 1, `ttl` = ? WHERE `key` = ? AND `lock` >= 0', + [$expire, $path] + ); + } } else { - $result = $this->connection->executeUpdate( - 'UPDATE `*PREFIX*file_locks` SET `lock` = -1, `ttl` = ? WHERE `key` = ? AND `lock` = 0', - [$expire, $path] - ); + $result = $this->initLockField($path,-1); + if ($result <= 0) { + $result = $this->connection->executeUpdate( + 'UPDATE `*PREFIX*file_locks` SET `lock` = -1, `ttl` = ? WHERE `key` = ? AND `lock` = 0', + [$expire, $path] + ); + } } if ($result !== 1) { throw new LockedException($path); @@ -122,7 +135,6 @@ class DBLockingProvider extends AbstractLockingProvider { * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE */ public function releaseLock($path, $type) { - $this->initLockField($path); if ($type === self::LOCK_SHARED) { $this->connection->executeUpdate( 'UPDATE `*PREFIX*file_locks` SET `lock` = `lock` - 1 WHERE `key` = ? AND `lock` > 0', -- cgit v1.2.3 From 3f0a870908fb0c63b46e15d32fa9468105e224a1 Mon Sep 17 00:00:00 2001 From: Hendrik Leppelsack Date: Tue, 22 Sep 2015 23:31:50 +0200 Subject: implement builder pattern in tipsy shim --- core/js/js.js | 1 + 1 file changed, 1 insertion(+) diff --git a/core/js/js.js b/core/js/js.js index de773dc1221..b5971bfc579 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -1972,4 +1972,5 @@ jQuery.fn.tipsy = function(argument) { this.tooltip(argument); jQuery.fn.tooltip.call(this, argument); } + return this; } -- cgit v1.2.3 From 4410ca50354d245106e454a8eec08231509f2d1d Mon Sep 17 00:00:00 2001 From: Carla Schroder Date: Fri, 18 Sep 2015 08:46:12 -0700 Subject: add example for 3rdparty configuration --- config/config.sample.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/config.sample.php b/config/config.sample.php index 8949bd44465..51529cdb0cc 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -609,7 +609,9 @@ $CONFIG = array( /** * ownCloud uses some 3rd party PHP components to provide certain functionality. * These components are shipped as part of the software package and reside in - * ``owncloud/3rdparty``. Use this option to configure a different location. + * ``owncloud/3rdparty``. Use this option to configure a different location. + * For example, if your location is /var/www/owncloud/foo/3rdparty, then the + * correct configuration is '3rdpartyroot' => '/var/www/owncloud/foo/', */ '3rdpartyroot' => '', -- cgit v1.2.3