aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/l10n/de_DE.js2
-rw-r--r--lib/l10n/de_DE.json2
-rw-r--r--lib/l10n/ja.js3
-rw-r--r--lib/l10n/ja.json3
-rw-r--r--lib/l10n/nl.js1
-rw-r--r--lib/l10n/nl.json1
-rw-r--r--lib/l10n/pt_BR.js1
-rw-r--r--lib/l10n/pt_BR.json1
-rw-r--r--lib/l10n/th_TH.js1
-rw-r--r--lib/l10n/th_TH.json1
-rw-r--r--lib/private/backgroundjob/joblist.php2
-rw-r--r--lib/private/files/cache/cache.php67
-rw-r--r--lib/private/files/cache/movefromcachetrait.php87
-rw-r--r--lib/private/share20/defaultshareprovider.php41
-rw-r--r--lib/private/share20/manager.php13
-rw-r--r--lib/public/backgroundjob.php38
-rw-r--r--lib/public/backgroundjob/ijoblist.php2
-rw-r--r--lib/public/files/cache/icache.php4
-rw-r--r--lib/public/files/cache/icacheentry.php2
-rw-r--r--lib/public/files/storagenotavailableexception.php2
-rw-r--r--lib/public/share/imanager.php4
-rw-r--r--lib/public/share/ishareprovider.php4
22 files changed, 185 insertions, 97 deletions
diff --git a/lib/l10n/de_DE.js b/lib/l10n/de_DE.js
index 886d107bc7a..b434ac56aad 100644
--- a/lib/l10n/de_DE.js
+++ b/lib/l10n/de_DE.js
@@ -107,8 +107,10 @@ OC.L10N.register(
"Sharing %s failed, because resharing is not allowed" : "Freigabe von %s fehlgeschlagen, da das nochmalige Freigeben einer Freigabe nicht erlaubt ist",
"Sharing %s failed, because the sharing backend for %s could not find its source" : "Freigabe von %s fehlgeschlagen, da das Freigabe-Backend für %s nicht in dieser Quelle gefunden werden konnte",
"Sharing %s failed, because the file could not be found in the file cache" : "Freigabe von %s fehlgeschlagen, da die Datei im Datei-Cache nicht gefunden werden konnte",
+ "Expiration date is in the past" : "Das Ablaufdatum liegt in der Vergangenheit.",
"Could not find category \"%s\"" : "Die Kategorie „%s“ konnte nicht gefunden werden",
"Apps" : "Apps",
+ "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-'\"" : "Nur die follgenden Zeichen sind im Benutzernamen erlaubt: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-'\"",
"A valid username must be provided" : "Es muss ein gültiger Benutzername angegeben werden",
"A valid password must be provided" : "Es muss ein gültiges Passwort angegeben werden",
"The username is already being used" : "Der Benutzername existiert bereits",
diff --git a/lib/l10n/de_DE.json b/lib/l10n/de_DE.json
index 33a177eedea..09ce050c452 100644
--- a/lib/l10n/de_DE.json
+++ b/lib/l10n/de_DE.json
@@ -105,8 +105,10 @@
"Sharing %s failed, because resharing is not allowed" : "Freigabe von %s fehlgeschlagen, da das nochmalige Freigeben einer Freigabe nicht erlaubt ist",
"Sharing %s failed, because the sharing backend for %s could not find its source" : "Freigabe von %s fehlgeschlagen, da das Freigabe-Backend für %s nicht in dieser Quelle gefunden werden konnte",
"Sharing %s failed, because the file could not be found in the file cache" : "Freigabe von %s fehlgeschlagen, da die Datei im Datei-Cache nicht gefunden werden konnte",
+ "Expiration date is in the past" : "Das Ablaufdatum liegt in der Vergangenheit.",
"Could not find category \"%s\"" : "Die Kategorie „%s“ konnte nicht gefunden werden",
"Apps" : "Apps",
+ "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-'\"" : "Nur die follgenden Zeichen sind im Benutzernamen erlaubt: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-'\"",
"A valid username must be provided" : "Es muss ein gültiger Benutzername angegeben werden",
"A valid password must be provided" : "Es muss ein gültiges Passwort angegeben werden",
"The username is already being used" : "Der Benutzername existiert bereits",
diff --git a/lib/l10n/ja.js b/lib/l10n/ja.js
index 2de52bad390..e3433a18d7a 100644
--- a/lib/l10n/ja.js
+++ b/lib/l10n/ja.js
@@ -113,8 +113,11 @@ OC.L10N.register(
"Sharing %s failed, because resharing is not allowed" : "%s を共有できませんでした。再共有は許可されていません。",
"Sharing %s failed, because the sharing backend for %s could not find its source" : "%s の共有に失敗しました。%s のバックエンド共有に必要なソースが見つかりませんでした。",
"Sharing %s failed, because the file could not be found in the file cache" : "%s の共有に失敗しました。ファイルキャッシュにファイルがありませんでした。",
+ "Expiration date is in the past" : "有効期限が切れています",
+ "Cannot set expiration date more than %s days in the future" : "有効期限を%s日以降に設定できません。",
"Could not find category \"%s\"" : "カテゴリ \"%s\" が見つかりませんでした",
"Apps" : "アプリ",
+ "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-'\"" : "ユーザー名で利用できる文字列は、次のものです: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"",
"A valid username must be provided" : "有効なユーザー名を指定する必要があります",
"A valid password must be provided" : "有効なパスワードを指定する必要があります",
"The username is already being used" : "ユーザー名はすでに使われています",
diff --git a/lib/l10n/ja.json b/lib/l10n/ja.json
index 42b9b1912c7..a4b18386c7a 100644
--- a/lib/l10n/ja.json
+++ b/lib/l10n/ja.json
@@ -111,8 +111,11 @@
"Sharing %s failed, because resharing is not allowed" : "%s を共有できませんでした。再共有は許可されていません。",
"Sharing %s failed, because the sharing backend for %s could not find its source" : "%s の共有に失敗しました。%s のバックエンド共有に必要なソースが見つかりませんでした。",
"Sharing %s failed, because the file could not be found in the file cache" : "%s の共有に失敗しました。ファイルキャッシュにファイルがありませんでした。",
+ "Expiration date is in the past" : "有効期限が切れています",
+ "Cannot set expiration date more than %s days in the future" : "有効期限を%s日以降に設定できません。",
"Could not find category \"%s\"" : "カテゴリ \"%s\" が見つかりませんでした",
"Apps" : "アプリ",
+ "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-'\"" : "ユーザー名で利用できる文字列は、次のものです: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"",
"A valid username must be provided" : "有効なユーザー名を指定する必要があります",
"A valid password must be provided" : "有効なパスワードを指定する必要があります",
"The username is already being used" : "ユーザー名はすでに使われています",
diff --git a/lib/l10n/nl.js b/lib/l10n/nl.js
index b2427d3f1ee..e49ddc6d27c 100644
--- a/lib/l10n/nl.js
+++ b/lib/l10n/nl.js
@@ -118,6 +118,7 @@ OC.L10N.register(
"Cannot set expiration date more than %s days in the future" : "Kan vervaldatum niet verder dan %s dagen in de toekomst instellen",
"Could not find category \"%s\"" : "Kon categorie \"%s\" niet vinden",
"Apps" : "Apps",
+ "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-'\"" : "Alleen de volgende tekens zijn toegestaan in een gebruikersnaam: \"a-z\", \"A-Z\", \"0-9\", en \"_.@-\"",
"A valid username must be provided" : "Er moet een geldige gebruikersnaam worden opgegeven",
"A valid password must be provided" : "Er moet een geldig wachtwoord worden opgegeven",
"The username is already being used" : "De gebruikersnaam bestaat al",
diff --git a/lib/l10n/nl.json b/lib/l10n/nl.json
index 094866dc08b..78b54fbbc6d 100644
--- a/lib/l10n/nl.json
+++ b/lib/l10n/nl.json
@@ -116,6 +116,7 @@
"Cannot set expiration date more than %s days in the future" : "Kan vervaldatum niet verder dan %s dagen in de toekomst instellen",
"Could not find category \"%s\"" : "Kon categorie \"%s\" niet vinden",
"Apps" : "Apps",
+ "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-'\"" : "Alleen de volgende tekens zijn toegestaan in een gebruikersnaam: \"a-z\", \"A-Z\", \"0-9\", en \"_.@-\"",
"A valid username must be provided" : "Er moet een geldige gebruikersnaam worden opgegeven",
"A valid password must be provided" : "Er moet een geldig wachtwoord worden opgegeven",
"The username is already being used" : "De gebruikersnaam bestaat al",
diff --git a/lib/l10n/pt_BR.js b/lib/l10n/pt_BR.js
index a9a282882c6..1ffbdc17a7b 100644
--- a/lib/l10n/pt_BR.js
+++ b/lib/l10n/pt_BR.js
@@ -118,6 +118,7 @@ OC.L10N.register(
"Cannot set expiration date more than %s days in the future" : "Não é possível definir a data de validade mais de %s dias no futuro",
"Could not find category \"%s\"" : "Impossível localizar categoria \"%s\"",
"Apps" : "Aplicações",
+ "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-'\"" : "Somente os seguintes caracteres são permitidos em um nome de usuário: \"a-z\", \"A-Z\", \"0-9\", e \"_.@-'\"",
"A valid username must be provided" : "Forneça um nome de usuário válido",
"A valid password must be provided" : "Forneça uma senha válida",
"The username is already being used" : "Este nome de usuário já está sendo usado",
diff --git a/lib/l10n/pt_BR.json b/lib/l10n/pt_BR.json
index 0a2ed3628dd..cb0e48af0db 100644
--- a/lib/l10n/pt_BR.json
+++ b/lib/l10n/pt_BR.json
@@ -116,6 +116,7 @@
"Cannot set expiration date more than %s days in the future" : "Não é possível definir a data de validade mais de %s dias no futuro",
"Could not find category \"%s\"" : "Impossível localizar categoria \"%s\"",
"Apps" : "Aplicações",
+ "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-'\"" : "Somente os seguintes caracteres são permitidos em um nome de usuário: \"a-z\", \"A-Z\", \"0-9\", e \"_.@-'\"",
"A valid username must be provided" : "Forneça um nome de usuário válido",
"A valid password must be provided" : "Forneça uma senha válida",
"The username is already being used" : "Este nome de usuário já está sendo usado",
diff --git a/lib/l10n/th_TH.js b/lib/l10n/th_TH.js
index 7e0d4a32695..a5116ec6e5c 100644
--- a/lib/l10n/th_TH.js
+++ b/lib/l10n/th_TH.js
@@ -118,6 +118,7 @@ OC.L10N.register(
"Cannot set expiration date more than %s days in the future" : "ไม่สามารถกำหนดวันหมดอายุให้มากกว่า %s วันในอนาคต",
"Could not find category \"%s\"" : "ไม่พบหมวดหมู่ \"%s\"",
"Apps" : "แอปฯ",
+ "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-'\"" : "ชื่อผู้ใช้จะใช้ได้แค่อักษรดังต่อไปนี้: \"a-z\", \"A-Z\", \"0-9\" และ \"_.@-'\"",
"A valid username must be provided" : "จะต้องระบุชื่อผู้ใช้ที่ถูกต้อง",
"A valid password must be provided" : "รหัสผ่านที่ถูกต้องจะต้องให้",
"The username is already being used" : "มีคนใช้ชื่อผู้ใช้นี้ไปแล้ว",
diff --git a/lib/l10n/th_TH.json b/lib/l10n/th_TH.json
index 0c10e380cd7..52fb06d31d5 100644
--- a/lib/l10n/th_TH.json
+++ b/lib/l10n/th_TH.json
@@ -116,6 +116,7 @@
"Cannot set expiration date more than %s days in the future" : "ไม่สามารถกำหนดวันหมดอายุให้มากกว่า %s วันในอนาคต",
"Could not find category \"%s\"" : "ไม่พบหมวดหมู่ \"%s\"",
"Apps" : "แอปฯ",
+ "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-'\"" : "ชื่อผู้ใช้จะใช้ได้แค่อักษรดังต่อไปนี้: \"a-z\", \"A-Z\", \"0-9\" และ \"_.@-'\"",
"A valid username must be provided" : "จะต้องระบุชื่อผู้ใช้ที่ถูกต้อง",
"A valid password must be provided" : "รหัสผ่านที่ถูกต้องจะต้องให้",
"The username is already being used" : "มีคนใช้ชื่อผู้ใช้นี้ไปแล้ว",
diff --git a/lib/private/backgroundjob/joblist.php b/lib/private/backgroundjob/joblist.php
index cc9be574807..2920cb5214c 100644
--- a/lib/private/backgroundjob/joblist.php
+++ b/lib/private/backgroundjob/joblist.php
@@ -139,6 +139,8 @@ class JobList implements IJobList {
* get all jobs in the list
*
* @return IJob[]
+ * @deprecated 9.0.0 - This method is dangerous since it can cause load and
+ * memory problems when creating too many instances.
*/
public function getAll() {
$query = $this->connection->getQueryBuilder();
diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php
index 527c8b76e52..30e00b6080c 100644
--- a/lib/private/files/cache/cache.php
+++ b/lib/private/files/cache/cache.php
@@ -49,6 +49,10 @@ use OCP\IDBConnection;
* - ChangePropagator: updates the mtime and etags of parent folders whenever a change to the cache is made to the cache by the updater
*/
class Cache implements ICache {
+ use MoveFromCacheTrait {
+ MoveFromCacheTrait::moveFromCache as moveFromCacheFallback;
+ }
+
/**
* @var array partial data for the cache
*/
@@ -466,39 +470,42 @@ class Cache implements ICache {
* @throws \OC\DatabaseException
*/
public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) {
- // normalize source and target
- $sourcePath = $this->normalize($sourcePath);
- $targetPath = $this->normalize($targetPath);
-
- $sourceData = $sourceCache->get($sourcePath);
- $sourceId = $sourceData['fileid'];
- $newParentId = $this->getParentId($targetPath);
-
- list($sourceStorageId, $sourcePath) = $sourceCache->getMoveInfo($sourcePath);
- list($targetStorageId, $targetPath) = $this->getMoveInfo($targetPath);
-
- // sql for final update
- $moveSql = 'UPDATE `*PREFIX*filecache` SET `storage` = ?, `path` = ?, `path_hash` = ?, `name` = ?, `parent` =? WHERE `fileid` = ?';
-
- if ($sourceData['mimetype'] === 'httpd/unix-directory') {
- //find all child entries
- $sql = 'SELECT `path`, `fileid` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `path` LIKE ?';
- $result = $this->connection->executeQuery($sql, [$sourceStorageId, $this->connection->escapeLikeParameter($sourcePath) . '/%']);
- $childEntries = $result->fetchAll();
- $sourceLength = strlen($sourcePath);
- $this->connection->beginTransaction();
- $query = $this->connection->prepare('UPDATE `*PREFIX*filecache` SET `storage` = ?, `path` = ?, `path_hash` = ? WHERE `fileid` = ?');
-
- foreach ($childEntries as $child) {
- $newTargetPath = $targetPath . substr($child['path'], $sourceLength);
- $query->execute([$targetStorageId, $newTargetPath, md5($newTargetPath), $child['fileid']]);
+ if ($sourceCache instanceof Cache) {
+ // normalize source and target
+ $sourcePath = $this->normalize($sourcePath);
+ $targetPath = $this->normalize($targetPath);
+
+ $sourceData = $sourceCache->get($sourcePath);
+ $sourceId = $sourceData['fileid'];
+ $newParentId = $this->getParentId($targetPath);
+
+ list($sourceStorageId, $sourcePath) = $sourceCache->getMoveInfo($sourcePath);
+ list($targetStorageId, $targetPath) = $this->getMoveInfo($targetPath);
+
+ // sql for final update
+ $moveSql = 'UPDATE `*PREFIX*filecache` SET `storage` = ?, `path` = ?, `path_hash` = ?, `name` = ?, `parent` =? WHERE `fileid` = ?';
+
+ if ($sourceData['mimetype'] === 'httpd/unix-directory') {
+ //find all child entries
+ $sql = 'SELECT `path`, `fileid` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `path` LIKE ?';
+ $result = $this->connection->executeQuery($sql, [$sourceStorageId, $this->connection->escapeLikeParameter($sourcePath) . '/%']);
+ $childEntries = $result->fetchAll();
+ $sourceLength = strlen($sourcePath);
+ $this->connection->beginTransaction();
+ $query = $this->connection->prepare('UPDATE `*PREFIX*filecache` SET `storage` = ?, `path` = ?, `path_hash` = ? WHERE `fileid` = ?');
+
+ foreach ($childEntries as $child) {
+ $newTargetPath = $targetPath . substr($child['path'], $sourceLength);
+ $query->execute([$targetStorageId, $newTargetPath, md5($newTargetPath), $child['fileid']]);
+ }
+ $this->connection->executeQuery($moveSql, [$targetStorageId, $targetPath, md5($targetPath), basename($targetPath), $newParentId, $sourceId]);
+ $this->connection->commit();
+ } else {
+ $this->connection->executeQuery($moveSql, [$targetStorageId, $targetPath, md5($targetPath), basename($targetPath), $newParentId, $sourceId]);
}
- $this->connection->executeQuery($moveSql, [$targetStorageId, $targetPath, md5($targetPath), basename($targetPath), $newParentId, $sourceId]);
- $this->connection->commit();
} else {
- $this->connection->executeQuery($moveSql, [$targetStorageId, $targetPath, md5($targetPath), basename($targetPath), $newParentId, $sourceId]);
+ $this->moveFromCacheFallback($sourceCache, $sourcePath, $targetPath);
}
-
}
/**
diff --git a/lib/private/files/cache/movefromcachetrait.php b/lib/private/files/cache/movefromcachetrait.php
new file mode 100644
index 00000000000..7d8ed7b5d21
--- /dev/null
+++ b/lib/private/files/cache/movefromcachetrait.php
@@ -0,0 +1,87 @@
+<?php
+/**
+ * @author Robin Appelman <icewind@owncloud.com>
+ *
+ * @copyright Copyright (c) 2016, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OC\Files\Cache;
+
+use OCP\Files\Cache\ICache;
+use OCP\Files\Cache\ICacheEntry;
+
+/**
+ * Fallback implementation for moveFromCache
+ */
+trait MoveFromCacheTrait {
+ /**
+ * store meta data for a file or folder
+ *
+ * @param string $file
+ * @param array $data
+ *
+ * @return int file id
+ * @throws \RuntimeException
+ */
+ abstract public function put($file, array $data);
+
+ /**
+ * Move a file or folder in the cache
+ *
+ * @param \OCP\Files\Cache\ICache $sourceCache
+ * @param string $sourcePath
+ * @param string $targetPath
+ */
+ public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) {
+ $sourceEntry = $sourceCache->get($sourcePath);
+
+ $this->copyFromCache($sourceCache, $sourceEntry, $targetPath);
+
+ $sourceCache->remove($sourcePath);
+ }
+
+ /**
+ * Copy a file or folder in the cache
+ *
+ * @param \OCP\Files\Cache\ICache $sourceCache
+ * @param ICacheEntry $sourceEntry
+ * @param string $targetPath
+ */
+ public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, $targetPath) {
+ $this->put($targetPath, $this->cacheEntryToArray($sourceEntry));
+ if ($sourceEntry->getMimeType() === ICacheEntry::DIRECTORY_MIMETYPE) {
+ $folderContent = $sourceCache->getFolderContentsById($sourceEntry->getId());
+ foreach ($folderContent as $subEntry) {
+ $subTargetPath = $targetPath . '/' . $subEntry->getName();
+ $this->copyFromCache($sourceCache, $subEntry, $subTargetPath);
+ }
+ }
+ }
+
+ private function cacheEntryToArray(ICacheEntry $entry) {
+ return [
+ 'size' => $entry->getSize(),
+ 'mtime' => $entry->getMTime(),
+ 'storage_mtime' => $entry->getStorageMTime(),
+ 'mimetype' => $entry->getMimeType(),
+ 'mimepart' => $entry->getMimePart(),
+ 'etag' => $entry->getEtag(),
+ 'permissions' => $entry->getPermissions(),
+ 'encrypted' => $entry->isEncrypted()
+ ];
+ }
+}
diff --git a/lib/private/share20/defaultshareprovider.php b/lib/private/share20/defaultshareprovider.php
index baa12d6c933..0fa1552a1e7 100644
--- a/lib/private/share20/defaultshareprovider.php
+++ b/lib/private/share20/defaultshareprovider.php
@@ -288,21 +288,21 @@ class DefaultShareProvider implements IShareProvider {
* Delete a share
*
* @param \OCP\Share\IShare $share
- * @throws BackendError
*/
public function delete(\OCP\Share\IShare $share) {
- // Fetch share to make sure it exists
- $share = $this->getShareById($share->getId());
-
$qb = $this->dbConn->getQueryBuilder();
$qb->delete('share')
->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId())));
-
- try {
- $qb->execute();
- } catch (\Exception $e) {
- throw new BackendError();
+
+ /*
+ * If the share is a group share delete all possible
+ * user defined groups shares.
+ */
+ if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
+ $qb->orWhere($qb->expr()->eq('parent', $qb->createNamedParameter($share->getId())));
}
+
+ $qb->execute();
}
/**
@@ -518,16 +518,9 @@ class DefaultShareProvider implements IShareProvider {
}
/**
- * Get shared with the given user
- *
- * @param IUser $user get shares where this user is the recipient
- * @param int $shareType \OCP\Share::SHARE_TYPE_USER or \OCP\Share::SHARE_TYPE_GROUP are supported
- * @param int $limit The maximum number of shares, -1 for all
- * @param int $offset
- * @return IShare[]
- * @throws BackendError
+ * @inheritdoc
*/
- public function getSharedWith(IUser $user, $shareType, $limit, $offset) {
+ public function getSharedWith(IUser $user, $shareType, $node, $limit, $offset) {
/** @var Share[] $shares */
$shares = [];
@@ -549,6 +542,11 @@ class DefaultShareProvider implements IShareProvider {
$qb->where($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_USER)));
$qb->andWhere($qb->expr()->eq('share_with', $qb->createNamedParameter($user->getUID())));
+ // Filter by node if provided
+ if ($node !== null) {
+ $qb->andWhere($qb->expr()->eq('file_source', $qb->createNamedParameter($node->getId())));
+ }
+
$cursor = $qb->execute();
while($data = $cursor->fetch()) {
@@ -581,9 +579,14 @@ class DefaultShareProvider implements IShareProvider {
$qb->setMaxResults($limit - count($shares));
}
+ // Filter by node if provided
+ if ($node !== null) {
+ $qb->andWhere($qb->expr()->eq('file_source', $qb->createNamedParameter($node->getId())));
+ }
+
$groups = array_map(function(IGroup $group) { return $group->getGID(); }, $groups);
- $qb->where($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_GROUP)));
+ $qb->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_GROUP)));
$qb->andWhere($qb->expr()->in('share_with', $qb->createNamedParameter(
$groups,
IQueryBuilder::PARAM_STR_ARRAY
diff --git a/lib/private/share20/manager.php b/lib/private/share20/manager.php
index d6245f4beac..ad5fed93904 100644
--- a/lib/private/share20/manager.php
+++ b/lib/private/share20/manager.php
@@ -21,6 +21,7 @@
namespace OC\Share20;
+use OCP\Files\Node;
use OCP\Share\IManager;
use OCP\Share\IProviderFactory;
use OC\Share20\Exception\BackendError;
@@ -722,18 +723,12 @@ class Manager implements IManager {
}
/**
- * Get shares shared with $user.
- *
- * @param IUser $user
- * @param int $shareType
- * @param int $limit The maximum number of shares returned, -1 for all
- * @param int $offset
- * @return \OCP\Share\IShare[]
+ * @inheritdoc
*/
- public function getSharedWith(IUser $user, $shareType, $limit = 50, $offset = 0) {
+ public function getSharedWith(IUser $user, $shareType, $node = null, $limit = 50, $offset = 0) {
$provider = $this->factory->getProviderForType($shareType);
- return $provider->getSharedWith($user, $shareType, $limit, $offset);
+ return $provider->getSharedWith($user, $shareType, $node, $limit, $offset);
}
/**
diff --git a/lib/public/backgroundjob.php b/lib/public/backgroundjob.php
index c8acb7e538b..cc76506758b 100644
--- a/lib/public/backgroundjob.php
+++ b/lib/public/backgroundjob.php
@@ -34,7 +34,6 @@
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;
-use \OC\BackgroundJob\JobList;
/**
* This class provides functions to register backgroundjobs in ownCloud
@@ -115,16 +114,7 @@ class BackgroundJob {
* @since 4.5.0
*/
static public function allRegularTasks() {
- $jobList = \OC::$server->getJobList();
- $allJobs = $jobList->getAll();
- $regularJobs = array();
- foreach ($allJobs as $job) {
- if ($job instanceof RegularLegacyJob) {
- $key = implode('-', $job->getArgument());
- $regularJobs[$key] = $job->getArgument();
- }
- }
- return $regularJobs;
+ return [];
}
/**
@@ -146,17 +136,7 @@ class BackgroundJob {
* @since 4.5.0
*/
public static function allQueuedTasks() {
- $jobList = \OC::$server->getJobList();
- $allJobs = $jobList->getAll();
- $queuedJobs = array();
- foreach ($allJobs as $job) {
- if ($job instanceof QueuedLegacyJob) {
- $queuedJob = $job->getArgument();
- $queuedJob['id'] = $job->getId();
- $queuedJobs[] = $queuedJob;
- }
- }
- return $queuedJobs;
+ return [];
}
/**
@@ -167,19 +147,7 @@ class BackgroundJob {
* @since 4.5.0
*/
public static function queuedTaskWhereAppIs($app) {
- $jobList = \OC::$server->getJobList();
- $allJobs = $jobList->getAll();
- $queuedJobs = array();
- foreach ($allJobs as $job) {
- if ($job instanceof QueuedLegacyJob) {
- $queuedJob = $job->getArgument();
- $queuedJob['id'] = $job->getId();
- if ($queuedJob['app'] === $app) {
- $queuedJobs[] = $queuedJob;
- }
- }
- }
- return $queuedJobs;
+ return [];
}
/**
diff --git a/lib/public/backgroundjob/ijoblist.php b/lib/public/backgroundjob/ijoblist.php
index 13775457edd..5a76ce1ba26 100644
--- a/lib/public/backgroundjob/ijoblist.php
+++ b/lib/public/backgroundjob/ijoblist.php
@@ -64,6 +64,8 @@ interface IJobList {
*
* @return \OCP\BackgroundJob\IJob[]
* @since 7.0.0
+ * @deprecated 9.0.0 - This method is dangerous since it can cause load and
+ * memory problems when creating too many instances.
*/
public function getAll();
diff --git a/lib/public/files/cache/icache.php b/lib/public/files/cache/icache.php
index 3fbf310148d..e80c6fa2cb0 100644
--- a/lib/public/files/cache/icache.php
+++ b/lib/public/files/cache/icache.php
@@ -51,7 +51,7 @@ interface ICache {
* get the stored metadata of a file or folder
*
* @param string | int $file either the path of a file or folder or the file id for a file or folder
- * @return ICacheEntry[]|false the cache entry or false if the file is not found in the cache
+ * @return ICacheEntry|false the cache entry or false if the file is not found in the cache
* @since 9.0.0
*/
public function get($file);
@@ -148,6 +148,8 @@ interface ICache {
/**
* Move a file or folder in the cache
*
+ * Note that this should make sure the entries are removed from the source cache
+ *
* @param \OCP\Files\Cache\ICache $sourceCache
* @param string $sourcePath
* @param string $targetPath
diff --git a/lib/public/files/cache/icacheentry.php b/lib/public/files/cache/icacheentry.php
index 8d14bd2c555..63a232c9618 100644
--- a/lib/public/files/cache/icacheentry.php
+++ b/lib/public/files/cache/icacheentry.php
@@ -27,6 +27,8 @@ namespace OCP\Files\Cache;
* @since 9.0.0
*/
interface ICacheEntry {
+ const DIRECTORY_MIMETYPE = 'httpd/unix-directory';
+
/**
* Get the numeric id of a file
*
diff --git a/lib/public/files/storagenotavailableexception.php b/lib/public/files/storagenotavailableexception.php
index 4572a69f047..f9ac79d66ec 100644
--- a/lib/public/files/storagenotavailableexception.php
+++ b/lib/public/files/storagenotavailableexception.php
@@ -54,7 +54,7 @@ class StorageNotAvailableException extends HintException {
* @param \Exception $previous
* @since 6.0.0
*/
- public function __construct($message = '', $code = 0, \Exception $previous = null) {
+ public function __construct($message = '', $code = self::STATUS_ERROR, \Exception $previous = null) {
$l = \OC::$server->getL10N('core');
parent::__construct($message, $l->t('Storage not available'), $code, $previous);
}
diff --git a/lib/public/share/imanager.php b/lib/public/share/imanager.php
index 6531c14a857..b2d9953e9ef 100644
--- a/lib/public/share/imanager.php
+++ b/lib/public/share/imanager.php
@@ -88,15 +88,17 @@ interface IManager {
/**
* Get shares shared with $user.
+ * Filter by $node if provided
*
* @param IUser $user
* @param int $shareType
+ * @param File|Folder|null $node
* @param int $limit The maximum number of shares returned, -1 for all
* @param int $offset
* @return IShare[]
* @since 9.0.0
*/
- public function getSharedWith(IUser $user, $shareType, $limit = 50, $offset = 0);
+ public function getSharedWith(IUser $user, $shareType, $node = null, $limit = 50, $offset = 0);
/**
* Retrieve a share by the share id
diff --git a/lib/public/share/ishareprovider.php b/lib/public/share/ishareprovider.php
index 50964c88dd6..8507462cbed 100644
--- a/lib/public/share/ishareprovider.php
+++ b/lib/public/share/ishareprovider.php
@@ -23,6 +23,7 @@ namespace OCP\Share;
use OC\Share20\Exception\ShareNotFound;
use OC\Share20\Exception\BackendError;
+use OCP\Files\Node;
use OCP\IUser;
/**
@@ -116,12 +117,13 @@ interface IShareProvider {
*
* @param IUser $user get shares where this user is the recipient
* @param int $shareType
+ * @param Node|null $node
* @param int $limit The max number of entries returned, -1 for all
* @param int $offset
* @return \OCP\Share\IShare[]
* @since 9.0.0
*/
- public function getSharedWith(IUser $user, $shareType, $limit, $offset);
+ public function getSharedWith(IUser $user, $shareType, $node, $limit, $offset);
/**
* Get a share by token