summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/app.php5
-rw-r--r--lib/private/cache/file.php13
-rw-r--r--lib/private/files/view.php5
-rw-r--r--lib/private/share/share.php22
4 files changed, 36 insertions, 9 deletions
diff --git a/lib/private/app.php b/lib/private/app.php
index c506be1799b..1a32fcfcf77 100644
--- a/lib/private/app.php
+++ b/lib/private/app.php
@@ -1228,17 +1228,18 @@ class OC_App {
// manages line breaks itself
// first of all we split on empty lines
- $paragraphs = preg_split("!\n[[:space:]]*\n!m", $data['description']);
+ $paragraphs = preg_split("!\n[[:space:]]*\n!mu", $data['description']);
$result = [];
foreach ($paragraphs as $value) {
// replace multiple whitespace (tabs, space, newlines) inside a paragraph
// with a single space - also trims whitespace
- $result[] = trim(preg_replace('![[:space:]]+!m', ' ', $value));
+ $result[] = trim(preg_replace('![[:space:]]+!mu', ' ', $value));
}
// join the single paragraphs with a empty line in between
$data['description'] = implode("\n\n", $result);
+
}
return $data;
diff --git a/lib/private/cache/file.php b/lib/private/cache/file.php
index 32c00125764..69008c7fab5 100644
--- a/lib/private/cache/file.php
+++ b/lib/private/cache/file.php
@@ -177,9 +177,16 @@ class File implements ICache {
}
while (($file = readdir($dh)) !== false) {
if ($file != '.' and $file != '..') {
- $mtime = $storage->filemtime('/' . $file);
- if ($mtime < $now) {
- $storage->unlink('/' . $file);
+ try {
+ $mtime = $storage->filemtime('/' . $file);
+ if ($mtime < $now) {
+ $storage->unlink('/' . $file);
+ }
+ } catch (\OCP\Lock\LockedException $e) {
+ // ignore locked chunks
+ \OC::$server->getLogger()->debug('Could not cleanup locked chunk "' . $file . '"', array('app' => 'core'));
+ } catch (\OCP\Files\LockNotAcquiredException $e) {
+ \OC::$server->getLogger()->debug('Could not cleanup locked chunk "' . $file . '"', array('app' => 'core'));
}
}
}
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index f2df2eb0f69..1706818f03e 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -79,6 +79,8 @@ class View {
*/
private $lockingProvider;
+ private $lockingEnabled;
+
/**
* @param string $root
* @throws \Exception If $root contains an invalid path
@@ -94,6 +96,7 @@ class View {
$this->fakeRoot = $root;
$this->updater = new Updater($this);
$this->lockingProvider = \OC::$server->getLockingProvider();
+ $this->lockingEnabled = !($this->lockingProvider instanceof \OC\Lock\NoopLockingProvider);
}
public function getAbsolutePath($path = '/') {
@@ -1026,7 +1029,7 @@ class View {
}
$unlockLater = false;
- if ($operation === 'fopen' and is_resource($result)) {
+ if ($this->lockingEnabled && $operation === 'fopen' && is_resource($result)) {
$unlockLater = true;
$result = CallbackWrapper::wrap($result, null, null, function () use ($hooks, $path) {
if (in_array('write', $hooks)) {
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index 71390d99966..af7f78b9ff5 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -372,6 +372,22 @@ class Share extends Constants {
if ($fileDependent && !self::isFileReachable($row['path'], $row['storage_id'])) {
continue;
}
+ if ($fileDependent && (int)$row['file_parent'] === -1) {
+ // if it is a mount point we need to get the path from the mount manager
+ $mountManager = \OC\Files\Filesystem::getMountManager();
+ $mountPoint = $mountManager->findByStorageId($row['storage_id']);
+ if (!empty($mountPoint)) {
+ $path = $mountPoint[0]->getMountPoint();
+ $path = trim($path, '/');
+ $path = substr($path, strlen($owner) + 1); //normalize path to 'files/foo.txt`
+ $row['path'] = $path;
+ } else {
+ \OC::$server->getLogger()->warning(
+ 'Could not resolve mount point for ' . $row['storage_id'],
+ ['app' => 'OCP\Share']
+ );
+ }
+ }
$shares[] = $row;
}
@@ -2290,7 +2306,7 @@ class Share extends Constants {
if ($fileDependent) {
$select = '`*PREFIX*share`.`id`, `*PREFIX*share`.`parent`, `share_type`, `path`, `storage`, '
. '`share_with`, `uid_owner` , `file_source`, `stime`, `*PREFIX*share`.`permissions`, '
- . '`*PREFIX*storages`.`id` AS `storage_id`';
+ . '`*PREFIX*storages`.`id` AS `storage_id`, `*PREFIX*filecache`.`parent` as `file_parent`';
} else {
$select = '`id`, `parent`, `share_type`, `share_with`, `uid_owner`, `item_source`, `stime`, `*PREFIX*share`.`permissions`';
}
@@ -2300,7 +2316,7 @@ class Share extends Constants {
$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `*PREFIX*share`.`parent`,'
. ' `share_type`, `share_with`, `file_source`, `file_target`, `path`, `*PREFIX*share`.`permissions`, `stime`,'
. ' `expiration`, `token`, `storage`, `mail_send`, `uid_owner`, '
- . '`*PREFIX*storages`.`id` AS `storage_id`';
+ . '`*PREFIX*storages`.`id` AS `storage_id`, `*PREFIX*filecache`.`parent` as `file_parent`';
} else {
$select = '`id`, `item_type`, `item_source`, `parent`, `share_type`, `share_with`, `*PREFIX*share`.`permissions`,'
. ' `stime`, `file_source`, `expiration`, `token`, `mail_send`, `uid_owner`';
@@ -2317,7 +2333,7 @@ class Share extends Constants {
. '`*PREFIX*share`.`parent`, `share_type`, `share_with`, `uid_owner`,'
. '`file_source`, `path`, `file_target`, `*PREFIX*share`.`permissions`,'
. '`stime`, `expiration`, `token`, `storage`, `mail_send`,'
- . '`*PREFIX*storages`.`id` AS `storage_id`';
+ . '`*PREFIX*storages`.`id` AS `storage_id`, `*PREFIX*filecache`.`parent` as `file_parent`';
}
}
}