namespace Shaarli\Front\Controller\Visitor;
use Shaarli\ApplicationUtils;
-use Shaarli\Bookmark\BookmarkFilter;
use Shaarli\Container\ShaarliContainer;
use Shaarli\Front\Exception\AlreadyInstalledException;
use Shaarli\Front\Exception\ResourcePermissionException;
$this->container->conf->get('credentials.salt')
)
);
+ $this->container->conf->set('general.header_link', $this->container->basePath . '/');
try {
// Everything is ok, let's create config file.
$this->container->conf->write($this->container->loginManager->isLoggedIn());
} catch (\Exception $e) {
- $this->assignView('message', $e->getMessage());
- $this->assignView('stacktrace', $e->getTraceAsString());
+ $this->assignView('message', t('Error while writing config file after configuration update.'));
+ $this->assignView('stacktrace', $e->getMessage() . PHP_EOL . $e->getTraceAsString());
return $response->write($this->render('error'));
}
- if ($this->container->bookmarkService->count(BookmarkFilter::$ALL) === 0) {
- $this->container->bookmarkService->initialize();
- }
-
$this->container->sessionManager->setSessionParameter(
SessionManager::KEY_SUCCESS_MESSAGES,
[t('Shaarli is now configured. Please login and start shaaring your bookmarks!')]
);
- return $this->redirect($response, '/');
+ return $this->redirect($response, '/login');
}
protected function checkPermissions(): bool
{
// Ensure Shaarli has proper access to its resources
$errors = ApplicationUtils::checkResourcePermissions($this->container->conf);
-
if (empty($errors)) {
return true;
}
- // FIXME! Do not insert HTML here.
- $message = '<p>'. t('Insufficient permissions:') .'</p><ul>';
-
+ $message = t('Insufficient permissions:') . PHP_EOL;
foreach ($errors as $error) {
- $message .= '<li>'.$error.'</li>';
+ $message .= PHP_EOL . $error;
}
- $message .= '</ul>';
throw new ResourcePermissionException($message);
}