summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/composer/composer/autoload_classmap.php1
-rw-r--r--lib/composer/composer/autoload_static.php1
-rw-r--r--lib/l10n/en_GB.js1
-rw-r--r--lib/l10n/en_GB.json1
-rw-r--r--lib/l10n/gl.js18
-rw-r--r--lib/l10n/gl.json18
-rw-r--r--lib/private/AppFramework/App.php5
-rw-r--r--lib/private/AppFramework/Bootstrap/Coordinator.php23
-rw-r--r--lib/private/AppFramework/Bootstrap/RegistrationContext.php37
-rw-r--r--lib/private/AppFramework/Http/Output.php16
-rw-r--r--lib/private/Log/ExceptionSerializer.php6
-rw-r--r--lib/private/Support/CrashReport/Registry.php66
-rw-r--r--lib/private/Template/SCSSCacher.php2
-rw-r--r--lib/private/legacy/OC_App.php7
-rw-r--r--lib/public/AppFramework/Bootstrap/IBootstrap.php7
-rw-r--r--lib/public/AppFramework/Bootstrap/IRegistrationContext.php10
-rw-r--r--lib/public/AppFramework/Http/IOutput.php3
-rw-r--r--lib/public/AppFramework/Http/Response.php5
-rw-r--r--lib/public/Support/CrashReport/IRegistry.php7
-rw-r--r--lib/public/Support/CrashReport/IReporter.php3
-rw-r--r--lib/public/WorkflowEngine/Events/LoadSettingsScriptsEvent.php34
21 files changed, 239 insertions, 32 deletions
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index 09defdc5ae4..e405d25ee66 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -515,6 +515,7 @@ return array(
'OCP\\WorkflowEngine\\EntityContext\\IDisplayText' => $baseDir . '/lib/public/WorkflowEngine/EntityContext/IDisplayText.php',
'OCP\\WorkflowEngine\\EntityContext\\IIcon' => $baseDir . '/lib/public/WorkflowEngine/EntityContext/IIcon.php',
'OCP\\WorkflowEngine\\EntityContext\\IUrl' => $baseDir . '/lib/public/WorkflowEngine/EntityContext/IUrl.php',
+ 'OCP\\WorkflowEngine\\Events\\LoadSettingsScriptsEvent' => $baseDir . '/lib/public/WorkflowEngine/Events/LoadSettingsScriptsEvent.php',
'OCP\\WorkflowEngine\\Events\\RegisterChecksEvent' => $baseDir . '/lib/public/WorkflowEngine/Events/RegisterChecksEvent.php',
'OCP\\WorkflowEngine\\Events\\RegisterEntitiesEvent' => $baseDir . '/lib/public/WorkflowEngine/Events/RegisterEntitiesEvent.php',
'OCP\\WorkflowEngine\\Events\\RegisterOperationsEvent' => $baseDir . '/lib/public/WorkflowEngine/Events/RegisterOperationsEvent.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index ef34b902cf4..456fa81087d 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -544,6 +544,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\WorkflowEngine\\EntityContext\\IDisplayText' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/EntityContext/IDisplayText.php',
'OCP\\WorkflowEngine\\EntityContext\\IIcon' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/EntityContext/IIcon.php',
'OCP\\WorkflowEngine\\EntityContext\\IUrl' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/EntityContext/IUrl.php',
+ 'OCP\\WorkflowEngine\\Events\\LoadSettingsScriptsEvent' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/Events/LoadSettingsScriptsEvent.php',
'OCP\\WorkflowEngine\\Events\\RegisterChecksEvent' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/Events/RegisterChecksEvent.php',
'OCP\\WorkflowEngine\\Events\\RegisterEntitiesEvent' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/Events/RegisterEntitiesEvent.php',
'OCP\\WorkflowEngine\\Events\\RegisterOperationsEvent' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/Events/RegisterOperationsEvent.php',
diff --git a/lib/l10n/en_GB.js b/lib/l10n/en_GB.js
index 4b0b691e5f6..0a2aec58fe0 100644
--- a/lib/l10n/en_GB.js
+++ b/lib/l10n/en_GB.js
@@ -82,6 +82,7 @@ OC.L10N.register(
"Sharing backend %s not found" : "Sharing backend %s not found",
"Sharing backend for %s not found" : "Sharing backend for %s not found",
"Open »%s«" : "Open »%s«",
+ "%1$s via %2$s" : "%1$s via %2$s",
"You are not allowed to share %s" : "You are not allowed to share %s",
"Can’t increase permissions of %s" : "Can’t increase permissions of %s",
"Files can’t be shared with delete permissions" : "Files can’t be shared with delete permissions",
diff --git a/lib/l10n/en_GB.json b/lib/l10n/en_GB.json
index 281cc473169..ec671ce1fff 100644
--- a/lib/l10n/en_GB.json
+++ b/lib/l10n/en_GB.json
@@ -80,6 +80,7 @@
"Sharing backend %s not found" : "Sharing backend %s not found",
"Sharing backend for %s not found" : "Sharing backend for %s not found",
"Open »%s«" : "Open »%s«",
+ "%1$s via %2$s" : "%1$s via %2$s",
"You are not allowed to share %s" : "You are not allowed to share %s",
"Can’t increase permissions of %s" : "Can’t increase permissions of %s",
"Files can’t be shared with delete permissions" : "Files can’t be shared with delete permissions",
diff --git a/lib/l10n/gl.js b/lib/l10n/gl.js
index c418b157b01..1f1fa0068d6 100644
--- a/lib/l10n/gl.js
+++ b/lib/l10n/gl.js
@@ -19,17 +19,17 @@ OC.L10N.register(
"Groupware bundle" : "Paquete de software colaborativo",
"Hub bundle" : "Paquete de concentradores",
"Social sharing bundle" : "Paquete para compartir en redes sociais",
- "PHP %s or higher is required." : "Requirese PHP %s ou superior.",
- "PHP with a version lower than %s is required." : "Requírese PHP cunha versión inferior a %s.",
- "%sbit or higher PHP required." : "Requirese PHP para %sbit ou superior.",
+ "PHP %s or higher is required." : "É necesario PHP %s ou superior.",
+ "PHP with a version lower than %s is required." : "É necesario PHP cunha versión inferior a %s.",
+ "%sbit or higher PHP required." : "É necesario PHP para %sbits ou superior.",
"The following databases are supported: %s" : "Admítense as seguintes bases de datos: %s",
"The command line tool %s could not be found" : "Non foi posíbel atopar a ferramenta de liña de ordes %s",
"The library %s is not available." : "Non está dispoñíbel a biblioteca %s.",
- "Library %1$s with a version higher than %2$s is required - available version %3$s." : "Requírese a biblioteca %1$s cunha versión superior a %2$s - dispoñíbel a versión %3$s.",
- "Library %1$s with a version lower than %2$s is required - available version %3$s." : "Requírese a biblioteca %1$s cunha versión inferior a %2$s - dispoñíbel a versión %3$s.",
+ "Library %1$s with a version higher than %2$s is required - available version %3$s." : "É necesaria a biblioteca %1$s cunha versión superior a %2$s - dispoñíbel a versión %3$s.",
+ "Library %1$s with a version lower than %2$s is required - available version %3$s." : "É necesaria a biblioteca %1$s cunha versión inferior a %2$s - dispoñíbel a versión %3$s.",
"The following platforms are supported: %s" : "Admítense as seguintes plataformas: %s",
- "Server version %s or higher is required." : "Requírese a versión %s ou superior do servidor.",
- "Server version %s or lower is required." : "Requírese a versión %s ou inferior do servidor.",
+ "Server version %s or higher is required." : "É necesaria a versión %s ou superior do servidor.",
+ "Server version %s or lower is required." : "É necesaria a versión %s ou inferior do servidor.",
"Logged in user must be an admin or sub admin" : "O usuario rexistrado debe ser un administrador ou subadministrador",
"Logged in user must be an admin" : "O usuario rexistrado debe ser un administrador",
"Wiping of device %s has started" : "Iniciouse a limpeza do dispositivo %s",
@@ -199,13 +199,13 @@ OC.L10N.register(
"Adjusting this setting in php.ini will make Nextcloud run again" : "Cambiar este axuste no ficheiro php.ini fará que Nextcloud funcione de novo",
"mbstring.func_overload is set to \"%s\" instead of the expected value \"0\"" : "mbstring.func_overload está estabelecido a «%s» no canto do valor «0» agardado",
"To fix this issue set <code>mbstring.func_overload</code> to <code>0</code> in your php.ini" : "Para arranxar este incidente, estabeleza <code>mbstring.func_overload</code> a <code>0</code> no ficheiro php.ini",
- "libxml2 2.7.0 is at least required. Currently %s is installed." : "Requírese cando menos libxml2 2.7.0. Actualmente esta instalado %s.",
+ "libxml2 2.7.0 is at least required. Currently %s is installed." : "É necesario, cando menos, libxml2 2.7.0. Actualmente esta instalado %s.",
"To fix this issue update your libxml2 version and restart your web server." : "Para arranxar este incidente, actualice a versión de libxml2 e reinicie o servidor web. ",
"PHP is apparently set up to strip inline doc blocks. This will make several core apps inaccessible." : "Semella que PHP foi configurado para quitar bloques de documentos en liña. Isto fará que varias aplicacións sexan inaccesíbeis.",
"This is probably caused by a cache/accelerator such as Zend OPcache or eAccelerator." : "Isto probabelmente se debe unha caché/acelerador como Zend OPcache ou eAccelerator.",
"PHP modules have been installed, but they are still listed as missing?" : "Instaláronse os módulos de PHP, mais aínda aparecen listados como perdidos?",
"Please ask your server administrator to restart the web server." : "Pregúntelle ao administrador do servidor polo reinicio do servidor web..",
- "PostgreSQL >= 9 required" : "Requírese PostgreSQL >= 9",
+ "PostgreSQL >= 9 required" : "É necesario PostgreSQL >= 9",
"Please upgrade your database version" : "Anove a versión da súa base de datos",
"Please change the permissions to 0770 so that the directory cannot be listed by other users." : "Cambie os permisos a 0770 para que o directorio non poida ser listado por outros usuarios.",
"Your data directory is readable by other users" : "O se directorio de datos é lexíbel por outros usuarios",
diff --git a/lib/l10n/gl.json b/lib/l10n/gl.json
index 188662b197f..e6a27854fa9 100644
--- a/lib/l10n/gl.json
+++ b/lib/l10n/gl.json
@@ -17,17 +17,17 @@
"Groupware bundle" : "Paquete de software colaborativo",
"Hub bundle" : "Paquete de concentradores",
"Social sharing bundle" : "Paquete para compartir en redes sociais",
- "PHP %s or higher is required." : "Requirese PHP %s ou superior.",
- "PHP with a version lower than %s is required." : "Requírese PHP cunha versión inferior a %s.",
- "%sbit or higher PHP required." : "Requirese PHP para %sbit ou superior.",
+ "PHP %s or higher is required." : "É necesario PHP %s ou superior.",
+ "PHP with a version lower than %s is required." : "É necesario PHP cunha versión inferior a %s.",
+ "%sbit or higher PHP required." : "É necesario PHP para %sbits ou superior.",
"The following databases are supported: %s" : "Admítense as seguintes bases de datos: %s",
"The command line tool %s could not be found" : "Non foi posíbel atopar a ferramenta de liña de ordes %s",
"The library %s is not available." : "Non está dispoñíbel a biblioteca %s.",
- "Library %1$s with a version higher than %2$s is required - available version %3$s." : "Requírese a biblioteca %1$s cunha versión superior a %2$s - dispoñíbel a versión %3$s.",
- "Library %1$s with a version lower than %2$s is required - available version %3$s." : "Requírese a biblioteca %1$s cunha versión inferior a %2$s - dispoñíbel a versión %3$s.",
+ "Library %1$s with a version higher than %2$s is required - available version %3$s." : "É necesaria a biblioteca %1$s cunha versión superior a %2$s - dispoñíbel a versión %3$s.",
+ "Library %1$s with a version lower than %2$s is required - available version %3$s." : "É necesaria a biblioteca %1$s cunha versión inferior a %2$s - dispoñíbel a versión %3$s.",
"The following platforms are supported: %s" : "Admítense as seguintes plataformas: %s",
- "Server version %s or higher is required." : "Requírese a versión %s ou superior do servidor.",
- "Server version %s or lower is required." : "Requírese a versión %s ou inferior do servidor.",
+ "Server version %s or higher is required." : "É necesaria a versión %s ou superior do servidor.",
+ "Server version %s or lower is required." : "É necesaria a versión %s ou inferior do servidor.",
"Logged in user must be an admin or sub admin" : "O usuario rexistrado debe ser un administrador ou subadministrador",
"Logged in user must be an admin" : "O usuario rexistrado debe ser un administrador",
"Wiping of device %s has started" : "Iniciouse a limpeza do dispositivo %s",
@@ -197,13 +197,13 @@
"Adjusting this setting in php.ini will make Nextcloud run again" : "Cambiar este axuste no ficheiro php.ini fará que Nextcloud funcione de novo",
"mbstring.func_overload is set to \"%s\" instead of the expected value \"0\"" : "mbstring.func_overload está estabelecido a «%s» no canto do valor «0» agardado",
"To fix this issue set <code>mbstring.func_overload</code> to <code>0</code> in your php.ini" : "Para arranxar este incidente, estabeleza <code>mbstring.func_overload</code> a <code>0</code> no ficheiro php.ini",
- "libxml2 2.7.0 is at least required. Currently %s is installed." : "Requírese cando menos libxml2 2.7.0. Actualmente esta instalado %s.",
+ "libxml2 2.7.0 is at least required. Currently %s is installed." : "É necesario, cando menos, libxml2 2.7.0. Actualmente esta instalado %s.",
"To fix this issue update your libxml2 version and restart your web server." : "Para arranxar este incidente, actualice a versión de libxml2 e reinicie o servidor web. ",
"PHP is apparently set up to strip inline doc blocks. This will make several core apps inaccessible." : "Semella que PHP foi configurado para quitar bloques de documentos en liña. Isto fará que varias aplicacións sexan inaccesíbeis.",
"This is probably caused by a cache/accelerator such as Zend OPcache or eAccelerator." : "Isto probabelmente se debe unha caché/acelerador como Zend OPcache ou eAccelerator.",
"PHP modules have been installed, but they are still listed as missing?" : "Instaláronse os módulos de PHP, mais aínda aparecen listados como perdidos?",
"Please ask your server administrator to restart the web server." : "Pregúntelle ao administrador do servidor polo reinicio do servidor web..",
- "PostgreSQL >= 9 required" : "Requírese PostgreSQL >= 9",
+ "PostgreSQL >= 9 required" : "É necesario PostgreSQL >= 9",
"Please upgrade your database version" : "Anove a versión da súa base de datos",
"Please change the permissions to 0770 so that the directory cannot be listed by other users." : "Cambie os permisos a 0770 para que o directorio non poida ser listado por outros usuarios.",
"Your data directory is readable by other users" : "O se directorio de datos é lexíbel por outros usuarios",
diff --git a/lib/private/AppFramework/App.php b/lib/private/AppFramework/App.php
index e02f372e41c..ea97ea4096d 100644
--- a/lib/private/AppFramework/App.php
+++ b/lib/private/AppFramework/App.php
@@ -151,6 +151,8 @@ class App {
if ($value['expireDate'] instanceof \DateTime) {
$expireDate = $value['expireDate']->getTimestamp();
}
+ $sameSite = $value['sameSite'] ?? 'Lax';
+
$io->setCookie(
$name,
$value['value'],
@@ -158,7 +160,8 @@ class App {
$container->getServer()->getWebRoot(),
null,
$container->getServer()->getRequest()->getServerProtocol() === 'https',
- true
+ true,
+ $sameSite
);
}
diff --git a/lib/private/AppFramework/Bootstrap/Coordinator.php b/lib/private/AppFramework/Bootstrap/Coordinator.php
index e713ad7ce91..9b0f6a9188c 100644
--- a/lib/private/AppFramework/Bootstrap/Coordinator.php
+++ b/lib/private/AppFramework/Bootstrap/Coordinator.php
@@ -25,6 +25,7 @@ declare(strict_types=1);
namespace OC\AppFramework\Bootstrap;
+use OC\Support\CrashReport\Registry;
use OC_App;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootstrap;
@@ -32,6 +33,7 @@ use OCP\AppFramework\QueryException;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\ILogger;
use OCP\IServerContainer;
+use Throwable;
use function class_exists;
use function class_implements;
use function in_array;
@@ -41,6 +43,9 @@ class Coordinator {
/** @var IServerContainer */
private $serverContainer;
+ /** @var Registry */
+ private $registry;
+
/** @var IEventDispatcher */
private $eventDispatcher;
@@ -48,9 +53,11 @@ class Coordinator {
private $logger;
public function __construct(IServerContainer $container,
+ Registry $registry,
IEventDispatcher $eventListener,
ILogger $logger) {
$this->serverContainer = $container;
+ $this->registry = $registry;
$this->eventDispatcher = $eventListener;
$this->logger = $logger;
}
@@ -81,9 +88,17 @@ class Coordinator {
try {
/** @var IBootstrap|App $application */
$apps[$appId] = $application = $this->serverContainer->query($applicationClassName);
- $application->register($context->for($appId));
} catch (QueryException $e) {
// Weird, but ok
+ continue;
+ }
+ try {
+ $application->register($context->for($appId));
+ } catch (Throwable $e) {
+ $this->logger->logException($e, [
+ 'message' => 'Error during app service registration: ' . $e->getMessage(),
+ 'level' => ILogger::FATAL,
+ ]);
}
}
}
@@ -93,6 +108,7 @@ class Coordinator {
* to the actual services
*/
$context->delegateCapabilityRegistrations($apps);
+ $context->delegateCrashReporterRegistrations($apps, $this->registry);
$context->delegateEventListenerRegistrations($this->eventDispatcher);
$context->delegateContainerRegistrations($apps);
$context->delegateMiddlewareRegistrations($apps);
@@ -125,6 +141,11 @@ class Coordinator {
'message' => "Could not boot $appId" . $e->getMessage(),
]);
return;
+ } catch (Throwable $e) {
+ $this->logger->logException($e, [
+ 'message' => "Could not boot $appId" . $e->getMessage(),
+ 'level' => ILogger::FATAL,
+ ]);
}
}
}
diff --git a/lib/private/AppFramework/Bootstrap/RegistrationContext.php b/lib/private/AppFramework/Bootstrap/RegistrationContext.php
index c7b2290e6b8..340012c8b1b 100644
--- a/lib/private/AppFramework/Bootstrap/RegistrationContext.php
+++ b/lib/private/AppFramework/Bootstrap/RegistrationContext.php
@@ -26,6 +26,7 @@ declare(strict_types=1);
namespace OC\AppFramework\Bootstrap;
use Closure;
+use OC\Support\CrashReport\Registry;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\EventDispatcher\IEventDispatcher;
@@ -38,6 +39,9 @@ class RegistrationContext {
private $capabilities = [];
/** @var array[] */
+ private $crashReporters = [];
+
+ /** @var array[] */
private $services = [];
/** @var array[] */
@@ -79,6 +83,13 @@ class RegistrationContext {
);
}
+ public function registerCrashReporter(string $reporterClass): void {
+ $this->context->registerCrashReporter(
+ $this->appId,
+ $reporterClass
+ );
+ }
+
public function registerService(string $name, callable $factory, bool $shared = true): void {
$this->context->registerService(
$this->appId,
@@ -129,6 +140,13 @@ class RegistrationContext {
];
}
+ public function registerCrashReporter(string $appId, string $reporterClass): void {
+ $this->crashReporters[] = [
+ 'appId' => $appId,
+ 'class' => $reporterClass,
+ ];
+ }
+
public function registerService(string $appId, string $name, callable $factory, bool $shared = true): void {
$this->services[] = [
"appId" => $appId,
@@ -189,6 +207,23 @@ class RegistrationContext {
}
}
+ /**
+ * @param App[] $apps
+ */
+ public function delegateCrashReporterRegistrations(array $apps, Registry $registry): void {
+ foreach ($this->crashReporters as $registration) {
+ try {
+ $registry->registerLazy($registration['class']);
+ } catch (Throwable $e) {
+ $appId = $registration['appId'];
+ $this->logger->logException($e, [
+ 'message' => "Error during crash reporter registration of $appId: " . $e->getMessage(),
+ 'level' => ILogger::ERROR,
+ ]);
+ }
+ }
+ }
+
public function delegateEventListenerRegistrations(IEventDispatcher $eventDispatcher): void {
foreach ($this->eventListeners as $registration) {
try {
@@ -199,7 +234,7 @@ class RegistrationContext {
$registration['priority']
);
} else {
- $eventDispatcher->addListener(
+ $eventDispatcher->addServiceListener(
$registration['event'],
$registration['listener']
);
diff --git a/lib/private/AppFramework/Http/Output.php b/lib/private/AppFramework/Http/Output.php
index fd95f370360..8777c1970a6 100644
--- a/lib/private/AppFramework/Http/Output.php
+++ b/lib/private/AppFramework/Http/Output.php
@@ -92,8 +92,20 @@ class Output implements IOutput {
* @param bool $secure
* @param bool $httpOnly
*/
- public function setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly) {
+ public function setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly, $sameSite = 'Lax') {
$path = $this->webRoot ? : '/';
- setcookie($name, $value, $expire, $path, $domain, $secure, $httpOnly);
+
+ if (PHP_VERSION_ID < 70300) {
+ setcookie($name, $value, $expire, $path, $domain, $secure, $httpOnly);
+ } else {
+ setcookie($name, $value, [
+ 'expires' => $expire,
+ 'path' => $path,
+ 'domain' => $domain,
+ 'secure' => $secure,
+ 'httponly' => $httpOnly,
+ 'samesite' => $sameSite
+ ]);
+ }
}
}
diff --git a/lib/private/Log/ExceptionSerializer.php b/lib/private/Log/ExceptionSerializer.php
index a13c97aa0c5..587d6ff37db 100644
--- a/lib/private/Log/ExceptionSerializer.php
+++ b/lib/private/Log/ExceptionSerializer.php
@@ -30,6 +30,7 @@ namespace OC\Log;
use OC\Core\Controller\SetupController;
use OC\HintException;
+use OC\Security\IdentityProof\Key;
use OC\Setup;
class ExceptionSerializer {
@@ -95,7 +96,10 @@ class ExceptionSerializer {
],
Setup::class => [
'install'
- ]
+ ],
+ Key::class => [
+ '__construct'
+ ],
];
private function editTrace(array &$sensitiveValues, array $traceLine): array {
diff --git a/lib/private/Support/CrashReport/Registry.php b/lib/private/Support/CrashReport/Registry.php
index 44a6d290678..bff62705ceb 100644
--- a/lib/private/Support/CrashReport/Registry.php
+++ b/lib/private/Support/CrashReport/Registry.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
*
*
@@ -25,6 +28,9 @@
namespace OC\Support\CrashReport;
use Exception;
+use OCP\AppFramework\QueryException;
+use OCP\ILogger;
+use OCP\IServerContainer;
use OCP\Support\CrashReport\ICollectBreadcrumbs;
use OCP\Support\CrashReport\IMessageReporter;
use OCP\Support\CrashReport\IRegistry;
@@ -33,9 +39,22 @@ use Throwable;
class Registry implements IRegistry {
+ /** @var string[] */
+ private $lazyReporters = [];
+
/** @var IReporter[] */
private $reporters = [];
+ /** @var IServerContainer */
+ private $serverContainer;
+
+ /** @var ILogger */
+ private $logger;
+
+ public function __construct(IServerContainer $serverContainer) {
+ $this->serverContainer = $serverContainer;
+ }
+
/**
* Register a reporter instance
*
@@ -45,6 +64,10 @@ class Registry implements IRegistry {
$this->reporters[] = $reporter;
}
+ public function registerLazy(string $class): void {
+ $this->lazyReporters[] = $class;
+ }
+
/**
* Delegate breadcrumb collection to all registered reporters
*
@@ -55,6 +78,8 @@ class Registry implements IRegistry {
* @since 15.0.0
*/
public function delegateBreadcrumb(string $message, string $category, array $context = []): void {
+ $this->loadLazyProviders();
+
foreach ($this->reporters as $reporter) {
if ($reporter instanceof ICollectBreadcrumbs) {
$reporter->collect($message, $category, $context);
@@ -69,7 +94,8 @@ class Registry implements IRegistry {
* @param array $context
*/
public function delegateReport($exception, array $context = []): void {
- /** @var IReporter $reporter */
+ $this->loadLazyProviders();
+
foreach ($this->reporters as $reporter) {
$reporter->report($exception, $context);
}
@@ -84,10 +110,48 @@ class Registry implements IRegistry {
* @return void
*/
public function delegateMessage(string $message, array $context = []): void {
+ $this->loadLazyProviders();
+
foreach ($this->reporters as $reporter) {
if ($reporter instanceof IMessageReporter) {
$reporter->reportMessage($message, $context);
}
}
}
+
+ private function loadLazyProviders(): void {
+ $classes = $this->lazyReporters;
+ foreach ($classes as $class) {
+ try {
+ /** @var IReporter $reporter */
+ $reporter = $this->serverContainer->query($class);
+ } catch (QueryException $e) {
+ /*
+ * There is a circular dependency between the logger and the registry, so
+ * we can not inject it. Thus the static call.
+ */
+ \OC::$server->getLogger()->logException($e, [
+ 'message' => 'Could not load lazy crash reporter: ' . $e->getMessage(),
+ 'level' => ILogger::FATAL,
+ ]);
+ }
+ /**
+ * Try to register the loaded reporter. Theoretically it could be of a wrong
+ * type, so we might get a TypeError here that we should catch.
+ */
+ try {
+ $this->register($reporter);
+ } catch (Throwable $e) {
+ /*
+ * There is a circular dependency between the logger and the registry, so
+ * we can not inject it. Thus the static call.
+ */
+ \OC::$server->getLogger()->logException($e, [
+ 'message' => 'Could not register lazy crash reporter: ' . $e->getMessage(),
+ 'level' => ILogger::FATAL,
+ ]);
+ }
+ }
+ $this->lazyReporters = [];
+ }
}
diff --git a/lib/private/Template/SCSSCacher.php b/lib/private/Template/SCSSCacher.php
index 427588ddddf..120ed585e16 100644
--- a/lib/private/Template/SCSSCacher.php
+++ b/lib/private/Template/SCSSCacher.php
@@ -171,7 +171,7 @@ class SCSSCacher {
return $this->injectCssVariablesIfAny();
}
$this->logger->debug('SCSSCacher: scss cache file locked for '.$lockKey, ['app' => 'core']);
- sleep($retry);
+ sleep(1);
$retry++;
}
$this->logger->debug('SCSSCacher: Giving up scss caching for '.$lockKey, ['app' => 'core']);
diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php
index a3c429c9ce4..85fd8c99f05 100644
--- a/lib/private/legacy/OC_App.php
+++ b/lib/private/legacy/OC_App.php
@@ -149,9 +149,6 @@ class OC_App {
// in case someone calls loadApp() directly
self::registerAutoloading($app, $appPath);
- /** @var \OC\AppFramework\Bootstrap\Coordinator $coordinator */
- $coordinator = \OC::$server->query(\OC\AppFramework\Bootstrap\Coordinator::class);
- $coordinator->bootApp($app);
if (is_file($appPath . '/appinfo/app.php')) {
\OC::$server->getEventLogger()->start('load_app_' . $app, 'Load app: ' . $app);
try {
@@ -176,6 +173,10 @@ class OC_App {
\OC::$server->getEventLogger()->end('load_app_' . $app);
}
+ /** @var \OC\AppFramework\Bootstrap\Coordinator $coordinator */
+ $coordinator = \OC::$server->query(\OC\AppFramework\Bootstrap\Coordinator::class);
+ $coordinator->bootApp($app);
+
$info = self::getAppInfo($app);
if (!empty($info['activity']['filters'])) {
foreach ($info['activity']['filters'] as $filter) {
diff --git a/lib/public/AppFramework/Bootstrap/IBootstrap.php b/lib/public/AppFramework/Bootstrap/IBootstrap.php
index 581c7d6636a..770c830e735 100644
--- a/lib/public/AppFramework/Bootstrap/IBootstrap.php
+++ b/lib/public/AppFramework/Bootstrap/IBootstrap.php
@@ -38,6 +38,13 @@ interface IBootstrap {
public function register(IRegistrationContext $context): void;
/**
+ * Boot the application
+ *
+ * At this stage you can assume that all services are registered and the DI
+ * container(s) are ready to be queried.
+ *
+ * This is also the state where an optional `appinfo/app.php` was loaded.
+ *
* @param IBootContext $context
*
* @since 20.0.0
diff --git a/lib/public/AppFramework/Bootstrap/IRegistrationContext.php b/lib/public/AppFramework/Bootstrap/IRegistrationContext.php
index 589b5def5a8..5d3ffc8d479 100644
--- a/lib/public/AppFramework/Bootstrap/IRegistrationContext.php
+++ b/lib/public/AppFramework/Bootstrap/IRegistrationContext.php
@@ -46,6 +46,16 @@ interface IRegistrationContext {
public function registerCapability(string $capability): void;
/**
+ * Register an implementation of \OCP\Support\CrashReport\IReporter that
+ * will receive unhandled exceptions and throwables
+ *
+ * @param string $reporterClass
+ * @return void
+ * @since 20.0.0
+ */
+ public function registerCrashReporter(string $reporterClass): void;
+
+ /**
* Register a service
*
* @param string $name
diff --git a/lib/public/AppFramework/Http/IOutput.php b/lib/public/AppFramework/Http/IOutput.php
index 888c9f45b23..39543dc9bf1 100644
--- a/lib/public/AppFramework/Http/IOutput.php
+++ b/lib/public/AppFramework/Http/IOutput.php
@@ -72,7 +72,8 @@ interface IOutput {
* @param string $domain
* @param bool $secure
* @param bool $httpOnly
+ * @param string $sameSite (added in 20)
* @since 8.1.0
*/
- public function setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly);
+ public function setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly, $sameSite = 'Lax');
}
diff --git a/lib/public/AppFramework/Http/Response.php b/lib/public/AppFramework/Http/Response.php
index 6f418e42553..832e0b96247 100644
--- a/lib/public/AppFramework/Http/Response.php
+++ b/lib/public/AppFramework/Http/Response.php
@@ -133,11 +133,12 @@ class Response {
* @param \DateTime|null $expireDate Date on that the cookie should expire, if set
* to null cookie will be considered as session
* cookie.
+ * @param string $sameSite The samesite value of the cookie. Defaults to Lax. Other possibilities are Strict or None
* @return $this
* @since 8.0.0
*/
- public function addCookie($name, $value, \DateTime $expireDate = null) {
- $this->cookies[$name] = ['value' => $value, 'expireDate' => $expireDate];
+ public function addCookie($name, $value, \DateTime $expireDate = null, $sameSite = 'Lax') {
+ $this->cookies[$name] = ['value' => $value, 'expireDate' => $expireDate, 'sameSite' => $sameSite];
return $this;
}
diff --git a/lib/public/Support/CrashReport/IRegistry.php b/lib/public/Support/CrashReport/IRegistry.php
index 5ceabcca641..77456663848 100644
--- a/lib/public/Support/CrashReport/IRegistry.php
+++ b/lib/public/Support/CrashReport/IRegistry.php
@@ -27,10 +27,12 @@ declare(strict_types=1);
namespace OCP\Support\CrashReport;
use Exception;
+use OCP\AppFramework\Bootstrap\IRegistrationContext;
use Throwable;
/**
* @since 13.0.0
+ * @deprecated used internally only
*/
interface IRegistry {
@@ -40,6 +42,8 @@ interface IRegistry {
* @param IReporter $reporter
*
* @since 13.0.0
+ * @deprecated 20.0.0 use IRegistrationContext::registerCrashReporter
+ * @see IRegistrationContext::registerCrashReporter()
*/
public function register(IReporter $reporter): void;
@@ -50,6 +54,7 @@ interface IRegistry {
* @param string $category
* @param array $context
*
+ * @deprecated used internally only
* @since 15.0.0
*/
public function delegateBreadcrumb(string $message, string $category, array $context = []): void;
@@ -60,6 +65,7 @@ interface IRegistry {
* @param Exception|Throwable $exception
* @param array $context
*
+ * @deprecated used internally only
* @since 13.0.0
*/
public function delegateReport($exception, array $context = []);
@@ -72,6 +78,7 @@ interface IRegistry {
*
* @return void
*
+ * @deprecated used internally only
* @since 17.0.0
*/
public function delegateMessage(string $message, array $context = []): void;
diff --git a/lib/public/Support/CrashReport/IReporter.php b/lib/public/Support/CrashReport/IReporter.php
index b7f84417937..5aaa9d8a6f5 100644
--- a/lib/public/Support/CrashReport/IReporter.php
+++ b/lib/public/Support/CrashReport/IReporter.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
*
*
diff --git a/lib/public/WorkflowEngine/Events/LoadSettingsScriptsEvent.php b/lib/public/WorkflowEngine/Events/LoadSettingsScriptsEvent.php
new file mode 100644
index 00000000000..56fddc84031
--- /dev/null
+++ b/lib/public/WorkflowEngine/Events/LoadSettingsScriptsEvent.php
@@ -0,0 +1,34 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2020 Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * 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
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\WorkflowEngine\Events;
+
+use OCP\EventDispatcher\Event;
+
+/**
+ * @since 20.0.0
+ */
+class LoadSettingsScriptsEvent extends Event {
+}