diff --git a/core/lib/Thelia/Config/Resources/routing.xml b/core/lib/Thelia/Config/Resources/routing.xml
index 9c61c55a8..5200aefc1 100755
--- a/core/lib/Thelia/Config/Resources/routing.xml
+++ b/core/lib/Thelia/Config/Resources/routing.xml
@@ -56,6 +56,17 @@
+
+
+ install.xml
+
+ %kernel.cache_dir%
+ %kernel.debug%
+
+
+
+
+
front.xml
diff --git a/core/lib/Thelia/Config/Resources/routing/install.xml b/core/lib/Thelia/Config/Resources/routing/install.xml
new file mode 100644
index 000000000..d53763948
--- /dev/null
+++ b/core/lib/Thelia/Config/Resources/routing/install.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+ Thelia\Controller\Install\InstallController::index
+
+
+
+ Thelia\Controller\Install\InstallController::checkPermission
+
+
+
diff --git a/core/lib/Thelia/Controller/BaseController.php b/core/lib/Thelia/Controller/BaseController.php
index c7c9f6f14..d4c8b5854 100755
--- a/core/lib/Thelia/Controller/BaseController.php
+++ b/core/lib/Thelia/Controller/BaseController.php
@@ -179,7 +179,7 @@ class BaseController extends ContainerAware
*/
public function redirect($url)
{
- Redirect::exec($url);
+ Redirect::exec(URL::absoluteUrl($url));
}
/**
diff --git a/core/lib/Thelia/Controller/Install/BaseInstallController.php b/core/lib/Thelia/Controller/Install/BaseInstallController.php
new file mode 100644
index 000000000..a5cbbd506
--- /dev/null
+++ b/core/lib/Thelia/Controller/Install/BaseInstallController.php
@@ -0,0 +1,60 @@
+. */
+/* */
+/*************************************************************************************/
+
+namespace Thelia\Controller\Install;
+use Symfony\Component\HttpFoundation\Response;
+use Thelia\Controller\BaseController;
+
+
+/**
+ * Class BaseInstallController
+ * @package Thelia\Controller\Install
+ * @author Manuel Raynaud
+ */
+class BaseInstallController extends BaseController
+{
+ /**
+ * @return a ParserInterface instance parser
+ */
+ protected function getParser()
+ {
+ $parser = $this->container->get("thelia.parser");
+
+ // Define the template thant shoud be used
+ $parser->setTemplate("install");
+
+ return $parser;
+ }
+
+ public function render($templateName, $args = array())
+ {
+ return new Response($this->renderRaw($templateName, $args));
+ }
+
+ public function renderRaw($templateName, $args = array())
+ {
+ $data = $this->getParser()->render($templateName, $args);
+
+ return $data;
+ }
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Controller/Install/InstallController.php b/core/lib/Thelia/Controller/Install/InstallController.php
new file mode 100644
index 000000000..209eea82b
--- /dev/null
+++ b/core/lib/Thelia/Controller/Install/InstallController.php
@@ -0,0 +1,69 @@
+. */
+/* */
+/*************************************************************************************/
+
+namespace Thelia\Controller\Install;
+use Thelia\Install\BaseInstall;
+use Thelia\Install\CheckPermission;
+
+/**
+ * Class InstallController
+ * @package Thelia\Controller\Install
+ * @author Manuel Raynaud
+ */
+class InstallController extends BaseInstallController {
+
+ public function index()
+ {
+ $this->verifyStep(1);
+
+ $this->getSession()->set("step", 1);
+
+ $this->render("index.html");
+ }
+
+ public function checkPermission()
+ {
+ $this->verifyStep(2);
+
+ $permission = new CheckPermission();
+ }
+
+ protected function verifyStep($step)
+ {
+ $session = $this->getSession();
+
+ if ($session->has("step")) {
+ $sessionStep = $session->get("step");
+ } else {
+ return true;
+ }
+
+ switch($step) {
+ case "1" :
+ if ($sessionStep > 1) {
+ $this->redirect("/install/step/2");
+ }
+ break;
+ }
+ }
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Install/BaseInstall.php b/core/lib/Thelia/Install/BaseInstall.php
new file mode 100644
index 000000000..58c510267
--- /dev/null
+++ b/core/lib/Thelia/Install/BaseInstall.php
@@ -0,0 +1,46 @@
+. */
+/* */
+/*************************************************************************************/
+namespace Thelia\Install;
+use Thelia\Install\Exception\AlreadyInstallException;
+
+/**
+ * Class BaseInstall
+ * @author Manuel Raynaud
+ */
+abstract class BaseInstall
+{
+ /**
+ * Verify if an installation already exists
+ */
+ public function __construct($verifyInstall = true)
+ {
+ if (file_exists(THELIA_ROOT . '/local/config/database.yml') && $verifyInstall) {
+ throw new AlreadyInstallException("Thelia is already installed");
+ }
+
+
+ $this->exec();
+ }
+
+ abstract public function exec();
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Install/CheckPermission.php b/core/lib/Thelia/Install/CheckPermission.php
new file mode 100644
index 000000000..db73330cf
--- /dev/null
+++ b/core/lib/Thelia/Install/CheckPermission.php
@@ -0,0 +1,78 @@
+. */
+/* */
+/*************************************************************************************/
+
+namespace Thelia\Install;
+
+
+/**
+ * Class CheckPermission
+ * @package Thelia\Install
+ * @author Manuel Raynaud
+ */
+class CheckPermission extends BaseInstall
+{
+ const CONF = "const";
+ const LOG = "log";
+ const CACHE = "cache";
+
+ private $directories = array();
+ private $validation = array();
+ private $valid = true;
+
+ public function __construct($verifyInstall = true)
+ {
+
+
+ $this->directories = array(
+ self::CONF => THELIA_ROOT . "local/config",
+ self::LOG => THELIA_ROOT . "log",
+ self::CACHE => THELIA_ROOT . "cache"
+ );
+
+ $this->validation = array(
+ self::CONF => array(
+ "text" => sprintf("config directory(%s)...", $this->directories[self::CONF]),
+ "status" => true
+ ),
+ self::LOG => array(
+ "text" => sprintf("cache directory(%s)...", $this->directories[self::LOG]),
+ "status" => true
+ ),
+ self::CACHE => array(
+ "text" => sprintf("log directory(%s)...", $this->directories[self::CACHE]),
+ "status" => true
+ )
+ );
+ parent::__construct($verifyInstall);
+ }
+
+ public function exec()
+ {
+ foreach ($this->directories as $key => $directory) {
+ if(is_writable($directory) === false) {
+ $this->valid = false;
+ $this->validation[$key]["status"] = false;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Install/Exception/AlreadyInstallException.php b/core/lib/Thelia/Install/Exception/AlreadyInstallException.php
new file mode 100644
index 000000000..1409c7cdd
--- /dev/null
+++ b/core/lib/Thelia/Install/Exception/AlreadyInstallException.php
@@ -0,0 +1,35 @@
+. */
+/* */
+/*************************************************************************************/
+
+namespace Thelia\Install\Exception;
+
+
+/**
+ * Class AlreadyInstallException
+ * @package Thelia\Install\Exception
+ * @author Manuel Raynaud
+ */
+class AlreadyInstallException extends InstallException
+{
+
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Install/Exception/InstallException.php b/core/lib/Thelia/Install/Exception/InstallException.php
new file mode 100644
index 000000000..6924bcfe5
--- /dev/null
+++ b/core/lib/Thelia/Install/Exception/InstallException.php
@@ -0,0 +1,32 @@
+. */
+/* */
+/*************************************************************************************/
+namespace Thelia\Install\Exception;
+
+/**
+ * Class InstallException
+ * @author Manuel Raynaud
+ */
+class InstallException extends \RuntimeException
+{
+
+}
\ No newline at end of file
diff --git a/templates/install/index.html b/templates/install/index.html
new file mode 100644
index 000000000..a996cc241
--- /dev/null
+++ b/templates/install/index.html
@@ -0,0 +1,12 @@
+{extends file="layout.html"}
+{block name="content"}
+
{intl l="Thelia installation wizard"}
+
+
+ {intl l="Bienvenue au sein du programme d'installation de Thelia."}
+ {intl l="Nous allons vous guider tout au long de ce processus afin d'installer l'application sur votre système."}