Bläddra i källkod

remove strong depreciations error

Olivier Massot 1 år sedan
förälder
incheckning
51a621ebea

+ 1 - 1
doc/docker.md

@@ -27,7 +27,7 @@ Pour répliquer manuellement l'installation Typo3 telle qu'elle existe sur test:
 1. Accéder en SSH au serveur preprod, et lancer:
 
     cd /var/www/typo3
-    tar cvzf ./typo3_install.tar.gz . --exclude='./public/fileadmin/user_upload' --exclude='./archive' --exclude='./public/fileadmin/_processed_' --exclude='./var/log/*.log'
+    tar --exclude='./public/fileadmin/user_upload' --exclude='./archive.del' --exclude='./public/fileadmin/_processed_' --exclude='./var/log/*.log' -cvzf ./typo3_install.tar.gz .
 
 2. Télécharger l'archive
 

+ 2 - 1
ot_core/Classes/Middleware/Frontend/OtSiteResolver.php

@@ -2,6 +2,7 @@
 declare(strict_types = 1);
 namespace Opentalent\OtCore\Middleware\Frontend;
 
+use Opentalent\OtAdmin\Controller\SiteController;
 use Opentalent\OtCore\Exception\NoSuchWebsiteException;
 use Opentalent\OtCore\Website\OtWebsiteRepository;
 use Psr\Http\Message\ResponseInterface;
@@ -28,7 +29,7 @@ class OtSiteResolver extends SiteResolver
      */
     public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
     {
-        $otWebsiteRepository = GeneralUtility::makeInstance(ObjectManager::class)->get(OtWebsiteRepository::class);
+        $otWebsiteRepository = GeneralUtility::makeInstance(OtWebsiteRepository::class);
 
         try {
             $devMode = $_SERVER['TYPO3_CONTEXT'] == "Development";

+ 2 - 4
ot_stats/Classes/Domain/Repository/MatomoWebsiteRepository.php

@@ -129,8 +129,7 @@ class MatomoWebsiteRepository
      */
     public function findByWebsiteUid(int $websiteUid): ?MatomoWebsite
     {
-        $otWebsiteRepository = GeneralUtility::makeInstance(ObjectManager::class)->get(OtWebsiteRepository::class);
-        $website = $otWebsiteRepository->getWebsiteByUid($websiteUid);
+        $website = $this->otWebsiteRepository->getWebsiteByUid($websiteUid);
 
         if ($website['matomo_site_id'] == null) {
             return null;
@@ -147,8 +146,7 @@ class MatomoWebsiteRepository
      */
     public function findByRootUid(int $rootUid): ?MatomoWebsite
     {
-        $otWebsiteRepository = GeneralUtility::makeInstance(ObjectManager::class)->get(OtWebsiteRepository::class);
-        $website = $otWebsiteRepository->getWebsiteByPageUid($rootUid);
+        $website = $this->otWebsiteRepository->getWebsiteByPageUid($rootUid);
 
         if ($website['matomo_site_id'] == null) {
             return null;

+ 5 - 1
ot_stats/ext_tables.php

@@ -1,6 +1,8 @@
 <?php
 
 use Opentalent\OtStats\Controller\OtStatsController;
+use Psr\Http\Message\ServerRequestInterface;
+use TYPO3\CMS\Core\Http\ApplicationType;
 
 defined('TYPO3') || die('Access denied.');
 
@@ -9,7 +11,9 @@ defined('TYPO3') || die('Access denied.');
 call_user_func(
     function()
     {
-        if (TYPO3_MODE === 'BE') {
+        if (
+            ($GLOBALS['TYPO3_REQUEST'] ?? null) instanceof ServerRequestInterface &&
+            ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend()) {
             /**
              * Registers the statistics backend module
              */

+ 1 - 11
ot_templating/Classes/Page/ErrorHandler.php

@@ -46,7 +46,6 @@ class ErrorHandler implements PageErrorHandlerInterface
 
     private OtWebsiteRepository $otWebsiteRepository;
     private OtPageRepository $otPageRepository;
-    private ControllerContext $controllerContext;
     private RenderingContext $renderingContext;
     private Request $request;
 
@@ -79,14 +78,6 @@ class ErrorHandler implements PageErrorHandlerInterface
         $this->otPageRepository = $otPageRepository;
     }
 
-    /**
-     * @param ControllerContext $controllerContext
-     * @return void
-     */
-    public function injectControllerContext(ControllerContext $controllerContext) {
-        $this->controllerContext = $controllerContext;
-    }
-
     /**
      * @param RenderingContext $renderingContext
      * @return void
@@ -115,8 +106,7 @@ class ErrorHandler implements PageErrorHandlerInterface
         array $reasons = []
     ): ResponseInterface {
         $this->request->setControllerExtensionName('ot_templating');
-        $this->controllerContext->setRequest($this->request);
-        $this->renderingContext->setControllerContext($this->controllerContext);
+        $this->renderingContext->setRequest($this->request);
 
         $this->view->setRenderingContext($this->renderingContext);
         $this->view->setTemplateRootPaths([self::TEMPLATES_ROOT_PATHS]);

+ 4 - 1
ot_templating/ext_tables.php

@@ -1,6 +1,8 @@
 <?php
 
 use Opentalent\OtTemplating\Controller\OtCustomizerController;
+use Psr\Http\Message\ServerRequestInterface;
+use TYPO3\CMS\Core\Http\ApplicationType;
 
 defined('TYPO3') || die('Access denied.');
 
@@ -15,7 +17,8 @@ call_user_func(
             'Configuration/TypoScript',
             'Templating');
 
-        if (TYPO3_MODE === 'BE') {
+        if (($GLOBALS['TYPO3_REQUEST'] ?? null) instanceof ServerRequestInterface &&
+            ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend()) {
             /**
              * Registers the customizer backend module
              */