diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-07-06 08:04:35 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-07-23 21:19:21 +0200 |
commit | 1a8ac737e52cb25a5c346232ee398f5908cee7d7 (patch) | |
tree | 31954c4e106b5743e2005d72c2d548a0be8d6dce /application/container | |
parent | 6132d64748dfc6806ed25f71d2e078a5ed29d071 (diff) | |
download | Shaarli-1a8ac737e52cb25a5c346232ee398f5908cee7d7.tar.gz Shaarli-1a8ac737e52cb25a5c346232ee398f5908cee7d7.tar.zst Shaarli-1a8ac737e52cb25a5c346232ee398f5908cee7d7.zip |
Process main page (linklist) through Slim controller
Including a bunch of improvements on the container,
and helper used across new controllers.
Diffstat (limited to 'application/container')
-rw-r--r-- | application/container/ContainerBuilder.php | 11 | ||||
-rw-r--r-- | application/container/ShaarliContainer.php | 7 |
2 files changed, 16 insertions, 2 deletions
diff --git a/application/container/ContainerBuilder.php b/application/container/ContainerBuilder.php index ba91fe8b..ccb87c3a 100644 --- a/application/container/ContainerBuilder.php +++ b/application/container/ContainerBuilder.php | |||
@@ -18,6 +18,8 @@ use Shaarli\Render\PageCacheManager; | |||
18 | use Shaarli\Security\LoginManager; | 18 | use Shaarli\Security\LoginManager; |
19 | use Shaarli\Security\SessionManager; | 19 | use Shaarli\Security\SessionManager; |
20 | use Shaarli\Thumbnailer; | 20 | use Shaarli\Thumbnailer; |
21 | use Shaarli\Updater\Updater; | ||
22 | use Shaarli\Updater\UpdaterUtils; | ||
21 | 23 | ||
22 | /** | 24 | /** |
23 | * Class ContainerBuilder | 25 | * Class ContainerBuilder |
@@ -128,6 +130,15 @@ class ContainerBuilder | |||
128 | return new NetscapeBookmarkUtils($container->bookmarkService, $container->conf, $container->history); | 130 | return new NetscapeBookmarkUtils($container->bookmarkService, $container->conf, $container->history); |
129 | }; | 131 | }; |
130 | 132 | ||
133 | $container['updater'] = function (ShaarliContainer $container): Updater { | ||
134 | return new Updater( | ||
135 | UpdaterUtils::read_updates_file($container->conf->get('resource.updates')), | ||
136 | $container->bookmarkService, | ||
137 | $container->conf, | ||
138 | $container->loginManager->isLoggedIn() | ||
139 | ); | ||
140 | }; | ||
141 | |||
131 | return $container; | 142 | return $container; |
132 | } | 143 | } |
133 | } | 144 | } |
diff --git a/application/container/ShaarliContainer.php b/application/container/ShaarliContainer.php index b08fa4cb..09e7d5b1 100644 --- a/application/container/ShaarliContainer.php +++ b/application/container/ShaarliContainer.php | |||
@@ -17,15 +17,17 @@ use Shaarli\Render\PageCacheManager; | |||
17 | use Shaarli\Security\LoginManager; | 17 | use Shaarli\Security\LoginManager; |
18 | use Shaarli\Security\SessionManager; | 18 | use Shaarli\Security\SessionManager; |
19 | use Shaarli\Thumbnailer; | 19 | use Shaarli\Thumbnailer; |
20 | use Shaarli\Updater\Updater; | ||
20 | use Slim\Container; | 21 | use Slim\Container; |
21 | 22 | ||
22 | /** | 23 | /** |
23 | * Extension of Slim container to document the injected objects. | 24 | * Extension of Slim container to document the injected objects. |
24 | * | 25 | * |
25 | * @property string $basePath Shaarli's instance base path (e.g. `/shaarli/`) | 26 | * @property string $basePath Shaarli's instance base path (e.g. `/shaarli/`) |
26 | * @property BookmarkServiceInterface $bookmarkService | 27 | * @property BookmarkServiceInterface $bookmarkService |
27 | * @property ConfigManager $conf | 28 | * @property ConfigManager $conf |
28 | * @property mixed[] $environment $_SERVER automatically injected by Slim | 29 | * @property mixed[] $environment $_SERVER automatically injected by Slim |
30 | * @property callable $errorHandler Overrides default Slim error display | ||
29 | * @property FeedBuilder $feedBuilder | 31 | * @property FeedBuilder $feedBuilder |
30 | * @property FormatterFactory $formatterFactory | 32 | * @property FormatterFactory $formatterFactory |
31 | * @property History $history | 33 | * @property History $history |
@@ -37,6 +39,7 @@ use Slim\Container; | |||
37 | * @property PluginManager $pluginManager | 39 | * @property PluginManager $pluginManager |
38 | * @property SessionManager $sessionManager | 40 | * @property SessionManager $sessionManager |
39 | * @property Thumbnailer $thumbnailer | 41 | * @property Thumbnailer $thumbnailer |
42 | * @property Updater $updater | ||
40 | */ | 43 | */ |
41 | class ShaarliContainer extends Container | 44 | class ShaarliContainer extends Container |
42 | { | 45 | { |