Browse Source

minor fixes

Olivier Massot 7 months ago
parent
commit
4d9265b8ea

+ 5 - 3
ot_admin/Classes/Controller/SiteController.php

@@ -1866,7 +1866,9 @@ class SiteController extends ActionController
 
         $pages = $this->otPageRepository->getPageWithSubpages($rootUid);
 
-        $this->connectionPool->getConnectionByName('Default')->beginTransaction();
+        $cnn = $this->connectionPool->getConnectionByName('Default');
+
+        $cnn->beginTransaction();
 
         try {
             foreach($pages as $page) {
@@ -1876,9 +1878,9 @@ class SiteController extends ActionController
                 }
             }
 
-            $this->connectionPool->getConnectionByName('Default')->commit();
+            $cnn->commit();
         } catch (\Throwable $e) {
-            $this->connectionPool->getConnectionByName('Default')->rollBack();
+            $cnn->rollBack();
             throw $e;
         }
 

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

@@ -290,14 +290,14 @@ class ApiController implements LoggerAwareInterface
 
         $rootUid = $this->siteController->deleteSiteAction($organizationId, $hard, true, true);
 
-        $this->logger->info(sprintf(
-            "OtAdmin API: The website with root uid " . $rootUid . " has been soft-deleted " .
-            " (organization: " . $organizationId . ")"));
-
         $msg = $hard ?
             "The website with root uid " . $rootUid . " has been hard-deleted." :
             "The website with root uid " . $rootUid . " has been soft-deleted. Use the /site/undelete route to restore it.";
 
+        $this->logger->info(sprintf(
+            "OtAdmin API: " . $msg . " (organization: " . $organizationId . ")")
+        );
+
         return new JsonResponse(
             [
                 'organization_id' => $organizationId,