Deltacms/core/include/update.inc.php

225 lines
11 KiB
PHP
Raw Permalink Normal View History

2022-01-31 09:10:49 +01:00
<?php
/**
* Mises à jour suivant les versions de DeltaCMS
*/
if ($this->getData(['core', 'dataVersion']) < 3202) {
//Forcer une mise à jour de admin.css
$this->setData(['admin', 'maj', true]);
//Forcer une mise à jour de theme.css
if (file_exists(self::DATA_DIR . '/theme.css')) unlink (self::DATA_DIR . '/theme.css');
$this->setData(['core', 'dataVersion', 3202]);
2022-01-31 09:10:49 +01:00
}
2022-03-06 13:35:21 +01:00
if ($this->getData(['core', 'dataVersion']) < 3206) {
// Mise à jour
2022-03-06 13:35:21 +01:00
$this->setData(['core', 'dataVersion', 3206]);
}
if ($this->getData(['core', 'dataVersion']) < 4001) {
$this->setData(['config', 'i18n', 'langAdmin', 'fr']);
$this->setData(['config', 'i18n', 'langBase', 'fr']);
// Copie le contenu de site/data/fr vers site/data/base puis supprime site/data/fr
if( is_dir('./site/data/fr/') ){
$this->copyDir('./site/data/fr/', './site/data/base/');
$this->removeDir('./site/data/fr/');
}
// Mise à jour
$this->setData(['core', 'dataVersion', 4001]);
}
2022-03-18 07:50:13 +01:00
if ($this->getData(['core', 'dataVersion']) < 4002) {
// Validation des statistiques
$this->setData(['config', 'statistlite', 'enable', false]);
// Mise à jour
$this->setData(['core', 'dataVersion', 4002]);
}
2022-03-21 08:32:27 +01:00
if ($this->getData(['core', 'dataVersion']) < 4101) {
$this->setData(['config', 'i18n', 'da', 'none']);
$this->setData(['config', 'i18n', 'el', 'none']);
$this->setData(['config', 'i18n', 'fi', 'none']);
$this->setData(['config', 'i18n', 'ga', 'none']);
$this->setData(['config', 'i18n', 'sv', 'none']);
$this->setData(['config', 'i18n', 'otherLangBase', '']);
// Mise à jour
$this->setData(['core', 'dataVersion', 4101]);
}
2022-03-22 08:19:03 +01:00
2022-04-20 09:25:59 +02:00
if ($this->getData(['core', 'dataVersion']) < 4104) {
$this->setData(['config', 'i18n', 'br', 'none']);
$this->setData(['config', 'i18n', 'ca', 'none']);
$this->setData(['config', 'i18n', 'co', 'none']);
$this->setData(['config', 'i18n', 'eu', 'none']);
2022-03-22 08:19:03 +01:00
// Mise à jour
2022-04-20 09:25:59 +02:00
$this->setData(['core', 'dataVersion', 4104]);
2022-03-22 08:19:03 +01:00
}
2022-05-18 07:43:01 +02:00
if ($this->getData(['core', 'dataVersion']) < 4202) {
$this->setData(['theme', 'menu', 'burgerTextColor', '#DDD']);
$this->setData(['theme', 'menu', 'burgerFontSize', '1.5em']);
2022-05-01 11:45:17 +02:00
// Mise à jour
2022-05-18 07:43:01 +02:00
$this->setData(['core', 'dataVersion', 4202]);
2022-05-01 11:45:17 +02:00
}
2022-05-30 09:05:11 +02:00
2022-10-10 09:10:39 +02:00
if ($this->getData(['core', 'dataVersion']) < 4307) {
$this->setData(['theme', 'header', 'homePageOnly', false]);
$this->setData(['theme', 'header', 'heightSelect', $this->getData(['theme', 'header', 'height']) ]);
2022-05-30 09:05:11 +02:00
// Mise à jour
2022-10-10 09:10:39 +02:00
$this->setData(['core', 'dataVersion', 4307]);
2022-05-30 09:05:11 +02:00
}
2022-11-05 09:31:32 +01:00
if ($this->getData(['core', 'dataVersion']) < 4308) {
2022-11-07 16:37:05 +01:00
$this->setData(['config', 'connect', 'captchaBot', true]);
2022-11-05 09:31:32 +01:00
$this->setData(['locale', 'captchaSimpleText', 'Je ne suis pas un robot' ]);
$this->setData(['locale', 'captchaSimpleHelp', 'Cochez cette case pour prouver que vous n\'êtes pas un robot' ]);
$this->deleteData([ 'config', 'connect', 'captchaStrong' ]);
$this->deleteData([ 'config', 'connect', 'captchaType' ]);
// Mise à jour
$this->setData(['core', 'dataVersion', 4308]);
}
2022-11-07 16:37:05 +01:00
if ($this->getData(['core', 'dataVersion']) < 4401) {
$userIdsFirstnames = helper::arrayCollumn($this->getData(['user']), 'firstname');
foreach($userIdsFirstnames as $userId => $userFirstname) {
if ($this->getData(['user', $userId, 'group']) >= 2) {
$this->setData(['user', $userId, 'group', $this->getData(['user', $userId, 'group']) +1 ]);
}
}
2022-11-26 07:33:04 +01:00
$this->setData(['theme', 'menu', 'minWidthTab', 'auto']);
$this->setData(['theme', 'menu', 'minWidthParentOrAll', true]);
$this->setData(['theme', 'update', false]);
2022-11-07 16:37:05 +01:00
// Mise à jour
$this->setData(['core', 'dataVersion', 4401]);
}
2022-12-03 09:33:34 +01:00
2022-12-18 12:06:32 +01:00
if ($this->getData(['core', 'dataVersion']) < 4403) {
$this->setData(['theme', 'header', 'swiperImagesDir', '']);
$this->setData(['theme', 'header', 'swiperContent', '']);
$this->setData(['theme', 'header', 'swiperEffects', 'fade']);
$this->setData(['theme', 'header', 'swiperDirection', false]);
$this->setData(['theme', 'header', 'swiperTime', '2000']);
$this->setData(['theme', 'header', 'swiperTransition', '1000']);
$this->setData(['config', 'connect', 'passwordVisibility', false]);
2023-01-06 07:35:48 +01:00
if( $this->getData(['theme', 'footer', 'copyrightPosition']) === 'center') $this->setData(['theme', 'footer', 'copyrightPosition', 'mcenter']);
if( $this->getData(['theme', 'footer', 'textPosition']) === 'center') $this->setData(['theme', 'footer', 'textPosition', 'mcenter']);
if( $this->getData(['theme', 'footer', 'socialsPosition']) === 'center') $this->setData(['theme', 'footer', 'socialsPosition', 'mcenter']);
2022-12-03 09:33:34 +01:00
// Mise à jour
2022-12-18 12:06:32 +01:00
$this->setData(['core', 'dataVersion', 4403]);
2022-12-03 09:33:34 +01:00
}
2023-01-09 11:20:32 +01:00
if ($this->getData(['core', 'dataVersion']) < 4404) {
2023-01-09 11:50:59 +01:00
if( $this->getData(['theme', 'site', 'width']) === '750px') $this->setData(['theme', 'site', 'width', '75vw']);
if( $this->getData(['theme', 'site', 'width']) === '960px') $this->setData(['theme', 'site', 'width', '85vw']);
if( $this->getData(['theme', 'site', 'width']) === '1170px') $this->setData(['theme', 'site', 'width', '95vw']);
2023-01-09 11:20:32 +01:00
// Mise à jour
$this->setData(['core', 'dataVersion', 4404]);
}
2023-03-22 14:54:21 +01:00
if ($this->getData(['core', 'dataVersion']) < 4406) {
if( ! file_exists(self::DATA_DIR . 'session.json')) file_put_contents(self::DATA_DIR . 'session.json', '{}');
$this->setData(['theme', 'footer', 'displayWhois', false]);
$this->setData(['theme', 'menu', 'widthLogo', '30px' ]);
$this->setData(['theme', 'menu', 'heightLogo', 'auto' ]);
2023-02-02 11:50:05 +01:00
// Mise à jour
2023-03-22 14:54:21 +01:00
$this->setData(['core', 'dataVersion', 4406]);
2023-02-02 11:50:05 +01:00
}
2023-06-07 09:04:57 +02:00
if ($this->getData(['core', 'dataVersion']) < 4407) {
// Mise à jour
2023-06-07 09:04:57 +02:00
$this->setData(['core', 'dataVersion', 4407]);
}
if ($this->getData(['core', 'dataVersion']) < 4501) {
// Mise à jour
2023-06-11 16:55:49 +02:00
if( $this->getData(['theme', 'menu', 'burgerContent' ]) === 'logo') $this->setData(['theme', 'menu', 'burgerContent', 'oneIcon' ]);
$this->setData(['theme', 'menu', 'burgerFixed', $this->getData(['theme', 'menu', 'fixed' ]) ]);
$this->setData(['theme', 'menu', 'burgerBannerColor', $this->getData(['theme', 'menu', 'backgroundColor' ]) ]);
$this->setData(['theme', 'menu', 'burgerIconBgColor', $this->getData(['theme', 'menu', 'backgroundColor' ]) ]);
$this->setData(['theme', 'menu', 'burgerIconColor', $this->getData(['theme', 'menu', 'textColor' ]) ]);
$this->setData(['theme', 'menu', 'burgerTextMenuColor', $this->getData(['theme', 'menu', 'textColor' ]) ]);
$this->setData(['theme', 'menu', 'burgerActiveTextColor', $this->getData(['theme', 'menu', 'activeTextColor' ]) ]);
$this->setData(['theme', 'menu', 'burgerBackgroundColor', $this->getData(['theme', 'menu', 'backgroundColor' ]) ]);
$this->setData(['theme', 'menu', 'burgerBackgroundColorSub', $this->getData(['theme', 'menu', 'backgroundColorSub' ]) ]);
$this->setData(['theme', 'menu', 'burgerActiveColorAuto', $this->getData(['theme', 'menu', 'activeColorAuto' ]) ]);
$this->setData(['theme', 'menu', 'burgerActiveColor', $this->getData(['theme', 'menu', 'activeColor' ]) ]);
$this->setData(['theme', 'menu', 'burgerIconLink1', '' ]);
$this->setData(['theme', 'menu', 'burgerIconLink2', '' ]);
$this->setData(['theme', 'menu', 'burgerIcon1', $this->getData(['theme', 'menu','burgerLogo']) ]);
$this->setData(['theme', 'menu', 'burgerIcon2', '' ]);
2023-06-28 11:33:46 +02:00
$this->setData(['theme', 'menu', 'burgerOverlay', false ]);
2023-06-11 16:55:49 +02:00
$this->deleteData(['theme', 'menu', 'burgerLogo']);
$this->deleteData(['theme', 'menu', 'heightLogo']);
$this->deleteData(['theme', 'menu', 'widthLogo']);
2023-10-04 11:44:03 +02:00
$this->setData([ 'theme', 'update', true]);
2023-08-27 10:33:56 +02:00
$this->setData(['config', 'i18n', 'scriptGoogle', false]);
$this->setData(['config', 'i18n', 'showCredits', false]);
$this->setData(['config', 'i18n', 'autoDetect', false]);
2023-09-01 16:31:56 +02:00
switch ( $this->getData(['config', 'i18n', 'langAdmin']) ){
case 'fr':
$groupWhoIs = [ 0=>'Visiteur', 1=>'Membre', 2=>'Editeur', 3=>'Modérateur', 4=>'Administrateur' ];
break;
case 'en':
$groupWhoIs = [ 0=>'Visitor', 1=>'Member', 2=>'Editor', 3=>'Moderator', 4=>'Administrator' ];
break;
case 'es':
$groupWhoIs = [ 0=>'Visitante', 1=>'Miembro', 2=>'Editor', 3=>'Moderador', 4=>'Administrador' ];
break;
}
$this->setData(['locale', 'visitorLabel', $groupWhoIs[0] ]);
$this->setData(['locale', 'memberLabel', $groupWhoIs[1] ]);
$this->setData(['locale', 'editorLabel', $groupWhoIs[2] ]);
$this->setData(['locale', 'moderatorLabel', $groupWhoIs[3] ]);
$this->setData(['locale', 'administratorLabel', $groupWhoIs[4] ]);
2023-09-18 09:00:34 +02:00
if( is_file('./site/data/body.inc.html')) rename('./site/data/body.inc.html', './site/data/body.inc.php' );
if( is_file('./site/data/head.inc.html')) rename('./site/data/head.inc.html', './site/data/head.inc.php' );
2023-06-07 09:04:57 +02:00
$this->setData(['core', 'dataVersion', 4501]);
}
2023-10-13 08:22:34 +02:00
if ($this->getData(['core', 'dataVersion']) < 4502) {
// Déplacement et renommage des variables Burger Icon Link
$this->setData(['locale', 'menuBurger', [
'burgerLeftIconLink' => $this->getData(['theme', 'menu','burgerIconLink1']) ,
'burgerCenterIconLink' => $this->getData(['theme', 'menu','burgerIconLink2'])
]]);
$this->deleteData(['theme', 'menu', 'burgerIconLink1']);
$this->deleteData(['theme', 'menu', 'burgerIconLink2']);
$this->setData(['core', 'dataVersion', 4502]);
2023-10-13 08:47:00 +02:00
}
2024-02-02 17:15:18 +01:00
if ($this->getData(['core', 'dataVersion']) < 5001) {
2024-02-08 09:14:45 +01:00
$this->setData([ 'config', 'social', 'comment', 'group', '']);
$this->setData([ 'config', 'social', 'comment', 'user', '']);
$this->setData([ 'config', 'social', 'comment', 'subject', '']);
$this->setData([ 'config', 'social', 'comment', 'captcha', true]);
$this->setData([ 'config', 'social', 'comment', 'nbItemPage', '3']);
copy ('core/module/install/ressource/database_fr/base/comment.json', self::DATA_DIR . 'base' . '/comment.json');
$this->setData(['locale', 'pageComment', 'writeComment', 'Ecrire un commentaire']);
$this->setData(['locale', 'pageComment', 'commentName', 'Nom ou pseudo']);
$this->setData(['locale', 'pageComment', 'comment', 'Commentaire']);
$this->setData(['locale', 'pageComment', 'submit', 'Envoyer']);
$this->setData(['locale', 'pageComment', 'link', ', le']);
$this->setData(['locale', 'pageComment', 'page', 'Page']);
2024-02-08 09:14:45 +01:00
foreach( $this->getData(['config', 'i18n']) as $key => $value){
if( $value === 'site') copy ('core/module/install/ressource/database_fr/base/comment.json', self::DATA_DIR . $key . '/comment.json');
}
2024-02-02 17:15:18 +01:00
$this->setData(['core', 'dataVersion', 5001]);
2023-11-02 10:00:23 +01:00
}
2024-02-24 08:56:08 +01:00
if ($this->getData(['core', 'dataVersion']) < 5002) {
// Nouveau dossier site/data/.../data_module
// Tableau des langues installées sauf base
$tabLanguages = [];
foreach (self::$i18nList as $key => $value) {
if ($this->getData(['config','i18n', $key]) === 'site' && $key !== $this->getData(['config','i18n', 'langBase'])) {
$tabLanguages[$key] = $value;
}
}
mkdir (self::DATA_DIR .'base/data_module', 0755);
foreach( $tabLanguages as $key => $value){
mkdir (self::DATA_DIR .$key.'/data_module', 0755);
}
2024-02-24 08:56:08 +01:00
$this->setData(['core', 'dataVersion', 5002]);
}
2024-03-26 07:58:04 +01:00
if ($this->getData(['core', 'dataVersion']) < 5003) {
2024-04-25 12:30:02 +02:00
// Label initial de la checkbox rgpdCheck
include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_config.php');
$this->setData(['locale', 'questionnaireAccept', $text['core_config_view']['locale'][62]]);
2024-03-26 07:58:04 +01:00
$this->setData(['core', 'dataVersion', 5003]);
}
2024-04-25 17:37:15 +02:00
if ($this->getData(['core', 'dataVersion']) < 5100) {
$this->setData(['core', 'dataVersion', 5100]);
}
2022-01-31 09:10:49 +01:00
?>