Просмотр исходного кода

swallow errors on redirection errors, waiting for V8-3344

Olivier Massot 3 лет назад
Родитель
Сommit
b4f96fa69a
1 измененных файлов с 9 добавлено и 3 удалено
  1. 9 3
      ot_admin/Classes/Controller/SiteController.php

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

@@ -770,7 +770,7 @@ class SiteController extends ActionController
             ->fetchOne() === 1;
 
         $confirm_file = $_ENV['TYPO3_PATH_APP'] . "/DEL" . $organizationId;
-        if (!$force && $hard && !file_exists($confirm_file)) {
+        if ($hard && !$force && !file_exists($confirm_file)) {
             throw new RuntimeException(
                 "You are going to completely delete the website with root uid " . $rootUid .
                 ", and all of its pages, files, contents...etc. If you are sure, create a file named '" .
@@ -933,7 +933,9 @@ class SiteController extends ActionController
 
             // Add the redirection
             if ($redirectToParent) {
-                $this->addRedirection($originDomain, $targetDomain);
+                try {
+                    $this->addRedirection($originDomain, $targetDomain);
+                } catch (RuntimeException $e) {} // silent the error until this https://assistance.opentalent.fr/browse/V8-3344
             }
 
             // Try to commit the result
@@ -1382,7 +1384,9 @@ class SiteController extends ActionController
 
         if ($redirect) {
             // Add the redirection
-            $this->addRedirection($originDomain, $newDomain);
+            try {
+                $this->addRedirection($originDomain, $newDomain);
+            } catch (\RuntimeException $e) {} // silent the error until this https://assistance.opentalent.fr/browse/V8-3344
         }
 
         OtCacheManager::clearSiteCache($rootUid, true);
@@ -1445,6 +1449,7 @@ class SiteController extends ActionController
      * @param $fromDomain
      * @param $toDomain
      * @return int  Status of the operation
+     * @throws Exception
      */
     public function addRedirection($fromDomain, $toDomain): int
     {
@@ -1527,6 +1532,7 @@ class SiteController extends ActionController
      * @param $fromDomain
      * @param bool $hard
      * @return int Number of affected rows
+     * @throws Exception
      */
     public function removeRedirectionsFrom($fromDomain, bool $hard=false): int
     {