forked from ZwiiCMS-Team/ZwiiCMS
2 bugs de thème : import admin et nettoyage tmp
This commit is contained in:
parent
8a66c3d1ae
commit
ec59a0c77c
@ -1,8 +1,10 @@
|
||||
# Changelog
|
||||
|
||||
## version 10.3.04
|
||||
- Correction :
|
||||
- Corrections :
|
||||
- Position des entrées de menu sur les écrans de smartphone.
|
||||
- Thème : import d'un thème, d'administration impossible.
|
||||
- Thème : import d'un thème, nettoyage du dossier tmp.
|
||||
|
||||
## version 10.3.03
|
||||
- Correction :
|
||||
|
@ -1022,6 +1022,17 @@ class common {
|
||||
$db->save;
|
||||
}
|
||||
|
||||
/**
|
||||
* Effacer un dossier non vide.
|
||||
* @param string URL du dossier à supprimer
|
||||
*/
|
||||
public function removeDir ( $path ) {
|
||||
foreach ( new DirectoryIterator($path) as $item ):
|
||||
if ( $item->isFile() ) unlink($item->getRealPath());
|
||||
if ( !$item->isDot() && $item->isDir() ) $this->removeDir($item->getRealPath());
|
||||
endforeach;
|
||||
rmdir($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mises à jour
|
||||
|
@ -18,8 +18,7 @@ class install extends common {
|
||||
public static $actions = [
|
||||
'index' => self::GROUP_VISITOR,
|
||||
'steps' => self::GROUP_ADMIN,
|
||||
'update' => self::GROUP_ADMIN,
|
||||
'removeAll' => self::GROUP_ADMIN
|
||||
'update' => self::GROUP_ADMIN
|
||||
];
|
||||
|
||||
|
||||
@ -253,16 +252,5 @@ class install extends common {
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Effacer un dossier non vide.
|
||||
*/
|
||||
private function removeAll ( $path ) {
|
||||
foreach ( new DirectoryIterator($path) as $item ):
|
||||
if ( $item->isFile() ) unlink($item->getRealPath());
|
||||
if ( !$item->isDot() && $item->isDir() ) $this->removeAll($item->getRealPath());
|
||||
endforeach;
|
||||
|
||||
rmdir($path);
|
||||
}
|
||||
|
||||
}
|
@ -616,16 +616,19 @@ class theme extends common {
|
||||
mkdir (self::TEMP_DIR . $tempFolder);
|
||||
$zip->extractTo(self::TEMP_DIR . $tempFolder );
|
||||
// Archive de thème ?
|
||||
if ( file_exists(self::TEMP_DIR . $tempFolder . '/site/data/custom.css')
|
||||
AND file_exists(self::TEMP_DIR . $tempFolder . '/site/data/theme.css')
|
||||
AND file_exists(self::TEMP_DIR . $tempFolder . '/site/data/theme.json') ) {
|
||||
if (( file_exists(self::TEMP_DIR . $tempFolder . '/site/data/custom.css')
|
||||
AND file_exists(self::TEMP_DIR . $tempFolder . '/site/data/theme.css')
|
||||
AND file_exists(self::TEMP_DIR . $tempFolder . '/site/data/theme.json')
|
||||
) OR (
|
||||
file_exists(self::TEMP_DIR . $tempFolder . '/site/data/admin.json')
|
||||
)
|
||||
) {
|
||||
// traiter l'archive
|
||||
$success = $zip->extractTo('.');
|
||||
// traitement de l'erreur
|
||||
$notification = $success ? 'Le thème a été importé' : 'Erreur lors de l\'extraction, vérifiez les permissions.';
|
||||
// Supprimmer le dossier temporaire
|
||||
$install = new install;
|
||||
$install->removeAll(self::TEMP_DIR . $tempFolder);
|
||||
$this->removeDir(self::TEMP_DIR . $tempFolder);
|
||||
} else {
|
||||
// pas une archive de thème
|
||||
$success = false;
|
||||
|
Loading…
Reference in New Issue
Block a user