Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2016-03-23 12:50:16 +0300
committerJoas Schilling <nickvergessen@owncloud.com>2016-03-23 12:54:30 +0300
commita9518580003361a9bcefd0ef47c9babbe299db50 (patch)
treeb8c62ad0760e023248e66c35b4254a3c8a70a2ad /apps
parent0d8617a1f05d7c64dcfc5a8d5cbd1984823a664a (diff)
Grab the values for share propagation manually from the DB
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/lib/propagation/recipientpropagator.php37
1 files changed, 35 insertions, 2 deletions
diff --git a/apps/files_sharing/lib/propagation/recipientpropagator.php b/apps/files_sharing/lib/propagation/recipientpropagator.php
index e71208fd6cd..407664f31b7 100644
--- a/apps/files_sharing/lib/propagation/recipientpropagator.php
+++ b/apps/files_sharing/lib/propagation/recipientpropagator.php
@@ -22,6 +22,7 @@
namespace OCA\Files_Sharing\Propagation;
+use Doctrine\DBAL\Connection;
use OC\Files\Cache\ChangePropagator;
use OC\Files\View;
use OC\Share\Share;
@@ -109,9 +110,15 @@ class RecipientPropagator {
protected function getDirtyShares($shares) {
$dirty = [];
$userTime = $this->config->getUserValue($this->userId, 'files_sharing', 'last_propagate', 0);
+ $sharePropagations = [];
foreach ($shares as $share) {
- $updateTime = $this->config->getAppValue('files_sharing', $share['id'], 0);
- if ($updateTime >= $userTime) {
+ $sharePropagations[(int) $share['id']] = 0;
+ }
+
+ $sharePropagations = $this->getPropagationTimestampForShares($sharePropagations);
+
+ foreach ($shares as $share) {
+ if ($sharePropagations[$share['id']] >= $userTime) {
$dirty[] = $share;
}
}
@@ -119,6 +126,32 @@ class RecipientPropagator {
}
/**
+ * Load the last dirty timestamp from the appconfig table
+ *
+ * @param int[] $sharePropagations
+ * @return int[]
+ */
+ protected function getPropagationTimestampForShares(array $sharePropagations) {
+ $sql = \OC::$server->getDatabaseConnection()->getQueryBuilder();
+ $shareIds = array_keys($sharePropagations);
+
+ $sql->select(['configkey', 'configvalue'])
+ ->from('appconfig')
+ ->where($sql->expr()->eq('appid', $sql->createParameter('appid')))
+ ->andWhere($sql->expr()->in('configkey', $sql->createParameter('shareids')))
+ ->setParameter('appid', 'files_sharing', \PDO::PARAM_STR)
+ ->setParameter('shareids', $shareIds, Connection::PARAM_INT_ARRAY);
+ $result = $sql->execute();
+
+ while ($row = $result->fetch()) {
+ $sharePropagations[(int) $row['configkey']] = $row['configvalue'];
+ }
+ $result->closeCursor();
+
+ return $sharePropagations;
+ }
+
+ /**
* @param array $share
* @param float $time
*/