From f2f7c55c0cc81b5fc2ad0d14044b781a635421ec Mon Sep 17 00:00:00 2001 From: aynsix Date: Fri, 5 Apr 2024 15:11:57 +0300 Subject: [PATCH 1/4] fix error on get_in on conf --- lib/Alchemy/Phrasea/Application.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Alchemy/Phrasea/Application.php b/lib/Alchemy/Phrasea/Application.php index c67ab8613d..98c64d5fc6 100644 --- a/lib/Alchemy/Phrasea/Application.php +++ b/lib/Alchemy/Phrasea/Application.php @@ -187,7 +187,7 @@ public function __construct($environment = null) $this->register(new ApiApplicationMiddlewareProvider()); $this->register(new ACLServiceProvider()); $this->register(new APIServiceProvider()); - $this->register(new AuthenticationManagerServiceProvider()); + $this->register(new AuthorizationServiceProvider()); $this->register(new BrowserServiceProvider()); $this->register(new ConvertersServiceProvider()); @@ -215,6 +215,7 @@ public function __construct($environment = null) if ($this['configuration.store']->isSetup()) { $this->register(new SearchEngineServiceProvider()); $this->register(new BorderManagerServiceProvider()); + $this->register(new AuthenticationManagerServiceProvider()); } $this->register(new SerializerServiceProvider()); From 6c357e4e03f858b4f56b014554c6a6d77a79379f Mon Sep 17 00:00:00 2001 From: aynsix Date: Fri, 5 Apr 2024 15:26:25 +0300 Subject: [PATCH 2/4] fix --- lib/Alchemy/Phrasea/Application.php | 3 +-- .../Provider/AuthenticationManagerServiceProvider.php | 9 +++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Alchemy/Phrasea/Application.php b/lib/Alchemy/Phrasea/Application.php index 98c64d5fc6..c67ab8613d 100644 --- a/lib/Alchemy/Phrasea/Application.php +++ b/lib/Alchemy/Phrasea/Application.php @@ -187,7 +187,7 @@ public function __construct($environment = null) $this->register(new ApiApplicationMiddlewareProvider()); $this->register(new ACLServiceProvider()); $this->register(new APIServiceProvider()); - + $this->register(new AuthenticationManagerServiceProvider()); $this->register(new AuthorizationServiceProvider()); $this->register(new BrowserServiceProvider()); $this->register(new ConvertersServiceProvider()); @@ -215,7 +215,6 @@ public function __construct($environment = null) if ($this['configuration.store']->isSetup()) { $this->register(new SearchEngineServiceProvider()); $this->register(new BorderManagerServiceProvider()); - $this->register(new AuthenticationManagerServiceProvider()); } $this->register(new SerializerServiceProvider()); diff --git a/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php index 559b27fcd3..85d193946f 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php @@ -35,10 +35,11 @@ public function register(Application $app) return new Authenticator($app, $app['browser'], $app['session'], $app['orm.em']); }); - if ($app['configuration.store']->isSetup() && $app['conf']->get(['registry', 'webservices', 'recaptcha-private-key']) !== "") { - $app['recaptcha'] = $app->share(function (Application $app) { - return new ReCaptcha($app['conf']->get(['registry', 'webservices', 'recaptcha-private-key'])); - }); + if ($app['configuration.store']->isSetup()) + if ($app['conf']->get(['registry', 'webservices', 'recaptcha-private-key']) !== "") { + $app['recaptcha'] = $app->share(function (Application $app) { + return new ReCaptcha($app['conf']->get(['registry', 'webservices', 'recaptcha-private-key'])); + }); } $app['authentication.persistent-manager'] = $app->share(function (Application $app) { From 222be6662d502cd429e79e4be4020254cab6556f Mon Sep 17 00:00:00 2001 From: aynsix Date: Fri, 5 Apr 2024 17:10:22 +0300 Subject: [PATCH 3/4] fix --- .../Phrasea/Core/Configuration/Configuration.php | 12 +++++++++--- .../Phrasea/Core/Configuration/HostConfiguration.php | 2 +- .../AuthenticationManagerServiceProvider.php | 9 ++++----- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/Alchemy/Phrasea/Core/Configuration/Configuration.php b/lib/Alchemy/Phrasea/Core/Configuration/Configuration.php index 2a9cf416f5..5d36bbcf0e 100644 --- a/lib/Alchemy/Phrasea/Core/Configuration/Configuration.php +++ b/lib/Alchemy/Phrasea/Core/Configuration/Configuration.php @@ -138,11 +138,11 @@ public function getConfig() return $this->parser->parse($this->loadFile($this->config)); } - if (null !== $this->cache) { + if (null !== $this->cache && is_array($this->cache)) { return $this->cache; } - if (!is_file($this->compiled) || ($this->isAutoReload() && !$this->isConfigFresh())) { + if (!is_file($this->compiled) || ($this->isAutoReload() && !$this->isConfigFresh()) || !is_array($this->cache)) { if (!$this->isSetup()) { throw new RuntimeException('Configuration is not set up'); } @@ -151,7 +151,13 @@ public function getConfig() )); } - return $this->cache = require $this->compiled; + $this->cache = require $this->compiled; + + if (is_array($this->cache)) { + return $this->cache; + } else { + throw new RuntimeException('Configuration compiled error'); + } } /** diff --git a/lib/Alchemy/Phrasea/Core/Configuration/HostConfiguration.php b/lib/Alchemy/Phrasea/Core/Configuration/HostConfiguration.php index a5badd4a17..9377868c47 100644 --- a/lib/Alchemy/Phrasea/Core/Configuration/HostConfiguration.php +++ b/lib/Alchemy/Phrasea/Core/Configuration/HostConfiguration.php @@ -151,7 +151,7 @@ public function setDefault($name) */ public function getConfig() { - if (empty($this->cache)) { + if (empty($this->cache) || !is_array($this->cache)) { throw new RuntimeException('Configuration is not set up.'); } diff --git a/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php index 85d193946f..559b27fcd3 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php @@ -35,11 +35,10 @@ public function register(Application $app) return new Authenticator($app, $app['browser'], $app['session'], $app['orm.em']); }); - if ($app['configuration.store']->isSetup()) - if ($app['conf']->get(['registry', 'webservices', 'recaptcha-private-key']) !== "") { - $app['recaptcha'] = $app->share(function (Application $app) { - return new ReCaptcha($app['conf']->get(['registry', 'webservices', 'recaptcha-private-key'])); - }); + if ($app['configuration.store']->isSetup() && $app['conf']->get(['registry', 'webservices', 'recaptcha-private-key']) !== "") { + $app['recaptcha'] = $app->share(function (Application $app) { + return new ReCaptcha($app['conf']->get(['registry', 'webservices', 'recaptcha-private-key'])); + }); } $app['authentication.persistent-manager'] = $app->share(function (Application $app) { From 2d0e2d58630360717d88a79027247c7d7334842a Mon Sep 17 00:00:00 2001 From: aynsix Date: Mon, 15 Apr 2024 11:11:51 +0300 Subject: [PATCH 4/4] fix --- lib/Alchemy/Phrasea/Core/Configuration/Configuration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Alchemy/Phrasea/Core/Configuration/Configuration.php b/lib/Alchemy/Phrasea/Core/Configuration/Configuration.php index 5d36bbcf0e..249a1f9838 100644 --- a/lib/Alchemy/Phrasea/Core/Configuration/Configuration.php +++ b/lib/Alchemy/Phrasea/Core/Configuration/Configuration.php @@ -142,7 +142,7 @@ public function getConfig() return $this->cache; } - if (!is_file($this->compiled) || ($this->isAutoReload() && !$this->isConfigFresh()) || !is_array($this->cache)) { + if (!is_file($this->compiled) || ($this->isAutoReload() && !$this->isConfigFresh())) { if (!$this->isSetup()) { throw new RuntimeException('Configuration is not set up'); }