From f7799861e615db1d580a23614a6c71b2f3f35863 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Thu, 7 May 2020 15:59:23 +0200 Subject: [PATCH] 087 information sur les conversions. --- core/module/config/config.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/module/config/config.php b/core/module/config/config.php index bd6fd4ec..758d53be 100755 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -490,15 +490,18 @@ class config extends common { // Supprimer l'information de redirection $old = str_replace('?','',$this->getData(['core', 'baseUrl'])); $new = helper::baseUrl(false,false); + $c3 = 0; $success = false ; // Boucler sur les pages foreach($this->getHierarchy(null,null,null) as $parentId => $childIds) { $content = $this->getData(['page',$parentId,'content']); $replace = str_replace( 'href="' . $old , 'href="'. $new , stripslashes($content),$c1) ; $replace = str_replace( 'src="' . $old , 'src="'. $new , stripslashes($replace),$c2) ; + if ($c1 > 0 || $c2 > 0) { $success = true; $this->setData(['page',$parentId,'content', $replace ]); + $c3 += $c1 + $c2; } foreach($childIds as $childId) { $content = $this->getData(['page',$childId,'content']); @@ -507,15 +510,14 @@ class config extends common { if ($c1 > 0 || $c2 > 0) { $success = true; $this->setData(['page',$childId,'content', $replace ]); + $c3 += $c1 + c2; } } } - if ($success === true) { - $this->setData(['core','baseUrl',helper::baseUrl(true,false)]); - } + $this->setData(['core','baseUrl',helper::baseUrl(true,false)]); // Valeurs en sortie $this->addOutput([ - 'notification' => $success ? 'Conversion effectuée' : 'Aucune conversion', + 'notification' => $success ? $c3. ' conversion' . ($c3 > 1 ? 's' : '') . ' effectué' . ($c3 > 1 ? 's' : '') : 'Aucune conversion', 'redirect' => helper::baseUrl() . 'config/manage', 'state' => $success ? true : false ]);