X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=application%2Ffront%2Fcontroller%2Fadmin%2FConfigureController.php;h=e675fccabad0eacf408acc0901c113d0e777a5c9;hb=1a68ae5a29bc33ab80c9cfbe043cb1213551533c;hp=b1d32270fd676c4551c9416ecf28b76acd74e2b2;hpb=66063ed1a18d739b1a60bfb163d8656417a4c529;p=github%2Fshaarli%2FShaarli.git
diff --git a/application/front/controller/admin/ConfigureController.php b/application/front/controller/admin/ConfigureController.php
index b1d32270..e675fcca 100644
--- a/application/front/controller/admin/ConfigureController.php
+++ b/application/front/controller/admin/ConfigureController.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Shaarli\Front\Controller\Admin;
use Shaarli\Languages;
+use Shaarli\Render\TemplatePage;
use Shaarli\Render\ThemeUtils;
use Shaarli\Thumbnailer;
use Slim\Http\Request;
@@ -12,14 +13,14 @@ use Slim\Http\Response;
use Throwable;
/**
- * Class PasswordController
+ * Class ConfigureController
*
* Slim controller used to handle Shaarli configuration page (display + save new config).
*/
class ConfigureController extends ShaarliAdminController
{
/**
- * GET /configure - Displays the configuration page
+ * GET /admin/configure - Displays the configuration page
*/
public function index(Request $request, Response $response): Response
{
@@ -52,11 +53,11 @@ class ConfigureController extends ShaarliAdminController
$this->assignView('thumbnails_mode', $this->container->conf->get('thumbnails.mode', Thumbnailer::MODE_NONE));
$this->assignView('pagetitle', t('Configure') .' - '. $this->container->conf->get('general.title', 'Shaarli'));
- return $response->write($this->render('configure'));
+ return $response->write($this->render(TemplatePage::CONFIGURE));
}
/**
- * POST /configure - Update Shaarli's configuration
+ * POST /admin/configure - Update Shaarli's configuration
*/
public function save(Request $request, Response $response): Response
{
@@ -97,10 +98,10 @@ class ConfigureController extends ShaarliAdminController
if ($thumbnailsMode !== Thumbnailer::MODE_NONE
&& $thumbnailsMode !== $this->container->conf->get('thumbnails.mode', Thumbnailer::MODE_NONE)
) {
- $this->saveWarningMessage(t(
- 'You have enabled or changed thumbnails mode. '
- .'Please synchronize them.'
- ));
+ $this->saveWarningMessage(
+ t('You have enabled or changed thumbnails mode.') .
+ '' . t('Please synchronize them.') .''
+ );
}
$this->container->conf->set('thumbnails.mode', $thumbnailsMode);
@@ -109,12 +110,17 @@ class ConfigureController extends ShaarliAdminController
$this->container->history->updateSettings();
$this->container->pageCacheManager->invalidateCaches();
} catch (Throwable $e) {
- // TODO: translation + stacktrace
- $this->saveErrorMessage('ERROR while writing config file after configuration update.');
+ $this->assignView('message', t('Error while writing config file after configuration update.'));
+
+ if ($this->container->conf->get('dev.debug', false)) {
+ $this->assignView('stacktrace', $e->getMessage() . PHP_EOL . $e->getTraceAsString());
+ }
+
+ return $response->write($this->render('error'));
}
$this->saveSuccessMessage(t('Configuration was saved.'));
- return $response->withRedirect('./configure');
+ return $this->redirect($response, '/admin/configure');
}
}