aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/container
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-01-23 21:52:03 +0100
committerArthurHoaro <arthur@hoa.ro>2020-07-23 21:19:21 +0200
commit8e47af2b3620c920116ec056173277c039163ec1 (patch)
treed77f31f17bf4485f5a3ec0fea895205e9bde0554 /application/container
parentb0428aa9b02b058b72c40b6e8dc2298d55bf692f (diff)
downloadShaarli-8e47af2b3620c920116ec056173277c039163ec1.tar.gz
Shaarli-8e47af2b3620c920116ec056173277c039163ec1.tar.zst
Shaarli-8e47af2b3620c920116ec056173277c039163ec1.zip
Process logout through Slim controller
Diffstat (limited to 'application/container')
-rw-r--r--application/container/ContainerBuilder.php20
-rw-r--r--application/container/ShaarliContainer.php3
2 files changed, 21 insertions, 2 deletions
diff --git a/application/container/ContainerBuilder.php b/application/container/ContainerBuilder.php
index 99c12334..c5c4a2c3 100644
--- a/application/container/ContainerBuilder.php
+++ b/application/container/ContainerBuilder.php
@@ -11,6 +11,7 @@ use Shaarli\Formatter\FormatterFactory;
11use Shaarli\History; 11use Shaarli\History;
12use Shaarli\Plugin\PluginManager; 12use Shaarli\Plugin\PluginManager;
13use Shaarli\Render\PageBuilder; 13use Shaarli\Render\PageBuilder;
14use Shaarli\Render\PageCacheManager;
14use Shaarli\Security\LoginManager; 15use Shaarli\Security\LoginManager;
15use Shaarli\Security\SessionManager; 16use Shaarli\Security\SessionManager;
16 17
@@ -34,19 +35,30 @@ class ContainerBuilder
34 /** @var LoginManager */ 35 /** @var LoginManager */
35 protected $login; 36 protected $login;
36 37
37 public function __construct(ConfigManager $conf, SessionManager $session, LoginManager $login) 38 /** @var string */
38 { 39 protected $webPath;
40
41 public function __construct(
42 ConfigManager $conf,
43 SessionManager $session,
44 LoginManager $login,
45 string $webPath
46 ) {
39 $this->conf = $conf; 47 $this->conf = $conf;
40 $this->session = $session; 48 $this->session = $session;
41 $this->login = $login; 49 $this->login = $login;
50 $this->webPath = $webPath;
42 } 51 }
43 52
44 public function build(): ShaarliContainer 53 public function build(): ShaarliContainer
45 { 54 {
46 $container = new ShaarliContainer(); 55 $container = new ShaarliContainer();
56
47 $container['conf'] = $this->conf; 57 $container['conf'] = $this->conf;
48 $container['sessionManager'] = $this->session; 58 $container['sessionManager'] = $this->session;
49 $container['loginManager'] = $this->login; 59 $container['loginManager'] = $this->login;
60 $container['webPath'] = $this->webPath;
61
50 $container['plugins'] = function (ShaarliContainer $container): PluginManager { 62 $container['plugins'] = function (ShaarliContainer $container): PluginManager {
51 return new PluginManager($container->conf); 63 return new PluginManager($container->conf);
52 }; 64 };
@@ -81,6 +93,10 @@ class ContainerBuilder
81 return new FormatterFactory($container->conf, $container->loginManager->isLoggedIn()); 93 return new FormatterFactory($container->conf, $container->loginManager->isLoggedIn());
82 }; 94 };
83 95
96 $container['pageCacheManager'] = function (ShaarliContainer $container): PageCacheManager {
97 return new PageCacheManager($container->conf->get('resource.page_cache'));
98 };
99
84 return $container; 100 return $container;
85 } 101 }
86} 102}
diff --git a/application/container/ShaarliContainer.php b/application/container/ShaarliContainer.php
index fdf2f77f..af62e574 100644
--- a/application/container/ShaarliContainer.php
+++ b/application/container/ShaarliContainer.php
@@ -10,6 +10,7 @@ use Shaarli\Formatter\FormatterFactory;
10use Shaarli\History; 10use Shaarli\History;
11use Shaarli\Plugin\PluginManager; 11use Shaarli\Plugin\PluginManager;
12use Shaarli\Render\PageBuilder; 12use Shaarli\Render\PageBuilder;
13use Shaarli\Render\PageCacheManager;
13use Shaarli\Security\LoginManager; 14use Shaarli\Security\LoginManager;
14use Shaarli\Security\SessionManager; 15use Shaarli\Security\SessionManager;
15use Slim\Container; 16use Slim\Container;
@@ -20,11 +21,13 @@ use Slim\Container;
20 * @property ConfigManager $conf 21 * @property ConfigManager $conf
21 * @property SessionManager $sessionManager 22 * @property SessionManager $sessionManager
22 * @property LoginManager $loginManager 23 * @property LoginManager $loginManager
24 * @property string $webPath
23 * @property History $history 25 * @property History $history
24 * @property BookmarkServiceInterface $bookmarkService 26 * @property BookmarkServiceInterface $bookmarkService
25 * @property PageBuilder $pageBuilder 27 * @property PageBuilder $pageBuilder
26 * @property PluginManager $pluginManager 28 * @property PluginManager $pluginManager
27 * @property FormatterFactory $formatterFactory 29 * @property FormatterFactory $formatterFactory
30 * @property PageCacheManager $pageCacheManager
28 */ 31 */
29class ShaarliContainer extends Container 32class ShaarliContainer extends Container
30{ 33{