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