diff options
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/appframework/http/request.php | 5 | ||||
-rw-r--r-- | lib/private/files/objectstore/objectstorestorage.php | 39 | ||||
-rw-r--r-- | lib/private/files/utils/scanner.php | 10 |
3 files changed, 33 insertions, 21 deletions
diff --git a/lib/private/appframework/http/request.php b/lib/private/appframework/http/request.php index cfd903bffe5..77785135162 100644 --- a/lib/private/appframework/http/request.php +++ b/lib/private/appframework/http/request.php @@ -43,6 +43,7 @@ use OCP\Security\ISecureRandom; class Request implements \ArrayAccess, \Countable, IRequest { const USER_AGENT_IE = '/MSIE/'; + const USER_AGENT_IE_8 = '/MSIE 8.0/'; // Android Chrome user agent: https://developers.google.com/chrome/mobile/docs/user-agent const USER_AGENT_ANDROID_MOBILE_CHROME = '#Android.*Chrome/[.0-9]*#'; const USER_AGENT_FREEBOX = '#^Mozilla/5\.0$#'; @@ -410,7 +411,9 @@ class Request implements \ArrayAccess, \Countable, IRequest { } } - $this->items['parameters'] = array_merge($this->items['parameters'], $params); + if (is_array($params)) { + $this->items['parameters'] = array_merge($this->items['parameters'], $params); + } $this->contentDecoded = true; } diff --git a/lib/private/files/objectstore/objectstorestorage.php b/lib/private/files/objectstore/objectstorestorage.php index a85553186ae..40d52feb893 100644 --- a/lib/private/files/objectstore/objectstorestorage.php +++ b/lib/private/files/objectstore/objectstorestorage.php @@ -62,41 +62,44 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common { public function mkdir($path) { $path = $this->normalizePath($path); - if ($this->is_dir($path)) { + if ($this->file_exists($path)) { return false; } - $dirName = $this->normalizePath(dirname($path)); - $parentExists = $this->is_dir($dirName); - $mTime = time(); - - $data = array( + $data = [ 'mimetype' => 'httpd/unix-directory', 'size' => 0, 'mtime' => $mTime, 'storage_mtime' => $mTime, 'permissions' => \OCP\Constants::PERMISSION_ALL, - ); - - if ($dirName === '' && !$parentExists) { + ]; + if ($path === '') { //create root on the fly $data['etag'] = $this->getETag(''); $this->getCache()->put('', $data); - $parentExists = true; - - // we are done when the root folder was meant to be created - if ($dirName === $path) { - return true; + return true; + } else { + // if parent does not exist, create it + $parent = $this->normalizePath(dirname($path)); + $parentType = $this->filetype($parent); + if ($parentType === false) { + if (!$this->mkdir($parent)) { + // something went wrong + return false; + } + } else if ($parentType === 'file') { + // parent is a file + return false; } - } - - if ($parentExists) { + // finally create the new dir + $mTime = time(); // update mtime + $data['mtime'] = $mTime; + $data['storage_mtime'] = $mTime; $data['etag'] = $this->getETag($path); $this->getCache()->put($path, $data); return true; } - return false; } /** diff --git a/lib/private/files/utils/scanner.php b/lib/private/files/utils/scanner.php index 35e36e23cb2..460c8007bf4 100644 --- a/lib/private/files/utils/scanner.php +++ b/lib/private/files/utils/scanner.php @@ -31,6 +31,7 @@ use OC\Files\Cache\ChangePropagator; use OC\Files\Filesystem; use OC\ForbiddenException; use OC\Hooks\PublicEmitter; +use OC\Lock\DBLockingProvider; /** * Class Scanner @@ -156,9 +157,14 @@ class Scanner extends PublicEmitter { $scanner = $storage->getScanner(); $scanner->setUseTransactions(false); $this->attachListener($mount); - $this->db->beginTransaction(); + $isDbLocking = \OC::$server->getLockingProvider() instanceof DBLockingProvider; + if (!$isDbLocking) { + $this->db->beginTransaction(); + } $scanner->scan($relativePath, \OC\Files\Cache\Scanner::SCAN_RECURSIVE, \OC\Files\Cache\Scanner::REUSE_ETAG | \OC\Files\Cache\Scanner::REUSE_SIZE); - $this->db->commit(); + if (!$isDbLocking) { + $this->db->commit(); + } } $this->propagator->propagateChanges(time()); } |