Merge branch 'install' into reloadTask
This commit is contained in:
@@ -56,6 +56,17 @@
|
||||
<tag name="router.register" priority="0"/>
|
||||
</service>
|
||||
|
||||
<service id="router.install" class="%router.class%">
|
||||
<argument type="service" id="router.xmlLoader"/>
|
||||
<argument>install.xml</argument>
|
||||
<argument type="collection">
|
||||
<argument key="cache_dir">%kernel.cache_dir%</argument>
|
||||
<argument key="debug">%kernel.debug%</argument>
|
||||
</argument>
|
||||
<argument type="service" id="request.context"/>
|
||||
<tag name="router.register" priority="-1"/>
|
||||
</service>
|
||||
|
||||
<service id="router.front" class="%router.class%">
|
||||
<argument type="service" id="router.xmlLoader"/>
|
||||
<argument>front.xml</argument>
|
||||
|
||||
15
core/lib/Thelia/Config/Resources/routing/install.xml
Normal file
15
core/lib/Thelia/Config/Resources/routing/install.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<routes xmlns="http://symfony.com/schema/routing"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<route id="home" path="/install" >
|
||||
<default key="_controller">Thelia\Controller\Install\InstallController::index</default>
|
||||
</route>
|
||||
|
||||
<route id="home" path="/install/step/2" >
|
||||
<default key="_controller">Thelia\Controller\Install\InstallController::checkPermission</default>
|
||||
</route>
|
||||
|
||||
</routes>
|
||||
@@ -179,7 +179,7 @@ class BaseController extends ContainerAware
|
||||
*/
|
||||
public function redirect($url)
|
||||
{
|
||||
Redirect::exec($url);
|
||||
Redirect::exec(URL::absoluteUrl($url));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
60
core/lib/Thelia/Controller/Install/BaseInstallController.php
Normal file
60
core/lib/Thelia/Controller/Install/BaseInstallController.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Controller\Install;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Thelia\Controller\BaseController;
|
||||
|
||||
|
||||
/**
|
||||
* Class BaseInstallController
|
||||
* @package Thelia\Controller\Install
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
69
core/lib/Thelia/Controller/Install/InstallController.php
Normal file
69
core/lib/Thelia/Controller/Install/InstallController.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Controller\Install;
|
||||
use Thelia\Install\BaseInstall;
|
||||
use Thelia\Install\CheckPermission;
|
||||
|
||||
/**
|
||||
* Class InstallController
|
||||
* @package Thelia\Controller\Install
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
46
core/lib/Thelia/Install/BaseInstall.php
Normal file
46
core/lib/Thelia/Install/BaseInstall.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Install;
|
||||
use Thelia\Install\Exception\AlreadyInstallException;
|
||||
|
||||
/**
|
||||
* Class BaseInstall
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
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();
|
||||
}
|
||||
78
core/lib/Thelia/Install/CheckPermission.php
Normal file
78
core/lib/Thelia/Install/CheckPermission.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Install;
|
||||
|
||||
|
||||
/**
|
||||
* Class CheckPermission
|
||||
* @package Thelia\Install
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Install\Exception;
|
||||
|
||||
|
||||
/**
|
||||
* Class AlreadyInstallException
|
||||
* @package Thelia\Install\Exception
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class AlreadyInstallException extends InstallException
|
||||
{
|
||||
|
||||
}
|
||||
32
core/lib/Thelia/Install/Exception/InstallException.php
Normal file
32
core/lib/Thelia/Install/Exception/InstallException.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Install\Exception;
|
||||
|
||||
/**
|
||||
* Class InstallException
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class InstallException extends \RuntimeException
|
||||
{
|
||||
|
||||
}
|
||||
12
templates/install/index.html
Normal file
12
templates/install/index.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{extends file="layout.html"}
|
||||
{block name="content"}
|
||||
<h1>{intl l="Thelia installation wizard"}</h1>
|
||||
<br />
|
||||
|
||||
{intl l="Bienvenue au sein du programme d'installation de Thelia."}<br />
|
||||
{intl l="Nous allons vous guider tout au long de ce processus afin d'installer l'application sur votre système."}<br /><br />
|
||||
|
||||
<form action="{url path="/install/step/2" }" method="post">
|
||||
<input type="submit" value="Continuer" />
|
||||
</form>
|
||||
{/block}
|
||||
49
templates/install/layout.html
Normal file
49
templates/install/layout.html
Normal file
@@ -0,0 +1,49 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{$lang_code}">
|
||||
<head>
|
||||
<title>{block name="title"}Thelia Install{/block}</title>
|
||||
|
||||
{images file='../admin/default/assets/img/favicon.ico'}<link rel="shortcut icon" href="{$asset_url}" />{/images}
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
{stylesheets file='../admin/default/assets/bootstrap/css/bootstrap.css' filters='cssembed'}
|
||||
<link rel="stylesheet" href="{$asset_url}">
|
||||
{/stylesheets}
|
||||
|
||||
{stylesheets file='../admin/default/assets/bootstrap/css/bootstrap-responsive.css' filters='cssembed'}
|
||||
<link rel="stylesheet" href="{$asset_url}">
|
||||
{/stylesheets}
|
||||
|
||||
|
||||
{stylesheets file='../admin/default/assets/css/*' filters='less,cssembed'}
|
||||
<link rel="stylesheet" href="{$asset_url}">
|
||||
{/stylesheets}
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="topbar">
|
||||
<div class="container">
|
||||
<div class="version-info">{intl l='Version %ver' ver="{$THELIA_VERSION}"}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="wrapper" class="container">
|
||||
{block name="content"}{/block}
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p>{intl l='© Thelia 2013'}
|
||||
- <a href="http://www.openstudio.fr/" target="_blank">{intl l='Édité par OpenStudio'}</a>
|
||||
- <a href="http://forum.thelia.net/" target="_blank">{intl l='Forum Thelia'}</a>
|
||||
- <a href="http://contrib.thelia.net/" target="_blank">{intl l='Contributions Thelia'}</a>
|
||||
<span class="pull-right">{intl l='interface par <a target="_blank" href="http://www.steaw-webdesign.com/">Steaw-Webdesign</a>'}</span>
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user