From 01d39068b94e8d0fa6b018176088b02cf4c8f878 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Thu, 17 Mar 2011 11:18:42 +0100 Subject: [PATCH] moved doctrine path to config file --- etc/volkszaehler.conf.template.php | 10 ++++++++-- htdocs/backend.php | 12 +++++++----- misc/tools/doctrine.php | 13 +++++++------ 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/etc/volkszaehler.conf.template.php b/etc/volkszaehler.conf.template.php index 24ff351..589f174 100644 --- a/etc/volkszaehler.conf.template.php +++ b/etc/volkszaehler.conf.template.php @@ -57,20 +57,26 @@ $config['db']['password'] = 'demo'; */ $config['db']['dbname'] = 'volkszaehler'; -/* +/** * For administration tasks (used by doctrine cli and the setup script) * the following $['db']['admin'] settings will be merged with $config['db'] */ //$config['db']['admin']['user'] = 'vz_admin'; //$config['db']['admin']['password'] = 'admin_demo'; - /** * @var string path of the sqlite database * @link http://www.doctrine-project.org/projects/dbal/2.0/docs/reference/configuration/en */ //$config['db']['path'] = 'volkszaehler'; +/** + * Set to NULL to use PHP's include path + * @var string path of Doctrine library + * @link http://www.php.net/manual/en/ini.core.php#ini.include-path + */ +$config['lib']['doctrine'] = VZ_DIR . '/lib/vendor/Doctrine'; + /** @var boolean disables some optimizations. Only use it when you exactly know what you are doing. */ $config['devmode'] = FALSE; diff --git a/htdocs/backend.php b/htdocs/backend.php index bb956ea..262b110 100644 --- a/htdocs/backend.php +++ b/htdocs/backend.php @@ -36,19 +36,21 @@ define('VZ_DIR', realpath(__DIR__ . '/..')); define('VZ_VERSION', '0.2'); // class autoloading -require VZ_DIR . '/lib/Util/ClassLoader.php'; +require_once VZ_DIR . '/lib/Util/ClassLoader.php'; +require_once VZ_DIR . '/lib/Util/Configuration.php'; + +// load configuration +Util\Configuration::load(VZ_DIR . '/etc/volkszaehler.conf'); $classLoaders = array( - new Util\ClassLoader('Volkszaehler', VZ_DIR . '/lib'), - new Util\ClassLoader('Doctrine', VZ_DIR . '/lib/vendor/Doctrine') + new Util\ClassLoader('Doctrine', Util\Configuration::read('lib.doctrine')), + new Util\ClassLoader('Volkszaehler', VZ_DIR . '/lib') ); foreach ($classLoaders as $loader) { $loader->register(); // register on SPL autoload stack } -Util\Configuration::load(VZ_DIR . '/etc/volkszaehler.conf'); - $r = new Router(); $r->run(); $r->view->send(); diff --git a/misc/tools/doctrine.php b/misc/tools/doctrine.php index d30f167..483dd5f 100644 --- a/misc/tools/doctrine.php +++ b/misc/tools/doctrine.php @@ -30,20 +30,21 @@ define('VZ_DIR', realpath(__DIR__ . '/../..')); // class autoloading require_once VZ_DIR . '/lib/Util/ClassLoader.php'; +require_once VZ_DIR . '/lib/Util/Configuration.php'; + +// load configuration +Util\Configuration::load(VZ_DIR . '/etc/volkszaehler.conf'); $classLoaders = array( - new Volkszaehler\Util\ClassLoader('Doctrine', VZ_DIR . '/lib/vendor/Doctrine'), - new Volkszaehler\Util\ClassLoader('Symfony', VZ_DIR . '/lib/vendor/Doctrine/Symfony'), - new Volkszaehler\Util\ClassLoader('Volkszaehler', VZ_DIR . '/lib') + new Util\ClassLoader('Doctrine', Util\Configuration::read('lib.doctrine')), + new Util\ClassLoader('Symfony', VZ_DIR . '/lib/vendor/Doctrine/Symfony'), + new Util\ClassLoader('Volkszaehler', VZ_DIR . '/lib') ); foreach ($classLoaders as $loader) { $loader->register(); // register on SPL autoload stack } -// load configuration -Util\Configuration::load(VZ_DIR . '/etc/volkszaehler.conf'); - $em = Volkszaehler\Router::createEntityManager(TRUE); // get admin credentials $helperSet = new \Symfony\Component\Console\Helper\HelperSet(array(