save = false and saveDB
This commit is contained in:
parent
64443322a0
commit
9bb5793720
@ -1117,13 +1117,12 @@ class layout extends common
|
||||
$today > $checkUpdate + $this->getData(['config', 'autoUpdateDelay', 86400])
|
||||
) {
|
||||
// Dernier auto controle
|
||||
$this->setData(['core', 'lastAutoUpdate', $today]);
|
||||
$this->setData(['core', 'lastAutoUpdate', $today], false);
|
||||
if (
|
||||
helper::checkNewVersion(common::ZWII_UPDATE_CHANNEL)
|
||||
) {
|
||||
$this->setData(['core', 'updateAvailable', true]);
|
||||
$this->setData(['core', 'updateAvailable', true], false);
|
||||
}
|
||||
|
||||
// Recherche de mise à jour des modules
|
||||
$store = plugin::getStore();
|
||||
if (is_array($store)) {
|
||||
@ -1138,11 +1137,12 @@ class layout extends common
|
||||
}
|
||||
// Mise à jour d'un module
|
||||
if (array_key_exists($key, $infoModules) === true) {
|
||||
$this->setData(['core', 'updateModuleAvailable', true]);
|
||||
$this->setData(['core', 'updateModuleAvailable', true], false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sauvegarde la base manuellement
|
||||
$this->saveDB('core');
|
||||
}
|
||||
}
|
||||
// Afficher le bouton : Mise à jour détectée + activée
|
||||
|
@ -32,8 +32,6 @@ class core extends common
|
||||
}
|
||||
// Date de la dernière suppression
|
||||
$this->setData(['core', 'lastClearTmp', $lastClearTmp]);
|
||||
// Enregistre les données
|
||||
//$this->SaveData();
|
||||
}
|
||||
// Backup automatique des données
|
||||
$lastBackup = mktime(0, 0, 0);
|
||||
|
@ -158,9 +158,9 @@ class install extends common
|
||||
);
|
||||
|
||||
// Sauvegarder la configuration du Proxy
|
||||
$this->setData(['config', 'proxyType', $this->getInput('installProxyType')]);
|
||||
$this->setData(['config', 'proxyUrl', $this->getInput('installProxyUrl')]);
|
||||
$this->setData(['config', 'proxyPort', $this->getInput('installProxyPort', helper::FILTER_INT)]);
|
||||
$this->setData(['config', 'proxyType', $this->getInput('installProxyType')], false);
|
||||
$this->setData(['config', 'proxyUrl', $this->getInput('installProxyUrl')], false);
|
||||
$this->setData(['config', 'proxyPort', $this->getInput('installProxyPort', helper::FILTER_INT)], false);
|
||||
|
||||
// Images exemples livrées dans tous les cas
|
||||
try {
|
||||
|
@ -391,11 +391,13 @@ class page extends common
|
||||
$pageId = helper::increment($pageId, self::$moduleIds);
|
||||
// Met à jour les enfants
|
||||
foreach ($this->getHierarchy($this->getUrl(2), null) as $childrenPageId) {
|
||||
$this->setData(['page', $childrenPageId, 'parentPageId', $pageId]);
|
||||
$this->setData(['page', $childrenPageId, 'parentPageId', $pageId], false);
|
||||
}
|
||||
// Sauvegarde la base manuellement
|
||||
$this->saveDB('page');
|
||||
// Change l'id de page dans les données des modules
|
||||
if ($this->getData(['module', $this->getUrl(2)]) !== null) {
|
||||
$this->setData(['module', $pageId, $this->getData(['module', $this->getUrl(2)])]);
|
||||
$this->setData(['module', $pageId, $this->getData(['module', $this->getUrl(2)])], false);
|
||||
$this->deleteData(['module', $this->getUrl(2)]);
|
||||
// Renommer le dossier du module
|
||||
$moduleId = $this->getData(['page', $this->getUrl(2), 'moduleId']);
|
||||
@ -406,8 +408,10 @@ class page extends common
|
||||
copy($modulesData[$moduleId]['dataDirectory'] . $this->getUrl(2), $modulesData[$moduleId]['dataDirectory'] . $pageId);
|
||||
$this->deleteDir($modulesData[$moduleId]['dataDirectory'] . $this->getUrl(2));
|
||||
// Mettre à jour le nom de la feuille de style
|
||||
$this->setData(['module', $pageId, 'theme', 'style', $modulesData[$moduleId]['dataDirectory'] . $pageId]);
|
||||
$this->setData(['module', $pageId, 'theme', 'style', $modulesData[$moduleId]['dataDirectory'] . $pageId], false);
|
||||
}
|
||||
// Sauvegarde la base manuellement
|
||||
$this->saveDB('module');
|
||||
}
|
||||
// Met à jour les historiques des utilisateurs
|
||||
foreach ($this->getData(['enrolment', self::$siteContent]) as $userId => $userData) {
|
||||
@ -418,14 +422,17 @@ class page extends common
|
||||
) {
|
||||
// Remplacer l'ancienne ID par la nouvelle
|
||||
$datas = $this->getData(['enrolment', self::$siteContent, $userId, 'history', $this->getUrl(2)]);
|
||||
$this->setData(['enrolment', self::$siteContent, $userId, 'history', $pageId, $datas]);
|
||||
$this->setData(['enrolment', self::$siteContent, $userId, 'history', $pageId, $datas], false);
|
||||
$this->deleteData(['enrolment', self::$siteContent, $userId, 'history', $this->getUrl(2)]);
|
||||
}
|
||||
// Mettre à jour la dernière page vue si nécessaire
|
||||
if ($this->getData(['enrolment', self::$siteContent, $userId, 'lastPageView']) === $this->getUrl(2)) {
|
||||
$this->setData(['enrolment', self::$siteContent, $userId, 'lastPageView', $pageId]);
|
||||
$this->setData(['enrolment', self::$siteContent, $userId, 'lastPageView', $pageId], false);
|
||||
}
|
||||
}
|
||||
// Sauvegarde la base manuellement
|
||||
$this->saveDB('enrolment');
|
||||
|
||||
// Met à jour la homePage si nécessaire
|
||||
if ($this->getUrl(2) === $this->getData(['course', self::$siteContent, 'homePageId'])) {
|
||||
$this->setData(['course', self::$siteContent, 'homePageId', $pageId]);
|
||||
@ -433,7 +440,7 @@ class page extends common
|
||||
|
||||
// Si la page correspond à la page d'accueil, change l'id dans la configuration du site
|
||||
if ($this->getData(['config', 'homePageId']) === $this->getUrl(2)) {
|
||||
$this->setData(['config', 'homePageId', $pageId]);
|
||||
$this->setData(['config', 'homePageId', $pageId], false);
|
||||
}
|
||||
}
|
||||
// Supprime les données du module en cas de changement de module
|
||||
@ -449,20 +456,22 @@ class page extends common
|
||||
}
|
||||
// Traitement des pages spéciales affectées dans la config :
|
||||
if ($this->getUrl(2) === $this->getData(['config', 'legalPageId'])) {
|
||||
$this->setData(['config', 'legalPageId', $pageId]);
|
||||
$this->setData(['config', 'legalPageId', $pageId], false);
|
||||
}
|
||||
if ($this->getUrl(2) === $this->getData(['config', 'searchPageId'])) {
|
||||
$this->setData(['config', 'searchPageId', $pageId]);
|
||||
$this->setData(['config', 'searchPageId', $pageId], false);
|
||||
}
|
||||
if ($this->getUrl(2) === $this->getData(['config', 'page404'])) {
|
||||
$this->setData(['config', 'page404', $pageId]);
|
||||
$this->setData(['config', 'page404', $pageId], false);
|
||||
}
|
||||
if ($this->getUrl(2) === $this->getData(['config', 'page403'])) {
|
||||
$this->setData(['config', 'page403', $pageId]);
|
||||
$this->setData(['config', 'page403', $pageId], false);
|
||||
}
|
||||
if ($this->getUrl(2) === $this->getData(['config', 'page302'])) {
|
||||
$this->setData(['config', 'page302', $pageId]);
|
||||
$this->setData(['config', 'page302', $pageId], false);
|
||||
}
|
||||
// Sauvegarde la base manuellement
|
||||
$this->saveDB(module: 'config');
|
||||
// Si la page est une page enfant, actualise les positions des autres enfants du parent, sinon actualise les pages sans parents
|
||||
$lastPosition = 1;
|
||||
$hierarchy = $this->getInput('pageEditParentPageId') ? $this->getHierarchy($this->getInput('pageEditParentPageId')) : array_keys($this->getHierarchy());
|
||||
@ -481,11 +490,12 @@ class page extends common
|
||||
$lastPosition++;
|
||||
}
|
||||
// Change la position
|
||||
$this->setData(['page', $hierarchyPageId, 'position', $lastPosition]);
|
||||
$this->setData(['page', $hierarchyPageId, 'position', $lastPosition], false);
|
||||
// Incrémente pour la prochaine position
|
||||
$lastPosition++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->getinput('pageEditBlock') !== 'bar') {
|
||||
$barLeft = $this->getinput('pageEditBarLeft');
|
||||
$barRight = $this->getinput('pageEditBarRight');
|
||||
@ -506,7 +516,7 @@ class page extends common
|
||||
) {
|
||||
foreach ($this->getHierarchy($pageId) as $parentId => $childId) {
|
||||
if ($this->getData(['page', $childId, 'parentPageId']) === $pageId) {
|
||||
$this->setData(['page', $childId, 'position', 0]);
|
||||
$this->setData(['page', $childId, 'position', 0], false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -515,17 +525,17 @@ class page extends common
|
||||
if ($this->getinput('pageEditBlock') === 'bar') {
|
||||
foreach ($this->getHierarchy() as $eachPageId => $parentId) {
|
||||
if ($this->getData(['page', $eachPageId, 'barRight']) === $this->getUrl(2)) {
|
||||
$this->setData(['page', $eachPageId, 'barRight', $pageId]);
|
||||
$this->setData(['page', $eachPageId, 'barRight', $pageId], false);
|
||||
}
|
||||
if ($this->getData(['page', $eachPageId, 'barLeft']) === $this->getUrl(2)) {
|
||||
$this->setData(['page', $eachPageId, 'barLeft', $pageId]);
|
||||
$this->setData(['page', $eachPageId, 'barLeft', $pageId], false);
|
||||
}
|
||||
foreach ($parentId as $childId) {
|
||||
if ($this->getData(['page', $childId, 'barRight']) === $this->getUrl(2)) {
|
||||
$this->setData(['page', $childId, 'barRight', $pageId]);
|
||||
$this->setData(['page', $childId, 'barRight', $pageId], false);
|
||||
}
|
||||
if ($this->getData(['page', $childId, 'barLeft']) === $this->getUrl(2)) {
|
||||
$this->setData(['page', $childId, 'barLeft', $pageId]);
|
||||
$this->setData(['page', $childId, 'barLeft', $pageId], false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -507,21 +507,23 @@ class theme extends common
|
||||
'featureContent' => $featureContent,
|
||||
'featureFiles' => $files
|
||||
]
|
||||
]);
|
||||
], false);
|
||||
// Modification de la position du menu selon la position de la bannière
|
||||
if ($this->getData(['theme', 'header', 'position']) == 'site') {
|
||||
$this->setData(['theme', 'menu', 'position', str_replace('body-', 'site-', $this->getData(['theme', 'menu', 'position']))]);
|
||||
$this->setData(['theme', 'menu', 'position', str_replace('body-', 'site-', $this->getData(['theme', 'menu', 'position']))], false);
|
||||
}
|
||||
if ($this->getData(['theme', 'header', 'position']) == 'body') {
|
||||
$this->setData(['theme', 'menu', 'position', str_replace('site-', 'body-', $this->getData(['theme', 'menu', 'position']))]);
|
||||
$this->setData(['theme', 'menu', 'position', str_replace('site-', 'body-', $this->getData(['theme', 'menu', 'position']))], false);
|
||||
}
|
||||
// Menu accroché à la bannière qui devient cachée
|
||||
if (
|
||||
$this->getData(['theme', 'header', 'position']) == 'hide' &&
|
||||
in_array($this->getData(['theme', 'menu', 'position']), ['body-first', 'site-first', 'body-first', 'site-second'])
|
||||
) {
|
||||
$this->setData(['theme', 'menu', 'position', 'site']);
|
||||
$this->setData(['theme', 'menu', 'position', 'site'], false);
|
||||
}
|
||||
// Sauvegarde la base manuellement
|
||||
$this->saveDB(module: 'theme');
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => helper::translate('Modifications enregistrées'),
|
||||
@ -636,11 +638,11 @@ class theme extends common
|
||||
// Polices liées aux thèmes des espaces
|
||||
foreach ($this->getData(['course']) as $courseId => $courseValue) {
|
||||
$theme = json_decode(file_get_contents(self::DATA_DIR . $courseId . '/theme.json'), true);
|
||||
$fonts['Bannière ('. $courseId .')'] = $theme['theme']['header']['font'];
|
||||
$fonts['Menu ('. $courseId .')'] = $theme['theme']['menu']['font'];
|
||||
$fonts['Titre ('. $courseId .')'] = $theme['theme']['title']['font'];
|
||||
$fonts['Texte ('. $courseId .')'] = $theme['theme']['text']['font'];
|
||||
$fonts['Pied de page ('. $courseId .')'] = $theme['theme']['footer']['font'];
|
||||
$fonts['Bannière (' . $courseId . ')'] = $theme['theme']['header']['font'];
|
||||
$fonts['Menu (' . $courseId . ')'] = $theme['theme']['menu']['font'];
|
||||
$fonts['Titre (' . $courseId . ')'] = $theme['theme']['title']['font'];
|
||||
$fonts['Texte (' . $courseId . ')'] = $theme['theme']['text']['font'];
|
||||
$fonts['Pied de page (' . $courseId . ')'] = $theme['theme']['footer']['font'];
|
||||
}
|
||||
|
||||
// Récupérer le détail des fontes installées
|
||||
@ -658,7 +660,7 @@ class theme extends common
|
||||
if (is_array($typeValue)) {
|
||||
foreach ($typeValue as $fontId => $fontValue) {
|
||||
// Recherche les correspondances
|
||||
$result = array_filter($fonts, function($value) use ($fontId) {
|
||||
$result = array_filter($fonts, function ($value) use ($fontId) {
|
||||
return $value == $fontId;
|
||||
});
|
||||
$keyResults = array_keys($result);
|
||||
@ -929,7 +931,7 @@ class theme extends common
|
||||
'fontWeight' => $this->getInput('themeTitleFontWeight'),
|
||||
'textTransform' => $this->getInput('themeTitleTextTransform')
|
||||
]
|
||||
]);
|
||||
], false);
|
||||
$this->setData([
|
||||
'theme',
|
||||
'text',
|
||||
@ -939,7 +941,7 @@ class theme extends common
|
||||
'textColor' => $this->getInput('themeTextTextColor'),
|
||||
'linkColor' => $this->getInput('themeTextLinkColor')
|
||||
]
|
||||
]);
|
||||
], false);
|
||||
$this->setData([
|
||||
'theme',
|
||||
'site',
|
||||
@ -950,14 +952,14 @@ class theme extends common
|
||||
'width' => $this->getInput('themeSiteWidth'),
|
||||
'margin' => $this->getInput('themeSiteMargin', helper::FILTER_BOOLEAN)
|
||||
]
|
||||
]);
|
||||
], false);
|
||||
$this->setData([
|
||||
'theme',
|
||||
'button',
|
||||
[
|
||||
'backgroundColor' => $this->getInput('themeButtonBackgroundColor')
|
||||
]
|
||||
]);
|
||||
], false);
|
||||
$this->setData([
|
||||
'theme',
|
||||
'block',
|
||||
|
@ -1384,14 +1384,13 @@ class user extends common
|
||||
]);
|
||||
}
|
||||
}
|
||||
// Sauvegarde la base manuellement
|
||||
$this->saveDB(module: 'user');
|
||||
}
|
||||
|
||||
// Journalisation
|
||||
$this->saveLog($logStatus);
|
||||
|
||||
// Sauvegarde la base manuellement
|
||||
$this->saveDB('user');
|
||||
|
||||
// Stockage des cookies
|
||||
if (!empty($_COOKIE['ZWII_USER_ID'])) {
|
||||
self::$userId = $_COOKIE['ZWII_USER_ID'];
|
||||
@ -1587,7 +1586,7 @@ class user extends common
|
||||
"accessCsrf" => null,
|
||||
'tags' => $item['tags']
|
||||
]
|
||||
]);
|
||||
], false);
|
||||
// Icône de notification
|
||||
$item['notification'] = $create ? template::ico('check') : template::ico('cancel');
|
||||
// Envoi du mail
|
||||
@ -1628,6 +1627,8 @@ class user extends common
|
||||
}
|
||||
|
||||
}
|
||||
// Sauvegarde la base manuellement
|
||||
$this->saveDB(module: 'user');
|
||||
if (empty(self::$users)) {
|
||||
$notification = helper::translate('Rien à importer, erreur de format ou fichier incorrect');
|
||||
$success = false;
|
||||
@ -1697,10 +1698,12 @@ class user extends common
|
||||
if (
|
||||
$this->getData(['user', $keyPost]) !== null
|
||||
) {
|
||||
$this->setData(['user', $keyPost, 'tags', $newTags]);
|
||||
$this->setData(['user', $keyPost, 'tags', $newTags], false);
|
||||
$count += 1;
|
||||
}
|
||||
}
|
||||
// Sauvegarde la base manuellement
|
||||
$this->saveDB(module: 'user');
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'user/tag',
|
||||
|
Loading…
Reference in New Issue
Block a user