backports murph-skeleton

This commit is contained in:
Simon Vieille 2021-04-11 17:15:51 +02:00
parent a8c5d9d249
commit b0398304f5
24 changed files with 85 additions and 51 deletions

View File

@ -40,12 +40,21 @@ class SymfonyCacheManager
{
$application = new Application($this->kernel);
$application->setAutoExit(false);
$output = new BufferedOutput();
$input = new ArrayInput([
'command' => 'cache:clear',
'-e' => $this->kernel->getEnvironment(),
'--no-warmup' => null,
]);
$application->run($input, $output);
$input = new ArrayInput([
'command' => 'cache:warmup',
'-e' => $this->kernel->getEnvironment(),
]);
$output = new BufferedOutput();
$application->run($input, $output);
}
}

View File

@ -4,7 +4,7 @@ namespace App\Core\Controller\Account;
use App\Core\Controller\Admin\AdminController;
use App\Core\Manager\EntityManager;
use App\Core\Repository\UserRepository;
use App\Repository\UserRepository;
use Scheb\TwoFactorBundle\Security\TwoFactor\Provider\Google\GoogleAuthenticatorInterface;
use Scheb\TwoFactorBundle\Security\TwoFactor\Provider\Google\GoogleAuthenticatorInterface as TotpAuthenticatorInterface;
use Symfony\Component\HttpFoundation\Request;

View File

@ -19,13 +19,13 @@ class PageController extends AbstractController
$this->siteStore = $siteStore;
}
public function show(Request $request, SiteRequest $siteRequest): Response
public function show(): Response
{
if (!$siteRequest->getPage()) {
if (!$this->siteRequest->getPage()) {
throw $this->createNotFoundException();
}
return $this->defaultRender($siteRequest->getPage()->getTemplate());
return $this->defaultRender($this->siteRequest->getPage()->getTemplate());
}
protected function defaultRender(string $view, array $parameters = [], Response $response = null): Response

View File

@ -12,15 +12,17 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
*/
abstract class EntityManagerEventSubscriber implements EventSubscriberInterface
{
static protected int $priority = 0;
public static function getSubscribedEvents()
{
return [
EntityManagerEvent::CREATE_EVENT => 'onCreate',
EntityManagerEvent::UPDATE_EVENT => 'onUpdate',
EntityManagerEvent::DELETE_EVENT => 'onDelete',
EntityManagerEvent::PRE_CREATE_EVENT => 'onPreCreate',
EntityManagerEvent::PRE_UPDATE_EVENT => 'onPreUpdate',
EntityManagerEvent::PRE_DELETE_EVENT => 'onPreDelete',
EntityManagerEvent::CREATE_EVENT => ['onCreate', self::$priority],
EntityManagerEvent::UPDATE_EVENT => ['onUpdate', self::$priority],
EntityManagerEvent::DELETE_EVENT => ['onDelete', self::$priority],
EntityManagerEvent::PRE_CREATE_EVENT => ['onPreCreate', self::$priority],
EntityManagerEvent::PRE_UPDATE_EVENT => ['onPreUpdate', self::$priority],
EntityManagerEvent::PRE_DELETE_EVENT => ['onPreDelete', self::$priority],
];
}

View File

@ -88,7 +88,7 @@ class MenuEventSubscriber extends EntityManagerEventSubscriber
$this->nodeRepository->persistAsFirstChild($childNode, $rootNode);
$this->cacheManager->cleanAll();
$this->cacheManager->cleanRouting();
}
public function onUpdate(EntityManagerEvent $event)

View File

@ -39,11 +39,7 @@ class SiteEventSubscriber extends EntityManagerEventSubscriber
return;
}
if ($event->getEntity() instanceof Node) {
$this->cacheManager->cleanRouting();
} else {
$this->cacheManager->cleanAll();
}
}
public function onCreate(EntityManagerEvent $event)

View File

@ -28,28 +28,8 @@ abstract class RepositoryQuery
public function __call(string $name, $params): self
{
$fn = function (&$data) {
if (is_string($data)) {
$words = explode(' ', $data);
foreach ($words as $k => $v) {
if (isset($v[0]) && '.' === $v[0]) {
$words[$k] = $this->id.$v;
}
}
$data = implode(' ', $words);
} elseif (is_array($data)) {
foreach ($data as $k => $v) {
$fn($data[$k]);
}
}
return $data;
};
foreach ($params as $key => $value) {
$fn($params[$key]);
$this->populateDqlId($params[$key]);
}
call_user_func_array([$this->query, $name], $params);
@ -93,4 +73,25 @@ abstract class RepositoryQuery
{
return $this->repository;
}
protected function populateDqlId(&$data)
{
if (is_string($data)) {
$words = explode(' ', $data);
foreach ($words as $k => $v) {
if (isset($v[0]) && '.' === $v[0]) {
$words[$k] = $this->id.$v;
}
}
$data = implode(' ', $words);
} elseif (is_array($data)) {
foreach ($data as $k => $v) {
$this->populateDqlId($data[$k]);
}
}
return $data;
}
}

View File

@ -121,3 +121,8 @@
"Show the login page": "Afficher la page de connexion"
"A password reset request has been made. If you are the source of this request, click on the link below or copy and paste the address if the link does not work.": "Une demande de réinitialisation de mot de passe a été réalisée. Si vous êtes à l'origine de cette demande, cliquer sur le lien ci-dessous ou copier et coller l'adresse si le lien ne fonctionne pas."
"Edit the routing": "Éditez le routage"
"Name": "Nom"
"Authentication": "Authentification"
"Anyway": "Peu importe"
"Yes": "Oui"
"No": "Non"

View File

@ -4,7 +4,7 @@
<head>
{{ include('@Core/admin/module/metas.html.twig') }}
<title>{% block title %}{{ site_name }} {% endblock %}</title>
<title>{% block title %}{{ 'Authentication'|trans }}{% endblock %}</title>
{% block css %}
{{ encore_entry_link_tags('admin') }}
@ -13,7 +13,7 @@
<body>
<div class="container login-container">
<div class="row shadow rounded">
<div class="col-md-6">
<div class="col-md-12">
<div class="login-form">
<div class="h3 pb-4">
<span class="text-success">
@ -63,11 +63,6 @@
</form>
</div>
</div>
<div class="col-md-6 bg-light d-flex">
<div class="flex-fill align-self-center text-center p-3">
<img class="login-image" src="{{ asset(site_logo) }}" alt="{{ site_name }}" title="{{ site_name }}">
</div>
</div>
</div>
</div>

View File

@ -4,7 +4,7 @@
<head>
{{ include('@Core/admin/module/metas.html.twig') }}
<title>{% block title %}{{ site_name }}{% endblock %}</title>
<title>{% block title %}{{ 'Authentication'|trans }} - {{ site_name }}{% endblock %}</title>
{% block css %}
{{ encore_entry_link_tags('admin') }}

View File

@ -4,7 +4,7 @@
<head>
{{ include('@Core/admin/module/metas.html.twig') }}
<title>{% block title %}{{ site_name }}{% endblock %}</title>
<title>{% block title %}{{ 'Authentication'|trans }} - {{ site_name }}{% endblock %}</title>
{% block css %}
{{ encore_entry_link_tags('admin') }}

View File

@ -4,7 +4,7 @@
<head>
{{ include('@Core/admin/module/metas.html.twig') }}
<title>{% block title %}{{ site_name }}{% endblock %}</title>
<title>{% block title %}{{ 'Authentication'|trans }} - {{ site_name }}{% endblock %}</title>
{% block css %}
{{ encore_entry_link_tags('admin') }}

View File

@ -1,5 +1,7 @@
{% extends '@Core/admin/layout.html.twig' %}
{% block title %}{{ 'Navigations'|trans }} - {{ parent() }}{% endblock %}
{% block body %}
<div class="bg-light pl-5 pr-4 pt-5 pb-5">
<div class="d-flex">

View File

@ -1,7 +1,9 @@
{% extends '@Core/admin/layout.html.twig' %}
{% block title %}{{ 'Navigations'|trans }} - {{ parent() }}{% endblock %}
{% block body %}
<div class="bg-light pl-5 pr-4 pt-5 {% if pager.getPaginationData.pageCount < 2 %}pb-5{% endif %}">
<div class="bg-light pl-5 pr-4 pt-5 {% if pager.paginationData.pageCount < 2 %}pb-5{% endif %}">
<div class="d-flex">
<div class="mr-auto w-50">
<h1 class="display-5">

View File

@ -1,5 +1,7 @@
{% extends '@Core/admin/layout.html.twig' %}
{% block title %}{{ 'Navigations'|trans }} - {{ parent() }}{% endblock %}
{% block body %}
<div class="bg-light pl-5 pr-4 pt-5 pb-5">
<div class="d-flex">

View File

@ -1,5 +1,7 @@
{% extends '@Core/admin/layout.html.twig' %}
{% block title %}{{ 'Navigations'|trans }} - {{ parent() }}{% endblock %}
{% block body %}
<div class="bg-light pl-5 pr-4 pt-5 pb-5">
<div class="d-flex">

View File

@ -1,5 +1,7 @@
{% extends '@Core/admin/layout.html.twig' %}
{% block title %}{{ 'Pages'|trans }} - {{ parent() }}{% endblock %}
{% block body %}
<div class="bg-light pl-5 pr-4 pt-5 pb-5">
<div class="d-flex">

View File

@ -1,7 +1,9 @@
{% extends '@Core/admin/layout.html.twig' %}
{% block title %}{{ 'Pages'|trans }} - {{ parent() }}{% endblock %}
{% block body %}
<div class="bg-light pl-5 pr-4 pt-5 {% if pager.getPaginationData.pageCount < 2 %}pb-5{% endif %}">
<div class="bg-light pl-5 pr-4 pt-5 {% if pager.paginationData.pageCount < 2 %}pb-5{% endif %}">
<div class="d-flex">
<div class="mr-auto w-50">
<h1 class="display-5">{{ 'Pages'|trans }}</h1>

View File

@ -1,5 +1,7 @@
{% extends '@Core/admin/layout.html.twig' %}
{% block title %}{{ 'Tree'|trans }} - {{ parent() }}{% endblock %}
{% block body %}
<div class="bg-light pl-5 pr-4 pt-5 pb-5">
<div class="d-flex">

View File

@ -1,5 +1,7 @@
{% extends '@Core/admin/layout.html.twig' %}
{% block title %}{{ 'Users'|trans }} - {{ parent() }}{% endblock %}
{% block body %}
<div class="bg-light pl-5 pr-4 pt-5 pb-5">
<div class="d-flex">

View File

@ -1,7 +1,9 @@
{% extends '@Core/admin/layout.html.twig' %}
{% block title %}{{ 'Users'|trans }} - {{ parent() }}{% endblock %}
{% block body %}
<div class="bg-light pl-5 pr-4 pt-5 {% if pager.getPaginationData.pageCount < 2 %}pb-5{% endif %}">
<div class="bg-light pl-5 pr-4 pt-5 {% if pager.paginationData.pageCount < 2 %}pb-5{% endif %}">
<div class="d-flex">
<div class="mr-auto w-50">
<h1 class="display-5">{{ 'Users'|trans }}</h1>

View File

@ -1,5 +1,7 @@
{% extends '@Core/admin/layout.html.twig' %}
{% block title %}{{ 'Users'|trans }} - {{ parent() }}{% endblock %}
{% block body %}
<div class="bg-light pl-5 pr-4 pt-5 pb-5">
<div class="d-flex">

View File

@ -1,5 +1,7 @@
{% extends '@Core/admin/layout.html.twig' %}
{% block title %}{{ 'Users'|trans }} - {{ parent() }}{% endblock %}
{% block body %}
<div class="bg-light pl-5 pr-4 pt-5 pb-5">
<div class="d-flex">

View File

@ -38,6 +38,10 @@ class SitemapBuilder
foreach ($rootNode->getAllChildren() as $node) {
$parameters = $node->getSitemapParameters();
if (!$parameters['isVisible']) {
continue;
}
if ($node->hasExternalUrl()) {
continue;
}