From bf1ebd07002e26ba731fbd9e76b2cbed8cbe1796 Mon Sep 17 00:00:00 2001 From: rMalie Date: Thu, 5 Jan 2012 15:42:15 +0000 Subject: [PATCH] [+] BO: htaccess is now automatically generated when friendly url option is activated --- controllers/admin/AdminMetaController.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminMetaController.php b/controllers/admin/AdminMetaController.php index 0a61235d2..e3df6e62a 100644 --- a/controllers/admin/AdminMetaController.php +++ b/controllers/admin/AdminMetaController.php @@ -51,7 +51,7 @@ class AdminMetaControllerCore extends AdminController 'general' => array( 'title' => $this->l('URLs Setup'), 'fields' => array( - 'PS_REWRITING_SETTINGS' => array('title' => $this->l('Friendly URL'), 'desc' => $this->l('Enable only if your server allows URL rewriting (recommended)').'
'.$this->l('If you turn on this feature, you must').' '.$this->l('generate a .htaccess file').'
', 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), + 'PS_REWRITING_SETTINGS' => array('title' => $this->l('Friendly URL'), 'desc' => $this->l('Enable only if your server allows URL rewriting (recommended)'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CANONICAL_REDIRECT' => array('title' => $this->l('Automatically redirect to Canonical url'), 'desc' => $this->l('Recommended but your theme must be compliant'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), ), 'submit' => array() @@ -247,6 +247,15 @@ class AdminMetaControllerCore extends AdminController Configuration::updateValue('PS_ROUTE_'.$routeID, $rule); } + /** + * Called when PS_REWRITING_SETTINGS option is saved + */ + public function updateOptionPsRewritingSettings() + { + Configuration::updateValue('PS_REWRITING_SETTINGS', (int)Tools::getValue('PS_REWRITING_SETTINGS')); + Tools::generateHtaccess(); + } + public function updateOptionPsRouteProductRule() { $this->checkAndUpdateRoute('product_rule');