nstall step Please enter the commit message for your changes. Lines starting

This commit is contained in:
Manuel Raynaud
2013-09-17 15:43:15 +02:00
parent 35299dd6be
commit 072dec5cc9
7 changed files with 85 additions and 38 deletions

View File

@@ -69,16 +69,10 @@ class Thelia extends Kernel
protected function initPropel()
{
if (defined('THELIA_INSTALL_MODE') === true) {
$serviceContainer = Propel::getServiceContainer();
$serviceContainer->setAdapterClass('thelia', 'sqlite');
$manager = new ConnectionManagerSingle();
$manager->setConfiguration(array(
"classname" => "\Propel\Runtime\Connection\PropelPDO",
"dsn" => "sqlite:".THELIA_ROOT . "/install/thelia.sqlite"
));
$serviceContainer->setConnectionManager('thelia', $manager);
} else {
if (file_exists(THELIA_ROOT . '/local/config/database.yml') === false) {
return ;
}
$definePropel = new DefinePropel(new DatabaseConfiguration(),
Yaml::parse(THELIA_ROOT . '/local/config/database.yml'));
$serviceContainer = Propel::getServiceContainer();
@@ -92,7 +86,6 @@ class Thelia extends Kernel
$serviceContainer->setLogger('defaultLogger', \Thelia\Log\Tlog::getInstance());
$con->useDebug(true);
}
}
}

View File

@@ -93,7 +93,7 @@ class Database
*/
public function createDatabase($dbName)
{
$this->connection->query(
$this->connection->exec(
sprintf(
"CREATE DATABASE IF NOT EXISTS %s CHARACTER SET utf8",
$dbName

View File

@@ -34,8 +34,6 @@ class Admin extends BaseAdmin implements UserInterface
public function setPassword($password)
{
\Thelia\Log\Tlog::getInstance()->debug($password);
if ($this->isNew() && ($password === null || trim($password) == "")) {
throw new \InvalidArgumentException("customer password is mandatory on creation");
}

Binary file not shown.

View File

@@ -21,12 +21,12 @@
/* */
/*************************************************************************************/
$step = 4;
$step = 5;
include("header.php");
global $thelia;
$err = isset($_GET['err']) && $_GET['err'];
if (!$err) {
if (!$err && $_SESSION['install']['step'] != $step) {
$checkConnection = new \Thelia\Install\CheckDatabaseConnection($_SESSION['install']['host'], $_SESSION['install']['username'], $_SESSION['install']['password'], $_SESSION['install']['port']);
$connection = $checkConnection->getConnection();
$connection->exec("SET NAMES UTF8");
@@ -41,10 +41,6 @@ if (!$err) {
$database->createDatabase($_SESSION['install']['database']);
}
if (!$connection->exec(sprintf('use %s', $_SESSION['install']['database']))) {
header('location: bdd.php?err=1');
}
$database->insertSql($_SESSION['install']['database']);
if(!file_exists(THELIA_ROOT . "/local/config/database.yml")) {
@@ -75,6 +71,8 @@ if (!$err) {
}
}
$_SESSION['install']['step'] = $step;
?>
<form action="end.php" method="POST" >
<div class="well">
@@ -98,13 +96,15 @@ if (!$err) {
<label for="site_name">Site name :</label>
<input id="site_name" class="form-control" type="text" name="site_name" placeholder="" value="" required>
</div>
<div class="form-group">
<label for="site_name">Site name :</label>
<input id="site_name" class="form-control" type="text" name="site_name" placeholder="" value="" required>
<div class="clearfix">
<div class="control-btn">
<button type="submit" class="pull-right btn btn-default btn-primary">Continue</button>
</div>
</div>
</div>
</form>
<?php include('footer.php'); ?>

57
web/install/end.php Normal file
View File

@@ -0,0 +1,57 @@
<?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/>. */
/* */
/*************************************************************************************/
$step=6;
include "header.php";
if($_SESSION['install']['step'] != $step && (empty($_POST['admin_login']) || empty($_POST['admin_password']) || ($_POST['admin_password'] != $_POST['admin_password_verif']))) {
header('location: config.php?err=1');
}
if($_SESSION['install']['step'] == 5) {
$admin = new \Thelia\Model\Admin();
$admin->setLogin($_POST['admin_login'])
->setPassword($_POST['admin_password'])
->setFirstname('admin')
->setLastname('admin')
->save();
$config = new \Thelia\Model\Config();
$config->setName('contact_email')
->setValue($_POST['email_contact'])
->save();
;
}
$_SESSION['install']['step'] = $step;
?>
<div class="well">
<p class="lead text-center">
Thank you have installed Thelia
</p>
<p class="lead text-center">
Don't forget to delete the web/install directory.
</p>
</div>
<?php include "footer.php"; ?>

View File

@@ -37,6 +37,5 @@
</div>
</footer>
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script src="http://thelia.local/assets/0a8bb9e-e6d174d.js"></script>
</body>
</html>