[10.0.021.dev] Conversion baseURL ok
This commit is contained in:
parent
f19094ba48
commit
7183d0158f
@ -34,7 +34,7 @@ class common {
|
|||||||
const TEMP_DIR = 'site/tmp/';
|
const TEMP_DIR = 'site/tmp/';
|
||||||
|
|
||||||
// Numéro de version
|
// Numéro de version
|
||||||
const ZWII_VERSION = '10.0.020.dev';
|
const ZWII_VERSION = '10.0.021.dev';
|
||||||
|
|
||||||
public static $actions = [];
|
public static $actions = [];
|
||||||
public static $coreModuleIds = [
|
public static $coreModuleIds = [
|
||||||
|
@ -473,46 +473,36 @@ class config extends common {
|
|||||||
*/
|
*/
|
||||||
public function updateBaseUrl () {
|
public function updateBaseUrl () {
|
||||||
// Récuperer les données
|
// Récuperer les données
|
||||||
// Les contrôles ont été effectués sur la page de formulaire
|
// Supprimer l'information de redirection
|
||||||
$old = $this->getData(['core', 'baseUrl']);
|
//$old = str_replace('?','',$this->getData(['core', 'baseUrl']));
|
||||||
$oldCheckRw = strpos($old,'/?') > 0 ? false : true;
|
$old = str_replace('?','',$this->getData(['core', 'baseUrl']));
|
||||||
$new = helper::baseUrl(true,false);
|
$new = helper::baseUrl(false,false);
|
||||||
$newCheckRw = strpos($new,'/?') > 0 ? false : true;
|
$success = false ;
|
||||||
var_dump($oldCheckRw);
|
|
||||||
echo "-";
|
|
||||||
echo strpos($new,'?') ;
|
|
||||||
var_dump($newCheckRw);
|
|
||||||
die();
|
|
||||||
// Boucler sur les pages
|
// Boucler sur les pages
|
||||||
foreach($this->getHierarchy(null,null,null) as $parentId => $childIds) {
|
foreach($this->getHierarchy(null,null,null) as $parentId => $childIds) {
|
||||||
$content = $this->getData(['page',$parentId,'content']);
|
$content = $this->getData(['page',$parentId,'content']);
|
||||||
if ($oldCheckRw === helper::checkRewrite() ||
|
$replace = str_replace( $old , $new , stripslashes($content),$count) ;
|
||||||
($oldCheckRw === false && helper::checkRewrite() === true)
|
if ($count > 0) {
|
||||||
) {
|
$success = true;
|
||||||
$replace = str_replace( $old , $new , $content);
|
|
||||||
$this->setData(['page',$parentId,'content', $replace ]);
|
$this->setData(['page',$parentId,'content', $replace ]);
|
||||||
} elseif ($oldCheckRw === true && helper::checkRewrite() === false) {
|
|
||||||
die();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($childIds as $childId) {
|
foreach($childIds as $childId) {
|
||||||
$content = $this->getData(['page',$childId,'content']);
|
$content = $this->getData(['page',$childId,'content']);
|
||||||
if ($oldCheckRw === helper::checkRewrite() ||
|
$replace = str_replace( $old , $new, stripslashes($content),$count) ;
|
||||||
$oldCheckRw === false && helper::checkRewrite() === true
|
if ($count > 0) {
|
||||||
) {
|
$success = true;
|
||||||
$replace = str_replace( $old , $new , $content);
|
|
||||||
$this->setData(['page',$childId,'content', $replace ]);
|
$this->setData(['page',$childId,'content', $replace ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if ($success === true) {
|
||||||
$this->setData(['core','baseUrl',helper::baseUrl(true,false)]);
|
$this->setData(['core','baseUrl',helper::baseUrl(true,false)]);
|
||||||
|
}
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'notification' => 'Conversion effectuée',
|
'notification' => $success ? 'Conversion effectuée' : 'Aucune conversion',
|
||||||
'redirect' => helper::baseUrl() . 'config/manage',
|
'redirect' => helper::baseUrl() . 'config/manage',
|
||||||
'state' => true
|
'state' => $success ? true : false
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user