Browse Source

backports murph-skeleton

develop
Simon Vieille 6 months ago
parent
commit
b0398304f5
  1. 11
      core/Cache/SymfonyCacheManager.php
  2. 2
      core/Controller/Account/AccountAdminController.php
  3. 6
      core/Controller/Site/PageController.php
  4. 14
      core/EventSuscriber/EntityManagerEventSubscriber.php
  5. 2
      core/EventSuscriber/Site/MenuEventSubscriber.php
  6. 6
      core/EventSuscriber/Site/SiteEventSubscriber.php
  7. 43
      core/Repository/RepositoryQuery.php
  8. 5
      core/Resources/translations/messages.fr.yaml
  9. 9
      core/Resources/views/auth/2fa.html.twig
  10. 2
      core/Resources/views/auth/login.html.twig
  11. 2
      core/Resources/views/auth/resetting_request.html.twig
  12. 2
      core/Resources/views/auth/resetting_update.html.twig
  13. 2
      core/Resources/views/site/navigation_admin/edit.html.twig
  14. 4
      core/Resources/views/site/navigation_admin/index.html.twig
  15. 2
      core/Resources/views/site/navigation_admin/new.html.twig
  16. 2
      core/Resources/views/site/navigation_admin/show.html.twig
  17. 2
      core/Resources/views/site/page_admin/edit.html.twig
  18. 4
      core/Resources/views/site/page_admin/index.html.twig
  19. 2
      core/Resources/views/site/tree_admin/navigation.html.twig
  20. 2
      core/Resources/views/user/user_admin/edit.html.twig
  21. 4
      core/Resources/views/user/user_admin/index.html.twig
  22. 2
      core/Resources/views/user/user_admin/new.html.twig
  23. 2
      core/Resources/views/user/user_admin/show.html.twig
  24. 4
      core/Sitemap/SitemapBuilder.php

11
core/Cache/SymfonyCacheManager.php

@ -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);
}
}

2
core/Controller/Account/AccountAdminController.php

@ -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;

6
core/Controller/Site/PageController.php

@ -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

14
core/EventSuscriber/EntityManagerEventSubscriber.php

@ -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],
];
}

2
core/EventSuscriber/Site/MenuEventSubscriber.php

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

6
core/EventSuscriber/Site/SiteEventSubscriber.php

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

43
core/Repository/RepositoryQuery.php

@ -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;
}
}

5
core/Resources/translations/messages.fr.yaml

@ -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"

9
core/Resources/views/auth/2fa.html.twig

@ -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>

2
core/Resources/views/auth/login.html.twig

@ -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') }}

2
core/Resources/views/auth/resetting_request.html.twig

@ -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') }}

2
core/Resources/views/auth/resetting_update.html.twig

@ -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') }}

2
core/Resources/views/site/navigation_admin/edit.html.twig

@ -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">

4
core/Resources/views/site/navigation_admin/index.html.twig

@ -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">

2
core/Resources/views/site/navigation_admin/new.html.twig

@ -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">

2
core/Resources/views/site/navigation_admin/show.html.twig

@ -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">

2
core/Resources/views/site/page_admin/edit.html.twig

@ -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">

4
core/Resources/views/site/page_admin/index.html.twig

@ -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>

2
core/Resources/views/site/tree_admin/navigation.html.twig

@ -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">

2
core/Resources/views/user/user_admin/edit.html.twig

@ -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">

4
core/Resources/views/user/user_admin/index.html.twig

@ -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>

2
core/Resources/views/user/user_admin/new.html.twig

@ -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">

2
core/Resources/views/user/user_admin/show.html.twig

@ -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">

4
core/Sitemap/SitemapBuilder.php

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

Loading…
Cancel
Save