diff --git a/core/lib/Thelia/Core/Thelia.php b/core/lib/Thelia/Core/Thelia.php index eb560a484..b446af221 100755 --- a/core/lib/Thelia/Core/Thelia.php +++ b/core/lib/Thelia/Core/Thelia.php @@ -69,23 +69,32 @@ class Thelia extends Kernel protected function initPropel() { - if (file_exists(THELIA_ROOT . '/local/config/database.yml') === false) { - return ; + 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 { + $definePropel = new DefinePropel(new DatabaseConfiguration(), + Yaml::parse(THELIA_ROOT . '/local/config/database.yml')); + $serviceContainer = Propel::getServiceContainer(); + $serviceContainer->setAdapterClass('thelia', 'mysql'); + $manager = new ConnectionManagerSingle(); + $manager->setConfiguration($definePropel->getConfig()); + $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); + } } - $definePropel = new DefinePropel(new DatabaseConfiguration(), - Yaml::parse(THELIA_ROOT . '/local/config/database.yml')); - $serviceContainer = Propel::getServiceContainer(); - $serviceContainer->setAdapterClass('thelia', 'mysql'); - $manager = new ConnectionManagerSingle(); - $manager->setConfiguration($definePropel->getConfig()); - $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); - } + } /** diff --git a/install/thelia.sqlite b/install/thelia.sqlite new file mode 100644 index 000000000..65d4cb6a9 Binary files /dev/null and b/install/thelia.sqlite differ