aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Files/Cache/Scanner.php22
-rw-r--r--lib/private/Files/ObjectStore/ObjectStoreScanner.php2
-rw-r--r--lib/private/Files/ObjectStore/S3ObjectTrait.php6
-rw-r--r--lib/private/Mail/Mailer.php8
4 files changed, 19 insertions, 19 deletions
diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php
index 81a7779c846..9bd94edf5bc 100644
--- a/lib/private/Files/Cache/Scanner.php
+++ b/lib/private/Files/Cache/Scanner.php
@@ -344,7 +344,7 @@ class Scanner extends BasicEmitter implements IScanner {
try {
$data = $this->scanFile($path, $reuse, -1, null, $lock);
if ($data && $data['mimetype'] === 'httpd/unix-directory') {
- $size = $this->scanChildren($path, $recursive, $reuse, $data['fileid'], $lock, $data);
+ $size = $this->scanChildren($path, $recursive, $reuse, $data['fileid'], $lock, $data['size']);
$data['size'] = $size;
}
} catch (NotFoundException $e) {
@@ -381,33 +381,29 @@ class Scanner extends BasicEmitter implements IScanner {
* scan all the files and folders in a folder
*
* @param string $path
- * @param bool $recursive
- * @param int $reuse
+ * @param bool|IScanner::SCAN_RECURSIVE_INCOMPLETE $recursive
+ * @param int $reuse a combination of self::REUSE_*
* @param int $folderId id for the folder to be scanned
* @param bool $lock set to false to disable getting an additional read lock during scanning
- * @param array $data the data of the folder before (re)scanning the children
+ * @param int $oldSize the size of the folder before (re)scanning the children
* @return int|float the size of the scanned folder or -1 if the size is unknown at this stage
*/
- protected function scanChildren($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $folderId = null, $lock = true, array $data = []) {
+ protected function scanChildren(string $path, $recursive, int $reuse, int $folderId, bool $lock, int $oldSize) {
if ($reuse === -1) {
$reuse = ($recursive === self::SCAN_SHALLOW) ? self::REUSE_ETAG | self::REUSE_SIZE : self::REUSE_ETAG;
}
$this->emit('\OC\Files\Cache\Scanner', 'scanFolder', [$path, $this->storageId]);
$size = 0;
- if (!is_null($folderId)) {
- $folderId = $this->cache->getId($path);
- }
$childQueue = $this->handleChildren($path, $recursive, $reuse, $folderId, $lock, $size);
- foreach ($childQueue as $child => $childId) {
- $childSize = $this->scanChildren($child, $recursive, $reuse, $childId, $lock);
+ foreach ($childQueue as $child => [$childId, $childSize]) {
+ $childSize = $this->scanChildren($child, $recursive, $reuse, $childId, $lock, $childSize);
if ($childSize === -1) {
$size = -1;
} elseif ($size !== -1) {
$size += $childSize;
}
}
- $oldSize = $data['size'] ?? null;
// for encrypted storages, we trigger a regular folder size calculation instead of using the calculated size
// to make sure we also updated the unencrypted-size where applicable
@@ -461,10 +457,10 @@ class Scanner extends BasicEmitter implements IScanner {
$data = $this->scanFile($child, $reuse, $folderId, $existingData, $lock, $fileMeta);
if ($data) {
if ($data['mimetype'] === 'httpd/unix-directory' && $recursive === self::SCAN_RECURSIVE) {
- $childQueue[$child] = $data['fileid'];
+ $childQueue[$child] = [$data['fileid'], $data['size']];
} elseif ($data['mimetype'] === 'httpd/unix-directory' && $recursive === self::SCAN_RECURSIVE_INCOMPLETE && $data['size'] === -1) {
// only recurse into folders which aren't fully scanned
- $childQueue[$child] = $data['fileid'];
+ $childQueue[$child] = [$data['fileid'], $data['size']];
} elseif ($data['size'] === -1) {
$size = -1;
} elseif ($size !== -1) {
diff --git a/lib/private/Files/ObjectStore/ObjectStoreScanner.php b/lib/private/Files/ObjectStore/ObjectStoreScanner.php
index e589ca51aae..f001f90fdaa 100644
--- a/lib/private/Files/ObjectStore/ObjectStoreScanner.php
+++ b/lib/private/Files/ObjectStore/ObjectStoreScanner.php
@@ -39,7 +39,7 @@ class ObjectStoreScanner extends Scanner {
return [];
}
- protected function scanChildren($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $folderId = null, $lock = true, array $data = []) {
+ protected function scanChildren(string $path, $recursive, int $reuse, int $folderId, bool $lock, int $oldSize) {
return 0;
}
diff --git a/lib/private/Files/ObjectStore/S3ObjectTrait.php b/lib/private/Files/ObjectStore/S3ObjectTrait.php
index 8fa6d67faa3..e0d0f2ce9c7 100644
--- a/lib/private/Files/ObjectStore/S3ObjectTrait.php
+++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php
@@ -54,7 +54,7 @@ trait S3ObjectTrait {
* @since 7.0.0
*/
public function readObject($urn) {
- return SeekableHttpStream::open(function ($range) use ($urn) {
+ $fh = SeekableHttpStream::open(function ($range) use ($urn) {
$command = $this->getConnection()->getCommand('GetObject', [
'Bucket' => $this->bucket,
'Key' => $urn,
@@ -88,6 +88,10 @@ trait S3ObjectTrait {
$context = stream_context_create($opts);
return fopen($request->getUri(), 'r', false, $context);
});
+ if (!$fh) {
+ throw new \Exception("Failed to read object $urn");
+ }
+ return $fh;
}
diff --git a/lib/private/Mail/Mailer.php b/lib/private/Mail/Mailer.php
index 5d838b2cdf1..7d249338bdc 100644
--- a/lib/private/Mail/Mailer.php
+++ b/lib/private/Mail/Mailer.php
@@ -292,7 +292,7 @@ class Mailer implements IMailer {
// either null or true - if nothing is passed, let the symfony mailer figure out the configuration by itself
$mailSmtpsecure = ($this->config->getSystemValue('mail_smtpsecure', null) === 'ssl') ? true : null;
$transport = new EsmtpTransport(
- $this->config->getSystemValue('mail_smtphost', '127.0.0.1'),
+ $this->config->getSystemValueString('mail_smtphost', '127.0.0.1'),
$this->config->getSystemValueInt('mail_smtpport', 25),
$mailSmtpsecure,
null,
@@ -301,11 +301,11 @@ class Mailer implements IMailer {
/** @var SocketStream $stream */
$stream = $transport->getStream();
/** @psalm-suppress InternalMethod */
- $stream->setTimeout($this->config->getSystemValue('mail_smtptimeout', 10));
+ $stream->setTimeout($this->config->getSystemValueInt('mail_smtptimeout', 10));
if ($this->config->getSystemValueBool('mail_smtpauth', false)) {
- $transport->setUsername($this->config->getSystemValue('mail_smtpname', ''));
- $transport->setPassword($this->config->getSystemValue('mail_smtppassword', ''));
+ $transport->setUsername($this->config->getSystemValueString('mail_smtpname', ''));
+ $transport->setPassword($this->config->getSystemValueString('mail_smtppassword', ''));
}
$streamingOptions = $this->config->getSystemValue('mail_smtpstreamoptions', []);