Преглед на файлове

fix clear cache command

Olivier Massot преди 4 години
родител
ревизия
0100d8fa25

+ 2 - 1
ot_admin/Classes/Controller/SiteController.php

@@ -1156,7 +1156,8 @@ class SiteController extends ActionController
     {
         $rootUid = $this->otWebsiteRepository->findRootUidForOrganization($organizationId);
 
-        OtCacheManager::clearSiteCache($rootUid, $clearAll);
+        OtCacheManager::clearAllCache();
+//        OtCacheManager::clearSiteCache($rootUid, $clearAll);
 
         return $rootUid;
     }

+ 4 - 1
ot_admin/Classes/Http/ApiController.php

@@ -289,8 +289,11 @@ class ApiController implements LoggerAwareInterface
 
         $organizationId = $this->getOrganizationId($request);
 
+        $queryParams = $request->getQueryParams();
+        $clearAll = (isset($queryParams['all']) && $queryParams['all']);;
+
         $controller = GeneralUtility::makeInstance(ObjectManager::class)->get(SiteController::class);
-        $rootUid = $controller->clearSiteCacheAction($organizationId);
+        $rootUid = $controller->clearSiteCacheAction($organizationId, $clearAll);
 
         return new JsonResponse(
             [

+ 4 - 2
ot_core/Classes/Cache/OtCacheManager.php

@@ -57,7 +57,9 @@ class OtCacheManager
      */
     public static function clearAllCache()
     {
-        GeneralUtility::makeInstance(ClearCacheService::class)->clearAll();
-        GeneralUtility::makeInstance(OpcodeCacheService::class)->clearAllActive();
+        $cacheManager = GeneralUtility::makeInstance(CacheManager::class);
+        $cacheManager->flushCaches();
+//        GeneralUtility::makeInstance(ClearCacheService::class)->clearAll();
+//        GeneralUtility::makeInstance(OpcodeCacheService::class)->clearAllActive();
     }
 }

+ 7 - 5
ot_core/Classes/Service/OpentalentApiService.php

@@ -3,6 +3,7 @@
 namespace Opentalent\OtCore\Service;
 
 use GuzzleHttp\Client;
+use GuzzleHttp\Cookie\CookieJar;
 use GuzzleHttp\Exception\GuzzleException;
 use Opentalent\OtCore\Exception\ApiRequestException;
 use Psr\Http\Message\ResponseInterface;
@@ -129,16 +130,17 @@ class OpentalentApiService implements LoggerAwareInterface
      *
      * @param string $uri
      * @param array $params
+     * @param array $options
      * @return ResponseInterface
      * @throws ApiRequestException
      */
     public function get(
         string $uri,
         array $params = [],
-        array $config = []
+        array $options = []
     ): ResponseInterface
     {
-        return $this->request('GET', $uri, $params, $config);
+        return $this->request('GET', $uri, $params, $options);
     }
 
     /**
@@ -148,7 +150,7 @@ class OpentalentApiService implements LoggerAwareInterface
      * @param string $httpMethod
      * @param string $uri
      * @param array $params
-     * @param array $config
+     * @param array $options
      * @return ResponseInterface
      * @throws ApiRequestException
      */
@@ -156,7 +158,7 @@ class OpentalentApiService implements LoggerAwareInterface
         string $httpMethod,
         string $uri,
         array $params = [],
-        array $config = []
+        array $options = []
     ): ?ResponseInterface
     {
         $parsedUrl = parse_url($uri);
@@ -172,7 +174,7 @@ class OpentalentApiService implements LoggerAwareInterface
             if ($this->context->isDevelopment()) {
                 $this->logger->info('API Call: ' . $uri);
             }
-            return $this->client->request($httpMethod, $uri, $config);
+            return $this->client->request($httpMethod, $uri, $options);
         } catch (GuzzleException $e) {
             throw ApiRequestException::from_exception($e);
         }