diff --git a/core/lib/Thelia/Config/Resources/form.xml b/core/lib/Thelia/Config/Resources/form.xml
index 7cfd5ce34..f24363b65 100644
--- a/core/lib/Thelia/Config/Resources/form.xml
+++ b/core/lib/Thelia/Config/Resources/form.xml
@@ -1,129 +1,132 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml
index 267bb2008..17ce2c9ab 100644
--- a/core/lib/Thelia/Config/Resources/routing/admin.xml
+++ b/core/lib/Thelia/Config/Resources/routing/admin.xml
@@ -1000,6 +1000,14 @@
Thelia\Controller\Admin\AdvancedConfigurationController::flushCacheAction
+
+ Thelia\Controller\Admin\AdvancedConfigurationController::flushAssetsAction
+
+
+
+ Thelia\Controller\Admin\AdvancedConfigurationController::flushImagesAndDocumentsAction
+
+
diff --git a/core/lib/Thelia/Controller/Admin/AdvancedConfigurationController.php b/core/lib/Thelia/Controller/Admin/AdvancedConfigurationController.php
index 394931f2b..179c64183 100644
--- a/core/lib/Thelia/Controller/Admin/AdvancedConfigurationController.php
+++ b/core/lib/Thelia/Controller/Admin/AdvancedConfigurationController.php
@@ -16,8 +16,12 @@ use Thelia\Core\Event\Cache\CacheEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Security\AccessManager;
use Thelia\Core\Security\Resource\AdminResources;
+use Thelia\Form\Cache\AssetsFlushForm;
use Thelia\Form\Cache\CacheFlushForm;
+use Thelia\Form\Cache\ImagesAndDocumentsCacheFlushForm;
use Thelia\Form\Exception\FormValidationException;
+use Thelia\Log\Tlog;
+use Thelia\Model\ConfigQuery;
/**
* Class CacheController
@@ -49,12 +53,53 @@ class AdvancedConfigurationController extends BaseAdminController
$event = new CacheEvent($this->container->getParameter("kernel.cache_dir"));
$this->dispatch(TheliaEvents::CACHE_CLEAR, $event);
+ } catch (\Exception $e) {
+ Tlog::getInstance()->addError(sprintf("Flush cache error: %s", $e->getMessage()));
+ }
+
+ $this->redirectToRoute('admin.configuration.advanced');
+ }
+
+ public function flushAssetsAction()
+ {
+ if (null !== $result = $this->checkAuth(AdminResources::ADVANCED_CONFIGURATION, [], AccessManager::UPDATE)) {
+ return $result;
+ }
+
+ $form = new AssetsFlushForm($this->getRequest());
+ try {
+ $this->validateForm($form);
+
$event = new CacheEvent(THELIA_WEB_DIR . "assets");
$this->dispatch(TheliaEvents::CACHE_CLEAR, $event);
- $this->redirectToRoute('admin.configuration.advanced');
- } catch (FormValidationException $e) {
-
+ } catch (\Exception $e) {
+ Tlog::getInstance()->addError(sprintf("Flush assets error: %s", $e->getMessage()));
}
+
+ $this->redirectToRoute('admin.configuration.advanced');
+ }
+
+ public function flushImagesAndDocumentsAction()
+ {
+ if (null !== $result = $this->checkAuth(AdminResources::ADVANCED_CONFIGURATION, [], AccessManager::UPDATE)) {
+ return $result;
+ }
+
+ $form = new ImagesAndDocumentsCacheFlushForm($this->getRequest());
+ try {
+ $this->validateForm($form);
+
+ $event = new CacheEvent(THELIA_WEB_DIR . ConfigQuery::read('image_cache_dir_from_web_root', 'cache'));
+ $this->dispatch(TheliaEvents::CACHE_CLEAR, $event);
+
+ $event = new CacheEvent(THELIA_WEB_DIR . ConfigQuery::read('document_cache_dir_from_web_root', 'cache'));
+ $this->dispatch(TheliaEvents::CACHE_CLEAR, $event);
+
+ } catch (\Exception $e) {
+ Tlog::getInstance()->addError(sprintf("Flush images and document error: %s", $e->getMessage()));
+ }
+
+ $this->redirectToRoute('admin.configuration.advanced');
}
}
diff --git a/core/lib/Thelia/Form/Cache/AssetsFlushForm.php b/core/lib/Thelia/Form/Cache/AssetsFlushForm.php
new file mode 100644
index 000000000..4847208f9
--- /dev/null
+++ b/core/lib/Thelia/Form/Cache/AssetsFlushForm.php
@@ -0,0 +1,40 @@
+
+ */
+class AssetsFlushForm extends BaseForm
+{
+
+ /**
+ * @inheritdoc
+ */
+ protected function buildForm()
+ {
+ //Nothing, we just want CSRF protection
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getName()
+ {
+ return "assets_flush";
+ }
+}
diff --git a/core/lib/Thelia/Form/Cache/CacheFlushForm.php b/core/lib/Thelia/Form/Cache/CacheFlushForm.php
index 56db814f5..b68b418f9 100644
--- a/core/lib/Thelia/Form/Cache/CacheFlushForm.php
+++ b/core/lib/Thelia/Form/Cache/CacheFlushForm.php
@@ -23,24 +23,7 @@ class CacheFlushForm extends BaseForm
{
/**
- *
- * in this function you add all the fields you need for your Form.
- * Form this you have to call add method on $this->formBuilder attribute :
- *
- * $this->formBuilder->add("name", "text")
- * ->add("email", "email", array(
- * "attr" => array(
- * "class" => "field"
- * ),
- * "label" => "email",
- * "constraints" => array(
- * new \Symfony\Component\Validator\Constraints\NotBlank()
- * )
- * )
- * )
- * ->add('age', 'integer');
- *
- * @return null
+ * @inheritdoc
*/
protected function buildForm()
{
@@ -48,7 +31,7 @@ class CacheFlushForm extends BaseForm
}
/**
- * @return string the name of you form. This name must be unique
+ * @inheritdoc
*/
public function getName()
{
diff --git a/core/lib/Thelia/Form/Cache/ImagesAndDocumentsCacheFlushForm.php b/core/lib/Thelia/Form/Cache/ImagesAndDocumentsCacheFlushForm.php
new file mode 100644
index 000000000..ef29944e9
--- /dev/null
+++ b/core/lib/Thelia/Form/Cache/ImagesAndDocumentsCacheFlushForm.php
@@ -0,0 +1,40 @@
+
+ */
+class ImagesAndDocumentsCacheFlushForm extends BaseForm
+{
+
+ /**
+ * @inheritdoc
+ */
+ protected function buildForm()
+ {
+ //Nothing, we just want CSRF protection
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getName()
+ {
+ return "images_and_documents_cache_flush";
+ }
+}
diff --git a/templates/backOffice/default/I18n/fr_FR.php b/templates/backOffice/default/I18n/fr_FR.php
index 1e03c5246..870f27507 100755
--- a/templates/backOffice/default/I18n/fr_FR.php
+++ b/templates/backOffice/default/I18n/fr_FR.php
@@ -51,6 +51,7 @@ return array(
'Administration profiles' => 'Profils d\'administration',
'Administrators' => 'Administrateurs',
'Advanced configuration' => 'Configuration avancée',
+ 'Advanced configuration and tools' => 'Outils et configuration avancés',
'Afficher ce profil' => 'Afficher ce profil',
'All countries are assigned to a shipping zone.' => 'Tous les pays sont assignés à une zone de livraison.',
'All orders' => 'Toutes les commandes',
@@ -82,7 +83,6 @@ return array(
'Browse files' => 'Parcourir les fichiers',
'Browse this category' => 'Parcourir cette catégorie',
'Browse this folder' => 'Parcourir ce dossier',
- 'Cache' => 'Cache',
'Can\'t be cumulative' => 'Ne peut pas se cumuler',
'Can\'t load documents, please refresh this page.' => 'Impossible de charger les documents. Rechargez la page',
'Can\'t load images, please refresh this page.' => 'Impossible de charger l\'image. Rechargez la page',
@@ -474,7 +474,8 @@ return array(
'FirstName' => 'Prénom',
'Firstname' => 'Prénom',
'Flush the Thelia internal cache' => 'Vider le cache interne de Thelia',
- 'Flush the cache now' => 'Vider le cache maintenant',
+ 'Flush the assets cache directory' => 'Vider le cache des assets web',
+ 'Flush the images and documents cache' => 'Vider le caches des images et documents',
'Folder created on %date_create. Last modification: %date_change' => 'Dossier créé le %date_create. Dernière modification le %date_change',
'Folder title' => 'Titre du dossier',
'Folders' => 'Dossiers',
@@ -829,6 +830,7 @@ return array(
'Thelia Shipping configuration' => 'Configuration des livraisons Thelia',
'Thelia Shipping zones' => 'Zone de livraison de Thelia',
'Thelia System Variables' => 'Variables Thelia',
+ 'Thelia caches flushing' => 'Vidage des caches Thelia',
'Thelia configuration' => 'Configuration thelia',
'Thelia contributions' => 'Contributions de Thelia',
'Thelia core' => 'Coeur de Thelia',
@@ -861,6 +863,7 @@ return array(
'This is the message purpose, such as \'Order confirmation\'.' => 'Titre du message (ex : confirmation de commande)',
'This is the subject of the e-mail, such as \'Your order is confirmed\'.' => 'Sujet du message (ex : votre commande est validée)',
'This mailing template could not be changed.' => 'Le template de mailing ne peut pas être changé',
+ 'This module cannot be started, some files are probably missing.' => 'Ce module ne peut pas être démarré, il manque sans doute des fichiers.',
'This month' => 'Ce mois',
'This product contains no accessories' => 'Ce produit n\'a aucun accessoire',
'This product contains no contents' => 'Ce produit n\'a aucun contenu associé',
diff --git a/templates/backOffice/default/advanced-configuration.html b/templates/backOffice/default/advanced-configuration.html
index cc79c3352..ef21fad37 100644
--- a/templates/backOffice/default/advanced-configuration.html
+++ b/templates/backOffice/default/advanced-configuration.html
@@ -1,6 +1,6 @@
{extends file="admin-layout.tpl"}
-{block name="page-title"}{intl l='Cache'}{/block}
+{block name="page-title"}{intl l='Advanced configuration'}{/block}
{block name="check-resource"}admin.cache{/block}
{block name="check-access"}view{/block}
@@ -13,31 +13,56 @@
-
-
+
+
+
- {intl l='Advanced configuration'}
+ {intl l='Thelia caches flushing'}
+
+
+
+
+
+ {form name="thelia.cache.flush"}
+
+ {/form}
-