@@ -50,9 +50,8 @@ class Module extends BaseAction implements EventSubscriberInterface
|
||||
public function toggleActivation(ModuleToggleActivationEvent $event)
|
||||
{
|
||||
if (null !== $module = ModuleQuery::create()->findPk($event->getModuleId())) {
|
||||
$moduleClass = new \ReflectionClass($module->getFullNamespace());
|
||||
|
||||
$moduleInstance = $moduleClass->newInstance();
|
||||
$moduleInstance = $module->createInstance();
|
||||
|
||||
if ( method_exists($moduleInstance, 'setContainer')) {
|
||||
$moduleInstance->setContainer($this->container);
|
||||
@@ -85,12 +84,11 @@ class Module extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
|
||||
try {
|
||||
$reflected = new \ReflectionClass($module->getFullNamespace());
|
||||
$instance = $module->createInstance();
|
||||
|
||||
$instance = $reflected->newInstance();
|
||||
$instance->setContainer($this->container);
|
||||
|
||||
$path = dirname($reflected->getFileName());
|
||||
$path = $module->getAbsoluteBaseDir();
|
||||
|
||||
$instance->destroy($con, $event->getDeleteData());
|
||||
|
||||
|
||||
@@ -52,9 +52,7 @@ class ModuleActivateCommand extends BaseModuleGenerate
|
||||
}
|
||||
|
||||
try {
|
||||
$moduleReflection = new \ReflectionClass($module->getFullNamespace());
|
||||
|
||||
$moduleInstance = $moduleReflection->newInstance();
|
||||
$moduleInstance = $module->createInstance();
|
||||
|
||||
$moduleInstance->activate();
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@@ -52,9 +52,7 @@ class ModuleDeactivateCommand extends BaseModuleGenerate
|
||||
}
|
||||
|
||||
try {
|
||||
$moduleReflection = new \ReflectionClass($module->getFullNamespace());
|
||||
|
||||
$moduleInstance = $moduleReflection->newInstance();
|
||||
$moduleInstance = $module->createInstance();
|
||||
|
||||
$moduleInstance->deActivate();
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@@ -1,129 +1,132 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<config xmlns="http://thelia.net/schema/dic/config"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
||||
|
||||
<forms>
|
||||
<!-- Forms for Frontend -->
|
||||
<form name="thelia.front.customer.login" class="Thelia\Form\CustomerLogin"/>
|
||||
<form name="thelia.front.customer.lostpassword" class="Thelia\Form\CustomerLostPasswordForm"/>
|
||||
<form name="thelia.front.customer.create" class="Thelia\Form\CustomerCreateForm"/>
|
||||
<form name="thelia.front.customer.profile.update" class="Thelia\Form\CustomerProfileUpdateForm"/>
|
||||
<form name="thelia.front.customer.password.update" class="Thelia\Form\CustomerPasswordUpdateForm"/>
|
||||
<form name="thelia.front.address.create" class="Thelia\Form\AddressCreateForm"/>
|
||||
<form name="thelia.front.address.update" class="Thelia\Form\AddressUpdateForm"/>
|
||||
<form name="thelia.front.contact" class="Thelia\Form\ContactForm"/>
|
||||
<form name="thelia.front.newsletter" class="Thelia\Form\NewsletterForm"/>
|
||||
|
||||
<form name="thelia.admin.login" class="Thelia\Form\AdminLogin"/>
|
||||
<form name="thelia.admin.seo" class="Thelia\Form\SeoForm"/>
|
||||
|
||||
<form name="thelia.admin.customer.create" class="Thelia\Form\CustomerCreateForm"/>
|
||||
<form name="thelia.admin.customer.update" class="Thelia\Form\CustomerUpdateForm"/>
|
||||
|
||||
<form name="thelia.admin.address.create" class="Thelia\Form\AddressCreateForm" />
|
||||
<form name="thelia.admin.address.update" class="Thelia\Form\AddressUpdateForm" />
|
||||
|
||||
<form name="thelia.admin.category.creation" class="Thelia\Form\CategoryCreationForm"/>
|
||||
<form name="thelia.admin.category.modification" class="Thelia\Form\CategoryModificationForm"/>
|
||||
<form name="thelia.admin.category.image.modification" class="Thelia\Form\CategoryImageModification"/>
|
||||
<form name="thelia.admin.category.document.modification" class="Thelia\Form\CategoryDocumentModification"/>
|
||||
|
||||
<form name="thelia.admin.product.creation" class="Thelia\Form\ProductCreationForm"/>
|
||||
<form name="thelia.admin.product.modification" class="Thelia\Form\ProductModificationForm"/>
|
||||
<form name="thelia.admin.product.details.modification" class="Thelia\Form\ProductDetailsModificationForm"/>
|
||||
<form name="thelia.admin.product.image.modification" class="Thelia\Form\ProductImageModification"/>
|
||||
<form name="thelia.admin.product.document.modification" class="Thelia\Form\ProductDocumentModification"/>
|
||||
|
||||
<form name="thelia.admin.product_sale_element.update" class="Thelia\Form\ProductSaleElementUpdateForm"/>
|
||||
<form name="thelia.admin.product_default_sale_element.update" class="Thelia\Form\ProductDefaultSaleElementUpdateForm"/>
|
||||
<form name="thelia.admin.product_combination.build" class="Thelia\Form\ProductCombinationGenerationForm"/>
|
||||
|
||||
<form name="thelia.admin.product.deletion" class="Thelia\Form\ProductModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.folder.creation" class="Thelia\Form\FolderCreationForm"/>
|
||||
<form name="thelia.admin.folder.modification" class="Thelia\Form\FolderModificationForm"/>
|
||||
<form name="thelia.admin.folder.image.modification" class="Thelia\Form\FolderImageModification"/>
|
||||
<form name="thelia.admin.folder.document.modification" class="Thelia\Form\FolderDocumentModification"/>
|
||||
|
||||
<form name="thelia.admin.content.creation" class="Thelia\Form\ContentCreationForm"/>
|
||||
<form name="thelia.admin.content.modification" class="Thelia\Form\ContentModificationForm"/>
|
||||
<form name="thelia.admin.content.image.modification" class="Thelia\Form\ContentImageModification"/>
|
||||
<form name="thelia.admin.content.document.modification" class="Thelia\Form\ContentDocumentModification"/>
|
||||
|
||||
<form name="thelia.cart.add" class="Thelia\Form\CartAdd"/>
|
||||
|
||||
<form name="thelia.order.delivery" class="Thelia\Form\OrderDelivery"/>
|
||||
<form name="thelia.order.payment" class="Thelia\Form\OrderPayment"/>
|
||||
<form name="thelia.order.update.address" class="Thelia\Form\OrderUpdateAddress"/>
|
||||
|
||||
<form name="thelia.order.coupon" class="Thelia\Form\CouponCode"/>
|
||||
|
||||
<form name="thelia.admin.config.creation" class="Thelia\Form\ConfigCreationForm"/>
|
||||
<form name="thelia.admin.config.modification" class="Thelia\Form\ConfigModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.message.creation" class="Thelia\Form\MessageCreationForm"/>
|
||||
<form name="thelia.admin.message.modification" class="Thelia\Form\MessageModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.currency.creation" class="Thelia\Form\CurrencyCreationForm"/>
|
||||
<form name="thelia.admin.currency.modification" class="Thelia\Form\CurrencyModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.coupon.creation" class="Thelia\Form\CouponCreationForm"/>
|
||||
|
||||
<form name="thelia.admin.attribute.creation" class="Thelia\Form\AttributeCreationForm"/>
|
||||
<form name="thelia.admin.attribute.modification" class="Thelia\Form\AttributeModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.feature.creation" class="Thelia\Form\FeatureCreationForm"/>
|
||||
<form name="thelia.admin.feature.modification" class="Thelia\Form\FeatureModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.attributeav.creation" class="Thelia\Form\AttributeAvCreationForm"/>
|
||||
|
||||
<form name="thelia.admin.featureav.creation" class="Thelia\Form\FeatureAvCreationForm"/>
|
||||
|
||||
<form name="thelia.admin.taxrule.modification" class="Thelia\Form\TaxRuleModificationForm"/>
|
||||
<form name="thelia.admin.taxrule.taxlistupdate" class="Thelia\Form\TaxRuleTaxListUpdateForm"/>
|
||||
<form name="thelia.admin.taxrule.add" class="Thelia\Form\TaxRuleCreationForm"/>
|
||||
|
||||
<form name="thelia.admin.tax.modification" class="Thelia\Form\TaxModificationForm"/>
|
||||
<form name="thelia.admin.tax.taxlistupdate" class="Thelia\Form\TaxTaxListUpdateForm"/>
|
||||
<form name="thelia.admin.tax.add" class="Thelia\Form\TaxCreationForm"/>
|
||||
|
||||
<form name="thelia.admin.profile.add" class="Thelia\Form\ProfileCreationForm"/>
|
||||
<form name="thelia.admin.profile.modification" class="Thelia\Form\ProfileModificationForm"/>
|
||||
<form name="thelia.admin.profile.resource-access.modification" class="Thelia\Form\ProfileUpdateResourceAccessForm"/>
|
||||
<form name="thelia.admin.profile.module-access.modification" class="Thelia\Form\ProfileUpdateModuleAccessForm"/>
|
||||
|
||||
<form name="thelia.admin.administrator.add" class="Thelia\Form\AdministratorCreationForm"/>
|
||||
<form name="thelia.admin.administrator.update" class="Thelia\Form\AdministratorModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.mailing-system.update" class="Thelia\Form\MailingSystemModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.template.creation" class="Thelia\Form\TemplateCreationForm"/>
|
||||
<form name="thelia.admin.template.modification" class="Thelia\Form\TemplateModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.country.creation" class="Thelia\Form\CountryCreationForm"/>
|
||||
<form name="thelia.admin.country.modification" class="Thelia\Form\CountryModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.area.create" class="Thelia\Form\Area\AreaCreateForm"/>
|
||||
<form name="thelia.admin.area.modification" class="Thelia\Form\Area\AreaModificationForm"/>
|
||||
<form name="thelia.admin.area.country" class="Thelia\Form\Area\AreaCountryForm"/>
|
||||
<form name="thelia.admin.area.postage" class="Thelia\Form\Area\AreaPostageForm"/>
|
||||
|
||||
<form name="thelia.shopping_zone_area" class="Thelia\Form\ShippingZone\ShippingZoneAddArea"/>
|
||||
<form name="thelia.shopping_zone_remove_area" class="Thelia\Form\ShippingZone\ShippingZoneRemoveArea"/>
|
||||
|
||||
<form name="thelia.lang.update" class="Thelia\Form\Lang\LangUpdateForm"/>
|
||||
<form name="thelia.lang.create" class="Thelia\Form\Lang\LangCreateForm"/>
|
||||
<form name="thelia.lang.defaultBehavior" class="Thelia\Form\Lang\LangDefaultBehaviorForm"/>
|
||||
<form name="thelia.lang.url" class="Thelia\Form\Lang\LangUrlForm"/>
|
||||
|
||||
<form name="thelia.configuration.store" class="Thelia\Form\ConfigStoreForm"/>
|
||||
<form name="thelia.system-logs.configuration" class="Thelia\Form\SystemLogConfigurationForm"/>
|
||||
|
||||
<form name="thelia.admin.module.modification" class="Thelia\Form\ModuleModificationForm"/>
|
||||
|
||||
<form name="thelia.cache.flush" class="Thelia\Form\Cache\CacheFlushForm"/>
|
||||
</forms>
|
||||
|
||||
</config>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<config xmlns="http://thelia.net/schema/dic/config"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
||||
|
||||
<forms>
|
||||
<!-- Forms for Frontend -->
|
||||
<form name="thelia.front.customer.login" class="Thelia\Form\CustomerLogin"/>
|
||||
<form name="thelia.front.customer.lostpassword" class="Thelia\Form\CustomerLostPasswordForm"/>
|
||||
<form name="thelia.front.customer.create" class="Thelia\Form\CustomerCreateForm"/>
|
||||
<form name="thelia.front.customer.profile.update" class="Thelia\Form\CustomerProfileUpdateForm"/>
|
||||
<form name="thelia.front.customer.password.update" class="Thelia\Form\CustomerPasswordUpdateForm"/>
|
||||
<form name="thelia.front.address.create" class="Thelia\Form\AddressCreateForm"/>
|
||||
<form name="thelia.front.address.update" class="Thelia\Form\AddressUpdateForm"/>
|
||||
<form name="thelia.front.contact" class="Thelia\Form\ContactForm"/>
|
||||
<form name="thelia.front.newsletter" class="Thelia\Form\NewsletterForm"/>
|
||||
|
||||
<form name="thelia.admin.login" class="Thelia\Form\AdminLogin"/>
|
||||
<form name="thelia.admin.seo" class="Thelia\Form\SeoForm"/>
|
||||
|
||||
<form name="thelia.admin.customer.create" class="Thelia\Form\CustomerCreateForm"/>
|
||||
<form name="thelia.admin.customer.update" class="Thelia\Form\CustomerUpdateForm"/>
|
||||
|
||||
<form name="thelia.admin.address.create" class="Thelia\Form\AddressCreateForm" />
|
||||
<form name="thelia.admin.address.update" class="Thelia\Form\AddressUpdateForm" />
|
||||
|
||||
<form name="thelia.admin.category.creation" class="Thelia\Form\CategoryCreationForm"/>
|
||||
<form name="thelia.admin.category.modification" class="Thelia\Form\CategoryModificationForm"/>
|
||||
<form name="thelia.admin.category.image.modification" class="Thelia\Form\CategoryImageModification"/>
|
||||
<form name="thelia.admin.category.document.modification" class="Thelia\Form\CategoryDocumentModification"/>
|
||||
|
||||
<form name="thelia.admin.product.creation" class="Thelia\Form\ProductCreationForm"/>
|
||||
<form name="thelia.admin.product.modification" class="Thelia\Form\ProductModificationForm"/>
|
||||
<form name="thelia.admin.product.details.modification" class="Thelia\Form\ProductDetailsModificationForm"/>
|
||||
<form name="thelia.admin.product.image.modification" class="Thelia\Form\ProductImageModification"/>
|
||||
<form name="thelia.admin.product.document.modification" class="Thelia\Form\ProductDocumentModification"/>
|
||||
|
||||
<form name="thelia.admin.product_sale_element.update" class="Thelia\Form\ProductSaleElementUpdateForm"/>
|
||||
<form name="thelia.admin.product_default_sale_element.update" class="Thelia\Form\ProductDefaultSaleElementUpdateForm"/>
|
||||
<form name="thelia.admin.product_combination.build" class="Thelia\Form\ProductCombinationGenerationForm"/>
|
||||
|
||||
<form name="thelia.admin.product.deletion" class="Thelia\Form\ProductModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.folder.creation" class="Thelia\Form\FolderCreationForm"/>
|
||||
<form name="thelia.admin.folder.modification" class="Thelia\Form\FolderModificationForm"/>
|
||||
<form name="thelia.admin.folder.image.modification" class="Thelia\Form\FolderImageModification"/>
|
||||
<form name="thelia.admin.folder.document.modification" class="Thelia\Form\FolderDocumentModification"/>
|
||||
|
||||
<form name="thelia.admin.content.creation" class="Thelia\Form\ContentCreationForm"/>
|
||||
<form name="thelia.admin.content.modification" class="Thelia\Form\ContentModificationForm"/>
|
||||
<form name="thelia.admin.content.image.modification" class="Thelia\Form\ContentImageModification"/>
|
||||
<form name="thelia.admin.content.document.modification" class="Thelia\Form\ContentDocumentModification"/>
|
||||
|
||||
<form name="thelia.cart.add" class="Thelia\Form\CartAdd"/>
|
||||
|
||||
<form name="thelia.order.delivery" class="Thelia\Form\OrderDelivery"/>
|
||||
<form name="thelia.order.payment" class="Thelia\Form\OrderPayment"/>
|
||||
<form name="thelia.order.update.address" class="Thelia\Form\OrderUpdateAddress"/>
|
||||
|
||||
<form name="thelia.order.coupon" class="Thelia\Form\CouponCode"/>
|
||||
|
||||
<form name="thelia.admin.config.creation" class="Thelia\Form\ConfigCreationForm"/>
|
||||
<form name="thelia.admin.config.modification" class="Thelia\Form\ConfigModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.message.creation" class="Thelia\Form\MessageCreationForm"/>
|
||||
<form name="thelia.admin.message.modification" class="Thelia\Form\MessageModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.currency.creation" class="Thelia\Form\CurrencyCreationForm"/>
|
||||
<form name="thelia.admin.currency.modification" class="Thelia\Form\CurrencyModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.coupon.creation" class="Thelia\Form\CouponCreationForm"/>
|
||||
|
||||
<form name="thelia.admin.attribute.creation" class="Thelia\Form\AttributeCreationForm"/>
|
||||
<form name="thelia.admin.attribute.modification" class="Thelia\Form\AttributeModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.feature.creation" class="Thelia\Form\FeatureCreationForm"/>
|
||||
<form name="thelia.admin.feature.modification" class="Thelia\Form\FeatureModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.attributeav.creation" class="Thelia\Form\AttributeAvCreationForm"/>
|
||||
|
||||
<form name="thelia.admin.featureav.creation" class="Thelia\Form\FeatureAvCreationForm"/>
|
||||
|
||||
<form name="thelia.admin.taxrule.modification" class="Thelia\Form\TaxRuleModificationForm"/>
|
||||
<form name="thelia.admin.taxrule.taxlistupdate" class="Thelia\Form\TaxRuleTaxListUpdateForm"/>
|
||||
<form name="thelia.admin.taxrule.add" class="Thelia\Form\TaxRuleCreationForm"/>
|
||||
|
||||
<form name="thelia.admin.tax.modification" class="Thelia\Form\TaxModificationForm"/>
|
||||
<form name="thelia.admin.tax.taxlistupdate" class="Thelia\Form\TaxTaxListUpdateForm"/>
|
||||
<form name="thelia.admin.tax.add" class="Thelia\Form\TaxCreationForm"/>
|
||||
|
||||
<form name="thelia.admin.profile.add" class="Thelia\Form\ProfileCreationForm"/>
|
||||
<form name="thelia.admin.profile.modification" class="Thelia\Form\ProfileModificationForm"/>
|
||||
<form name="thelia.admin.profile.resource-access.modification" class="Thelia\Form\ProfileUpdateResourceAccessForm"/>
|
||||
<form name="thelia.admin.profile.module-access.modification" class="Thelia\Form\ProfileUpdateModuleAccessForm"/>
|
||||
|
||||
<form name="thelia.admin.administrator.add" class="Thelia\Form\AdministratorCreationForm"/>
|
||||
<form name="thelia.admin.administrator.update" class="Thelia\Form\AdministratorModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.mailing-system.update" class="Thelia\Form\MailingSystemModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.template.creation" class="Thelia\Form\TemplateCreationForm"/>
|
||||
<form name="thelia.admin.template.modification" class="Thelia\Form\TemplateModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.country.creation" class="Thelia\Form\CountryCreationForm"/>
|
||||
<form name="thelia.admin.country.modification" class="Thelia\Form\CountryModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.area.create" class="Thelia\Form\Area\AreaCreateForm"/>
|
||||
<form name="thelia.admin.area.modification" class="Thelia\Form\Area\AreaModificationForm"/>
|
||||
<form name="thelia.admin.area.country" class="Thelia\Form\Area\AreaCountryForm"/>
|
||||
<form name="thelia.admin.area.postage" class="Thelia\Form\Area\AreaPostageForm"/>
|
||||
|
||||
<form name="thelia.shopping_zone_area" class="Thelia\Form\ShippingZone\ShippingZoneAddArea"/>
|
||||
<form name="thelia.shopping_zone_remove_area" class="Thelia\Form\ShippingZone\ShippingZoneRemoveArea"/>
|
||||
|
||||
<form name="thelia.lang.update" class="Thelia\Form\Lang\LangUpdateForm"/>
|
||||
<form name="thelia.lang.create" class="Thelia\Form\Lang\LangCreateForm"/>
|
||||
<form name="thelia.lang.defaultBehavior" class="Thelia\Form\Lang\LangDefaultBehaviorForm"/>
|
||||
<form name="thelia.lang.url" class="Thelia\Form\Lang\LangUrlForm"/>
|
||||
|
||||
<form name="thelia.configuration.store" class="Thelia\Form\ConfigStoreForm"/>
|
||||
<form name="thelia.system-logs.configuration" class="Thelia\Form\SystemLogConfigurationForm"/>
|
||||
|
||||
<form name="thelia.admin.module.modification" class="Thelia\Form\ModuleModificationForm"/>
|
||||
|
||||
<form name="thelia.cache.flush" class="Thelia\Form\Cache\CacheFlushForm"/>
|
||||
<form name="thelia.assets.flush" class="Thelia\Form\Cache\AssetsFlushForm"/>
|
||||
<form name="thelia.images-and-documents-cache.flush" class="Thelia\Form\Cache\ImagesAndDocumentsCacheFlushForm"/>
|
||||
|
||||
</forms>
|
||||
|
||||
</config>
|
||||
|
||||
@@ -1004,6 +1004,14 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\AdvancedConfigurationController::flushCacheAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.advanced.flush-assets" path="/admin/configuration/advanced/flush-assets">
|
||||
<default key="_controller">Thelia\Controller\Admin\AdvancedConfigurationController::flushAssetsAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.advanced.flush-images-and-documents" path="/admin/configuration/advanced/flush-images-and-documents">
|
||||
<default key="_controller">Thelia\Controller\Admin\AdvancedConfigurationController::flushImagesAndDocumentsAction</default>
|
||||
</route>
|
||||
|
||||
<!-- and cache route management -->
|
||||
|
||||
<!-- Modules rule management -->
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,64 +168,80 @@ class Module extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||
{
|
||||
/** @var \Thelia\Model\Module $module */
|
||||
foreach ($loopResult->getResultDataCollection() as $module) {
|
||||
$loopResultRow = new LoopResultRow($module);
|
||||
$loopResultRow->set("ID", $module->getId())
|
||||
->set("IS_TRANSLATED",$module->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE",$this->locale)
|
||||
->set("TITLE",$module->getVirtualColumn('i18n_TITLE'))
|
||||
->set("CHAPO", $module->getVirtualColumn('i18n_CHAPO'))
|
||||
->set("DESCRIPTION", $module->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
->set("POSTSCRIPTUM", $module->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||
->set("CODE", $module->getCode())
|
||||
->set("TYPE", $module->getType())
|
||||
->set("ACTIVE", $module->getActivate())
|
||||
->set("CLASS", $module->getFullNamespace())
|
||||
->set("POSITION", $module->getPosition());
|
||||
|
||||
$hasConfigurationInterface = false;
|
||||
try {
|
||||
new \ReflectionClass($module->getFullNamespace());
|
||||
|
||||
/* first test if module defines it's own config route */
|
||||
if ($module->getActivate()) {
|
||||
// Works only fo activated modules - see Thelia\Core\DependencyInjection\Compiler\RegisterRouterPass
|
||||
$routerId = "router." . $module->getBaseDir();
|
||||
if ($this->container->has($routerId)) {
|
||||
try {
|
||||
if ($this->container->get($routerId)->match('/admin/module/' . $module->getCode())) {
|
||||
$exists = true;
|
||||
}
|
||||
catch(\ReflectionException $ex) {
|
||||
$exists = false;
|
||||
}
|
||||
|
||||
if ($exists || $this->getBackendContext()) {
|
||||
$loopResultRow = new LoopResultRow($module);
|
||||
|
||||
$loopResultRow
|
||||
->set("ID" , $module->getId())
|
||||
->set("IS_TRANSLATED", $module->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE" , $this->locale)
|
||||
->set("TITLE" , $module->getVirtualColumn('i18n_TITLE'))
|
||||
->set("CHAPO" , $module->getVirtualColumn('i18n_CHAPO'))
|
||||
->set("DESCRIPTION" , $module->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
->set("POSTSCRIPTUM" , $module->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||
->set("CODE" , $module->getCode())
|
||||
->set("TYPE" , $module->getType())
|
||||
->set("ACTIVE" , $module->getActivate())
|
||||
->set("CLASS" , $module->getFullNamespace())
|
||||
->set("POSITION" , $module->getPosition())
|
||||
->set("EXISTS" , $exists)
|
||||
;
|
||||
|
||||
$hasConfigurationInterface = false;
|
||||
|
||||
/* first test if module defines it's own config route */
|
||||
if ($module->getActivate()) {
|
||||
// Works only fo activated modules - see Thelia\Core\DependencyInjection\Compiler\RegisterRouterPass
|
||||
$routerId = "router." . $module->getBaseDir();
|
||||
if ($this->container->has($routerId)) {
|
||||
try {
|
||||
if ($this->container->get($routerId)->match('/admin/module/' . $module->getCode())) {
|
||||
$hasConfigurationInterface = true;
|
||||
}
|
||||
} catch (ResourceNotFoundException $e) {
|
||||
/* $hasConfigurationInterface stays false */
|
||||
}
|
||||
}
|
||||
|
||||
/* if not ; test if it uses admin inclusion : module_configuration.html */
|
||||
if (false === $hasConfigurationInterface) {
|
||||
if (file_exists($module->getAbsoluteAdminIncludesPath() . DS . "module_configuration.html")) {
|
||||
$hasConfigurationInterface = true;
|
||||
}
|
||||
} catch (ResourceNotFoundException $e) {
|
||||
/* $hasConfigurationInterface stays false */
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Make a quick and dirty test on the module's routing.xml file
|
||||
$routing = @file_get_contents($module->getAbsoluteConfigPath() . DS . "routing.xml");
|
||||
|
||||
/* if not ; test if it uses admin inclusion : module_configuration.html */
|
||||
if (false === $hasConfigurationInterface) {
|
||||
if (file_exists($module->getAbsoluteAdminIncludesPath() . DS . "module_configuration.html")) {
|
||||
if ($routing && strpos($routing, '/admin/module/') !== false) {
|
||||
$hasConfigurationInterface = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Make a quick and dirty test on the module's routing.xml file
|
||||
$routing = @file_get_contents($module->getAbsoluteConfigPath() . DS . "routing.xml");
|
||||
|
||||
if ($routing && strpos($routing, '/admin/module/') !== false) {
|
||||
$hasConfigurationInterface = true;
|
||||
$loopResultRow->set("CONFIGURABLE", $hasConfigurationInterface ? 1 : 0);
|
||||
|
||||
if (null !== $this->getProfile()) {
|
||||
$accessValue = $module->getVirtualColumn('access');
|
||||
$manager = new AccessManager($accessValue);
|
||||
|
||||
$loopResultRow->set("VIEWABLE", $manager->can(AccessManager::VIEW)? 1 : 0)
|
||||
->set("CREATABLE", $manager->can(AccessManager::CREATE) ? 1 : 0)
|
||||
->set("UPDATABLE", $manager->can(AccessManager::UPDATE)? 1 : 0)
|
||||
->set("DELETABLE", $manager->can(AccessManager::DELETE)? 1 : 0);
|
||||
}
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
$loopResultRow->set("CONFIGURABLE", $hasConfigurationInterface ? 1 : 0);
|
||||
|
||||
if (null !== $this->getProfile()) {
|
||||
$accessValue = $module->getVirtualColumn('access');
|
||||
$manager = new AccessManager($accessValue);
|
||||
|
||||
$loopResultRow->set("VIEWABLE", $manager->can(AccessManager::VIEW)? 1 : 0)
|
||||
->set("CREATABLE", $manager->can(AccessManager::CREATE) ? 1 : 0)
|
||||
->set("UPDATABLE", $manager->can(AccessManager::UPDATE)? 1 : 0)
|
||||
->set("DELETABLE", $manager->can(AccessManager::DELETE)? 1 : 0);
|
||||
}
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
return $loopResult;
|
||||
|
||||
40
core/lib/Thelia/Form/Cache/AssetsFlushForm.php
Normal file
40
core/lib/Thelia/Form/Cache/AssetsFlushForm.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the Thelia package. */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Form\Cache;
|
||||
|
||||
use Thelia\Form\BaseForm;
|
||||
|
||||
/**
|
||||
* Class CacheFlushForm
|
||||
* @package Thelia\Form\Cache
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class AssetsFlushForm extends BaseForm
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function buildForm()
|
||||
{
|
||||
//Nothing, we just want CSRF protection
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return "assets_flush";
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the Thelia package. */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Form\Cache;
|
||||
|
||||
use Thelia\Form\BaseForm;
|
||||
|
||||
/**
|
||||
* Class CacheFlushForm
|
||||
* @package Thelia\Form\Cache
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class ImagesAndDocumentsCacheFlushForm extends BaseForm
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function buildForm()
|
||||
{
|
||||
//Nothing, we just want CSRF protection
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return "images_and_documents_cache_flush";
|
||||
}
|
||||
}
|
||||
@@ -74,8 +74,7 @@ class OrderDelivery extends BaseForm
|
||||
if (null === $module) {
|
||||
$context->addViolation(Translator::getInstance()->trans("Delivery module ID not found"));
|
||||
} else {
|
||||
$moduleReflection = new \ReflectionClass($module->getFullNamespace());
|
||||
if ($moduleReflection->isSubclassOf("Thelia\Module\DeliveryModuleInterface") === false) {
|
||||
if (! $module->isDeliveryModule()) {
|
||||
$context->addViolation(
|
||||
sprintf(Translator::getInstance()->trans("delivery module %s is not a Thelia\Module\DeliveryModuleInterface"), $module->getCode())
|
||||
);
|
||||
|
||||
@@ -75,8 +75,7 @@ class OrderPayment extends BaseForm
|
||||
$context->addViolation("Payment module ID not found");
|
||||
}
|
||||
|
||||
$moduleReflection = new \ReflectionClass($module->getFullNamespace());
|
||||
if ($moduleReflection->isSubclassOf("Thelia\Module\PaymentModuleInterface") === false) {
|
||||
if (! $module->isPayementModule()) {
|
||||
$context->addViolation(
|
||||
sprintf(Translator::getInstance()->trans("payment module %s is not a Thelia\Module\PaymentModuleInterface"), $module->getCode())
|
||||
);
|
||||
|
||||
@@ -162,6 +162,34 @@ class Module extends BaseModule
|
||||
return $this->getAbsoluteTemplateBasePath() .DS. $templateSubdirName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if this module is a delivery module
|
||||
*/
|
||||
public function isDeliveryModule() {
|
||||
$moduleReflection = new \ReflectionClass($this->getFullNamespace());
|
||||
|
||||
return $moduleReflection->implementsInterface("Thelia\Module\DeliveryModuleInterface");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if this module is a payment module
|
||||
*/
|
||||
public function isPayementModule() {
|
||||
$moduleReflection = new \ReflectionClass($this->getFullNamespace());
|
||||
|
||||
return $moduleReflection->implementsInterface("Thelia\Module\PaymentModuleInterface");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return BaseModule a new module instance.
|
||||
*/
|
||||
public function createInstance() {
|
||||
$moduleClass = new \ReflectionClass($this->getFullNamespace());
|
||||
|
||||
return $moduleClass->newInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate next position relative to module type
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user