nstall step Please enter the commit message for your changes. Lines starting
This commit is contained in:
@@ -69,29 +69,22 @@ class Thelia extends Kernel
|
|||||||
|
|
||||||
protected function initPropel()
|
protected function initPropel()
|
||||||
{
|
{
|
||||||
if (defined('THELIA_INSTALL_MODE') === true) {
|
if (file_exists(THELIA_ROOT . '/local/config/database.yml') === false) {
|
||||||
$serviceContainer = Propel::getServiceContainer();
|
return ;
|
||||||
$serviceContainer->setAdapterClass('thelia', 'sqlite');
|
}
|
||||||
$manager = new ConnectionManagerSingle();
|
|
||||||
$manager->setConfiguration(array(
|
$definePropel = new DefinePropel(new DatabaseConfiguration(),
|
||||||
"classname" => "\Propel\Runtime\Connection\PropelPDO",
|
Yaml::parse(THELIA_ROOT . '/local/config/database.yml'));
|
||||||
"dsn" => "sqlite:".THELIA_ROOT . "/install/thelia.sqlite"
|
$serviceContainer = Propel::getServiceContainer();
|
||||||
));
|
$serviceContainer->setAdapterClass('thelia', 'mysql');
|
||||||
$serviceContainer->setConnectionManager('thelia', $manager);
|
$manager = new ConnectionManagerSingle();
|
||||||
} else {
|
$manager->setConfiguration($definePropel->getConfig());
|
||||||
$definePropel = new DefinePropel(new DatabaseConfiguration(),
|
$serviceContainer->setConnectionManager('thelia', $manager);
|
||||||
Yaml::parse(THELIA_ROOT . '/local/config/database.yml'));
|
$con = Propel::getConnection(\Thelia\Model\Map\ProductTableMap::DATABASE_NAME);
|
||||||
$serviceContainer = Propel::getServiceContainer();
|
$con->setAttribute(ConnectionWrapper::PROPEL_ATTR_CACHE_PREPARES, true);
|
||||||
$serviceContainer->setAdapterClass('thelia', 'mysql');
|
if ($this->isDebug()) {
|
||||||
$manager = new ConnectionManagerSingle();
|
$serviceContainer->setLogger('defaultLogger', \Thelia\Log\Tlog::getInstance());
|
||||||
$manager->setConfiguration($definePropel->getConfig());
|
$con->useDebug(true);
|
||||||
$serviceContainer->setConnectionManager('thelia', $manager);
|
|
||||||
$con = Propel::getConnection(\Thelia\Model\Map\ProductTableMap::DATABASE_NAME);
|
|
||||||
$con->setAttribute(ConnectionWrapper::PROPEL_ATTR_CACHE_PREPARES, true);
|
|
||||||
if ($this->isDebug()) {
|
|
||||||
$serviceContainer->setLogger('defaultLogger', \Thelia\Log\Tlog::getInstance());
|
|
||||||
$con->useDebug(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ class Database
|
|||||||
*/
|
*/
|
||||||
public function createDatabase($dbName)
|
public function createDatabase($dbName)
|
||||||
{
|
{
|
||||||
$this->connection->query(
|
$this->connection->exec(
|
||||||
sprintf(
|
sprintf(
|
||||||
"CREATE DATABASE IF NOT EXISTS %s CHARACTER SET utf8",
|
"CREATE DATABASE IF NOT EXISTS %s CHARACTER SET utf8",
|
||||||
$dbName
|
$dbName
|
||||||
|
|||||||
@@ -34,8 +34,6 @@ class Admin extends BaseAdmin implements UserInterface
|
|||||||
|
|
||||||
public function setPassword($password)
|
public function setPassword($password)
|
||||||
{
|
{
|
||||||
\Thelia\Log\Tlog::getInstance()->debug($password);
|
|
||||||
|
|
||||||
if ($this->isNew() && ($password === null || trim($password) == "")) {
|
if ($this->isNew() && ($password === null || trim($password) == "")) {
|
||||||
throw new \InvalidArgumentException("customer password is mandatory on creation");
|
throw new \InvalidArgumentException("customer password is mandatory on creation");
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -21,12 +21,12 @@
|
|||||||
/* */
|
/* */
|
||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
|
|
||||||
$step = 4;
|
$step = 5;
|
||||||
include("header.php");
|
include("header.php");
|
||||||
global $thelia;
|
global $thelia;
|
||||||
$err = isset($_GET['err']) && $_GET['err'];
|
$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']);
|
$checkConnection = new \Thelia\Install\CheckDatabaseConnection($_SESSION['install']['host'], $_SESSION['install']['username'], $_SESSION['install']['password'], $_SESSION['install']['port']);
|
||||||
$connection = $checkConnection->getConnection();
|
$connection = $checkConnection->getConnection();
|
||||||
$connection->exec("SET NAMES UTF8");
|
$connection->exec("SET NAMES UTF8");
|
||||||
@@ -41,10 +41,6 @@ if (!$err) {
|
|||||||
$database->createDatabase($_SESSION['install']['database']);
|
$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']);
|
$database->insertSql($_SESSION['install']['database']);
|
||||||
|
|
||||||
if(!file_exists(THELIA_ROOT . "/local/config/database.yml")) {
|
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" >
|
<form action="end.php" method="POST" >
|
||||||
<div class="well">
|
<div class="well">
|
||||||
@@ -98,13 +96,15 @@ if (!$err) {
|
|||||||
<label for="site_name">Site name :</label>
|
<label for="site_name">Site name :</label>
|
||||||
<input id="site_name" class="form-control" type="text" name="site_name" placeholder="" value="" required>
|
<input id="site_name" class="form-control" type="text" name="site_name" placeholder="" value="" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="clearfix">
|
||||||
<label for="site_name">Site name :</label>
|
<div class="control-btn">
|
||||||
<input id="site_name" class="form-control" type="text" name="site_name" placeholder="" value="" required>
|
<button type="submit" class="pull-right btn btn-default btn-primary">Continue</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<?php include('footer.php'); ?>
|
||||||
|
|
||||||
|
|||||||
57
web/install/end.php
Normal file
57
web/install/end.php
Normal 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"; ?>
|
||||||
@@ -37,6 +37,5 @@
|
|||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
|
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
|
||||||
<script src="http://thelia.local/assets/0a8bb9e-e6d174d.js"></script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user