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 = new Application($this->kernel);
$application->setAutoExit(false); $application->setAutoExit(false);
$output = new BufferedOutput();
$input = new ArrayInput([ $input = new ArrayInput([
'command' => 'cache:clear', '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); $application->run($input, $output);
} }
} }

View file

@ -4,7 +4,7 @@ namespace App\Core\Controller\Account;
use App\Core\Controller\Admin\AdminController; use App\Core\Controller\Admin\AdminController;
use App\Core\Manager\EntityManager; 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;
use Scheb\TwoFactorBundle\Security\TwoFactor\Provider\Google\GoogleAuthenticatorInterface as TotpAuthenticatorInterface; use Scheb\TwoFactorBundle\Security\TwoFactor\Provider\Google\GoogleAuthenticatorInterface as TotpAuthenticatorInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;

View file

@ -19,13 +19,13 @@ class PageController extends AbstractController
$this->siteStore = $siteStore; $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(); 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 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 abstract class EntityManagerEventSubscriber implements EventSubscriberInterface
{ {
static protected int $priority = 0;
public static function getSubscribedEvents() public static function getSubscribedEvents()
{ {
return [ return [
EntityManagerEvent::CREATE_EVENT => 'onCreate', EntityManagerEvent::CREATE_EVENT => ['onCreate', self::$priority],
EntityManagerEvent::UPDATE_EVENT => 'onUpdate', EntityManagerEvent::UPDATE_EVENT => ['onUpdate', self::$priority],
EntityManagerEvent::DELETE_EVENT => 'onDelete', EntityManagerEvent::DELETE_EVENT => ['onDelete', self::$priority],
EntityManagerEvent::PRE_CREATE_EVENT => 'onPreCreate', EntityManagerEvent::PRE_CREATE_EVENT => ['onPreCreate', self::$priority],
EntityManagerEvent::PRE_UPDATE_EVENT => 'onPreUpdate', EntityManagerEvent::PRE_UPDATE_EVENT => ['onPreUpdate', self::$priority],
EntityManagerEvent::PRE_DELETE_EVENT => 'onPreDelete', EntityManagerEvent::PRE_DELETE_EVENT => ['onPreDelete', self::$priority],
]; ];
} }

View file

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

View file

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

View file

@ -28,28 +28,8 @@ abstract class RepositoryQuery
public function __call(string $name, $params): self 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) { foreach ($params as $key => $value) {
$fn($params[$key]); $this->populateDqlId($params[$key]);
} }
call_user_func_array([$this->query, $name], $params); call_user_func_array([$this->query, $name], $params);
@ -93,4 +73,25 @@ abstract class RepositoryQuery
{ {
return $this->repository; 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" "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." "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" "Edit the routing": "Éditez le routage"
"Name": "Nom"
"Authentication": "Authentification"
"Anyway": "Peu importe"
"Yes": "Oui"
"No": "Non"

View file

@ -4,7 +4,7 @@
<head> <head>
{{ include('@Core/admin/module/metas.html.twig') }} {{ include('@Core/admin/module/metas.html.twig') }}
<title>{% block title %}{{ site_name }} {% endblock %}</title> <title>{% block title %}{{ 'Authentication'|trans }}{% endblock %}</title>
{% block css %} {% block css %}
{{ encore_entry_link_tags('admin') }} {{ encore_entry_link_tags('admin') }}
@ -13,7 +13,7 @@
<body> <body>
<div class="container login-container"> <div class="container login-container">
<div class="row shadow rounded"> <div class="row shadow rounded">
<div class="col-md-6"> <div class="col-md-12">
<div class="login-form"> <div class="login-form">
<div class="h3 pb-4"> <div class="h3 pb-4">
<span class="text-success"> <span class="text-success">
@ -63,11 +63,6 @@
</form> </form>
</div> </div>
</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>
</div> </div>

View file

@ -4,7 +4,7 @@
<head> <head>
{{ include('@Core/admin/module/metas.html.twig') }} {{ 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 %} {% block css %}
{{ encore_entry_link_tags('admin') }} {{ encore_entry_link_tags('admin') }}

View file

@ -4,7 +4,7 @@
<head> <head>
{{ include('@Core/admin/module/metas.html.twig') }} {{ 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 %} {% block css %}
{{ encore_entry_link_tags('admin') }} {{ encore_entry_link_tags('admin') }}

View file

@ -4,7 +4,7 @@
<head> <head>
{{ include('@Core/admin/module/metas.html.twig') }} {{ 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 %} {% block css %}
{{ encore_entry_link_tags('admin') }} {{ encore_entry_link_tags('admin') }}

View file

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

View file

@ -1,7 +1,9 @@
{% extends '@Core/admin/layout.html.twig' %} {% extends '@Core/admin/layout.html.twig' %}
{% block title %}{{ 'Navigations'|trans }} - {{ parent() }}{% endblock %}
{% block body %} {% 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="d-flex">
<div class="mr-auto w-50"> <div class="mr-auto w-50">
<h1 class="display-5"> <h1 class="display-5">

View file

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

View file

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

View file

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

View file

@ -1,7 +1,9 @@
{% extends '@Core/admin/layout.html.twig' %} {% extends '@Core/admin/layout.html.twig' %}
{% block title %}{{ 'Pages'|trans }} - {{ parent() }}{% endblock %}
{% block body %} {% 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="d-flex">
<div class="mr-auto w-50"> <div class="mr-auto w-50">
<h1 class="display-5">{{ 'Pages'|trans }}</h1> <h1 class="display-5">{{ 'Pages'|trans }}</h1>

View file

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

View file

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

View file

@ -1,7 +1,9 @@
{% extends '@Core/admin/layout.html.twig' %} {% extends '@Core/admin/layout.html.twig' %}
{% block title %}{{ 'Users'|trans }} - {{ parent() }}{% endblock %}
{% block body %} {% 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="d-flex">
<div class="mr-auto w-50"> <div class="mr-auto w-50">
<h1 class="display-5">{{ 'Users'|trans }}</h1> <h1 class="display-5">{{ 'Users'|trans }}</h1>

View file

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

View file

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

View file

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