diff options
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/App/InfoParser.php | 6 | ||||
-rw-r--r-- | lib/private/Calendar/CalendarQuery.php | 6 | ||||
-rw-r--r-- | lib/private/Files/Cache/Scanner.php | 2 | ||||
-rw-r--r-- | lib/private/Files/ObjectStore/S3.php | 10 | ||||
-rw-r--r-- | lib/private/Files/Stream/SeekableHttpStream.php | 4 | ||||
-rw-r--r-- | lib/private/Files/Utils/Scanner.php | 8 | ||||
-rw-r--r-- | lib/private/Installer.php | 4 | ||||
-rw-r--r-- | lib/private/Log.php | 6 | ||||
-rw-r--r-- | lib/private/legacy/template/functions.php | 3 |
9 files changed, 31 insertions, 18 deletions
diff --git a/lib/private/App/InfoParser.php b/lib/private/App/InfoParser.php index c0f69e615bd..79d051fd2a1 100644 --- a/lib/private/App/InfoParser.php +++ b/lib/private/App/InfoParser.php @@ -31,7 +31,7 @@ namespace OC\App; use OCP\ICache; use function libxml_disable_entity_loader; -use function simplexml_load_file; +use function simplexml_load_string; class InfoParser { /** @var \OCP\ICache|null */ @@ -63,10 +63,10 @@ class InfoParser { libxml_use_internal_errors(true); if ((PHP_VERSION_ID < 80000)) { $loadEntities = libxml_disable_entity_loader(false); - $xml = simplexml_load_file($file); + $xml = simplexml_load_string(file_get_contents($file)); libxml_disable_entity_loader($loadEntities); } else { - $xml = simplexml_load_file($file); + $xml = simplexml_load_string(file_get_contents($file)); } if ($xml === false) { diff --git a/lib/private/Calendar/CalendarQuery.php b/lib/private/Calendar/CalendarQuery.php index b06220e3ce4..3d37d9dc467 100644 --- a/lib/private/Calendar/CalendarQuery.php +++ b/lib/private/Calendar/CalendarQuery.php @@ -30,15 +30,15 @@ use OCP\Calendar\ICalendarQuery; class CalendarQuery implements ICalendarQuery { public array $searchProperties = []; - private ?string $searchPattern; + private ?string $searchPattern = null; private array $options = [ 'types' => [], ]; - private ?int $offset; + private ?int $offset = null; - private ?int $limit; + private ?int $limit = null; /** @var string[] */ private array $calendarUris = []; diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php index 6734a62db80..52268032409 100644 --- a/lib/private/Files/Cache/Scanner.php +++ b/lib/private/Files/Cache/Scanner.php @@ -291,7 +291,7 @@ class Scanner extends BasicEmitter implements IScanner { $data['permissions'] = $data['scan_permissions']; } \OC_Hook::emit('Scanner', 'addToCache', ['file' => $path, 'data' => $data]); - $this->emit('\OC\Files\Cache\Scanner', 'addToCache', [$path, $this->storageId, $data]); + $this->emit('\OC\Files\Cache\Scanner', 'addToCache', [$path, $this->storageId, $data, $fileId]); if ($this->cacheActive) { if ($fileId !== -1) { $this->cache->update($fileId, $data); diff --git a/lib/private/Files/ObjectStore/S3.php b/lib/private/Files/ObjectStore/S3.php index 76eee2bc962..2d9119b5fc6 100644 --- a/lib/private/Files/ObjectStore/S3.php +++ b/lib/private/Files/ObjectStore/S3.php @@ -49,7 +49,7 @@ class S3 implements IObjectStore, IObjectStoreMultiPartUpload { $upload = $this->getConnection()->createMultipartUpload([ 'Bucket' => $this->bucket, 'Key' => $urn, - ]); + ] + $this->getSSECParameters()); $uploadId = $upload->get('UploadId'); if ($uploadId === null) { throw new Exception('No upload id returned'); @@ -65,7 +65,7 @@ class S3 implements IObjectStore, IObjectStoreMultiPartUpload { 'ContentLength' => $size, 'PartNumber' => $partId, 'UploadId' => $uploadId, - ]); + ] + $this->getSSECParameters()); } public function getMultipartUploads(string $urn, string $uploadId): array { @@ -80,12 +80,12 @@ class S3 implements IObjectStore, IObjectStoreMultiPartUpload { 'UploadId' => $uploadId, 'MaxParts' => 1000, 'PartNumberMarker' => $partNumberMarker - ]); + ] + $this->getSSECParameters()); $parts = array_merge($parts, $result->get('Parts') ?? []); $isTruncated = $result->get('IsTruncated'); $partNumberMarker = $result->get('NextPartNumberMarker'); } - + return $parts; } @@ -95,7 +95,7 @@ class S3 implements IObjectStore, IObjectStoreMultiPartUpload { 'Key' => $urn, 'UploadId' => $uploadId, 'MultipartUpload' => ['Parts' => $result], - ]); + ] + $this->getSSECParameters()); $stat = $this->getConnection()->headObject([ 'Bucket' => $this->bucket, 'Key' => $urn, diff --git a/lib/private/Files/Stream/SeekableHttpStream.php b/lib/private/Files/Stream/SeekableHttpStream.php index 51ccaeba998..66f94768e62 100644 --- a/lib/private/Files/Stream/SeekableHttpStream.php +++ b/lib/private/Files/Stream/SeekableHttpStream.php @@ -219,7 +219,9 @@ class SeekableHttpStream implements File { public function stream_stat() { if ($this->getCurrent()) { $stat = fstat($this->getCurrent()); - $stat['size'] = $this->totalSize; + if ($stat) { + $stat['size'] = $this->totalSize; + } return $stat; } else { return false; diff --git a/lib/private/Files/Utils/Scanner.php b/lib/private/Files/Utils/Scanner.php index 277ce38175f..b7f6972ee10 100644 --- a/lib/private/Files/Utils/Scanner.php +++ b/lib/private/Files/Utils/Scanner.php @@ -251,9 +251,13 @@ class Scanner extends PublicEmitter { $this->postProcessEntry($storage, $path); $this->dispatcher->dispatchTyped(new FileCacheUpdated($storage, $path)); }); - $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', function ($path) use ($storage) { + $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', function ($path, $storageId, $data, $fileId) use ($storage) { $this->postProcessEntry($storage, $path); - $this->dispatcher->dispatchTyped(new NodeAddedToCache($storage, $path)); + if ($fileId) { + $this->dispatcher->dispatchTyped(new FileCacheUpdated($storage, $path)); + } else { + $this->dispatcher->dispatchTyped(new NodeAddedToCache($storage, $path)); + } }); if (!$storage->file_exists($relativePath)) { diff --git a/lib/private/Installer.php b/lib/private/Installer.php index 9b286cc85b0..dc81135b644 100644 --- a/lib/private/Installer.php +++ b/lib/private/Installer.php @@ -334,10 +334,10 @@ class Installer { // Check if appinfo/info.xml has the same app ID as well if ((PHP_VERSION_ID < 80000)) { $loadEntities = libxml_disable_entity_loader(false); - $xml = simplexml_load_file($extractDir . '/' . $folders[0] . '/appinfo/info.xml'); + $xml = simplexml_load_string(file_get_contents($extractDir . '/' . $folders[0] . '/appinfo/info.xml')); libxml_disable_entity_loader($loadEntities); } else { - $xml = simplexml_load_file($extractDir . '/' . $folders[0] . '/appinfo/info.xml'); + $xml = simplexml_load_string(file_get_contents($extractDir . '/' . $folders[0] . '/appinfo/info.xml')); } if ((string)$xml->id !== $appId) { throw new \Exception( diff --git a/lib/private/Log.php b/lib/private/Log.php index 9aff774d0ec..d6750491d92 100644 --- a/lib/private/Log.php +++ b/lib/private/Log.php @@ -221,6 +221,12 @@ class Log implements ILogger, IDataLogger { $this->eventDispatcher->dispatchTyped(new BeforeMessageLoggedEvent($app, $level, $entry)); } + $hasBacktrace = isset($entry['exception']); + $logBacktrace = $this->config->getValue('log.backtrace', false); + if (!$hasBacktrace && $logBacktrace) { + $entry['backtrace'] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); + } + try { if ($level >= $minLevel) { $this->writeLog($app, $entry, $level); diff --git a/lib/private/legacy/template/functions.php b/lib/private/legacy/template/functions.php index 57c3a834128..bcc0906dcdf 100644 --- a/lib/private/legacy/template/functions.php +++ b/lib/private/legacy/template/functions.php @@ -101,7 +101,8 @@ function emit_script_tag(string $src, string $script_content = '', string $conte */ function emit_script_loading_tags($obj) { foreach ($obj['jsfiles'] as $jsfile) { - $type = str_ends_with($jsfile, '.mjs') ? 'module' : ''; + $fileName = explode('?', $jsfile, 2)[0]; + $type = str_ends_with($fileName, '.mjs') ? 'module' : ''; emit_script_tag($jsfile, '', $type); } if (!empty($obj['inline_ocjs'])) { |