private function __construct() { $connectionSettings = ConfigHandler::LoadConfigFile("db"); switch ($connectionSettings['type']) { case 'cassandra': require_once(ROOT_PDIR . 'core/libs/phpcassa-0.7.a.4/connection.php'); require_once(ROOT_PDIR . 'core/libs/core/ADODB_cassandra.class.php'); $this->connection = new ADODB_cassandra(); $this->connection->connect($connectionSettings['server'], null, null, $connectionSettings['name']); //var_dump($this->connection); die(); break; default: $dsn = "{$connectionSettings['type']}://" . "{$connectionSettings['user']}:{$connectionSettings['pass']}" . "@{$connectionSettings['server']}" . "/{$connectionSettings['name']}" . "?persist&fetchmode=ASSOC"; $this->connection =& ADONewConnection($dsn); break; } // No go? if (!$this->connection) return; // Caching? // @todo Make this a config option. //$this->connection->memCache = true; //$this->connection->memCacheHost = 'localhost'; //$this->connection->memCacheCompress = false; }
/** * @param $key * @param int $expires * * @return Cache\CacheInterface */ private static function _Factory($key, $expires = 7200){ if(self::$_Backend === null){ // Load the backend from the site configuration.xml $cs = \ConfigHandler::LoadConfigFile("configuration"); self::$_Backend = $cs['cache_type']; } if(isset(self::$_KeyCache[$key])){ return self::$_KeyCache[$key]; } switch(self::$_Backend){ case 'apc': if(!class_exists('CacheAPC')){ require_once(__CACHE_PDIR . 'backends/cacheapc.class.php'); ##SKIPCOMPILER } $obj = new CacheAPC($key, null, $expires); break; case 'memcache': case 'memcached': if(!class_exists('Core\Cache\Memcache')){ require_once(__CACHE_PDIR . 'Memcache.php'); ##SKIPCOMPILER } $obj = new Cache\Memcache($key, $expires); break; case 'file': default: if(!class_exists('Core\Cache\File')){ require_once(__CACHE_PDIR . 'File.php'); ##SKIPCOMPILER } if(!is_dir(TMP_DIR . 'cache')){ mkdir(TMP_DIR . 'cache'); } $obj = new Cache\File($key, $expires); break; } self::$_KeyCache[$key] = $obj; return $obj; }
require_once(ROOT_PDIR . 'core/libs/core/templates/Exception.php'); require_once(ROOT_PDIR . 'core/libs/core/templates/backends/PHTML.php'); require_once(ROOT_PDIR . 'install/classes/InstallerStep.php'); require_once(ROOT_PDIR . 'core/functions/Core.functions.php'); require_once(ROOT_PDIR . 'core/libs/core/utilities/logger/functions.php'); require_once(ROOT_PDIR . 'install/utilities.php'); require_once(ROOT_PDIR . "core/libs/core/ConfigHandler.class.php"); // If the configuration file has been written already, load up those config options! if(file_exists(ROOT_PDIR . 'config/configuration.xml')){ require_once(ROOT_PDIR . 'core/libs/core/datamodel/DMI.class.php'); require_once(ROOT_PDIR . "core/libs/core/HookHandler.class.php"); try { HookHandler::singleton(); ConfigHandler::LoadConfigFile('configuration'); } catch (Exception $e) { // Yeah... I probably don't care at this stage... but maybe I do... \Core\ErrorManagement\exception_handler($e); } } if(!defined('CDN_TYPE')){ define('CDN_TYPE', 'local'); } if(!defined('CDN_LOCAL_ASSETDIR')){ define('CDN_LOCAL_ASSETDIR', 'files/assets/'); } if(!defined('CDN_LOCAL_PUBLICDIR')){ define('CDN_LOCAL_PUBLICDIR', 'files/public/');
require_once(ROOT_PDIR . 'core/functions/Core.functions.php'); require_once(ROOT_PDIR . 'core/libs/core/utilities/logger/functions.php'); require_once(ROOT_PDIR . 'install/utilities.php'); require_once(ROOT_PDIR . 'core/libs/core/utilities/profiler/Profiler.php'); require_once(ROOT_PDIR . 'core/libs/core/utilities/profiler/DatamodelProfiler.php'); require_once(ROOT_PDIR . 'core/libs/core/utilities/logger/functions.php'); require_once(ROOT_PDIR . "core/libs/core/ConfigHandler.class.php"); // If the configuration file has been written already, load up those config options! if(file_exists(ROOT_PDIR . 'config/configuration.xml')){ require_once(ROOT_PDIR . 'core/libs/core/datamodel/DMI.class.php'); require_once(ROOT_PDIR . "core/libs/core/HookHandler.class.php"); try { HookHandler::singleton(); $core_settings = ConfigHandler::LoadConfigFile('configuration'); $tmpdir = $core_settings['tmp_dir_web']; if(!defined('TMP_DIR')) { /** * Temporary directory */ define('TMP_DIR', $tmpdir); } } catch (Exception $e) { // Yeah... I probably don't care at this stage... but maybe I do... \Core\ErrorManagement\exception_handler($e); } }
/** * Get the current system DMI based on configuration values. * * @throws DMI_Exception * @throws DMI_Authentication_Exception * * @return DMI */ public static function GetSystemDMI(){ if(self::$_Interface !== null) return self::$_Interface; self::$_Interface = new DMI(); if(file_exists(ROOT_PDIR . 'config/configuration.xml')){ // Because this is the system data connection, I also need to pull the settings automatically. // This will only be done if the configuration file exists. $cs = ConfigHandler::LoadConfigFile("configuration"); } elseif(\Core\Session::Get('configs/*') !== null){ // If the file doesn't exist, (ie: during installation), I need to check the session data. $cs = \Core\Session::Get('configs/*'); } else{ throw new DMI_Exception('No database settings defined for the DMI'); } self::$_Interface->setBackend($cs['database_type']); self::$_Interface->connect($cs['database_server'], $cs['database_user'], $cs['database_pass'], $cs['database_name']); return self::$_Interface; }
Core\Utilities\Logger\write_debug('Loading core system'); //require_once(ROOT_PDIR . 'core/libs/core/InstallTask.class.php'); require_once(ROOT_PDIR . 'core/libs/core/Core.class.php'); //Core::Singleton(); // Configuration handler, for loading any config variable/constant from XML data or the database. Core\Utilities\Logger\write_debug('Loading configs'); require_once(ROOT_PDIR . "core/libs/core/ConfigHandler.class.php"); ConfigHandler::Singleton(); \Core\Utilities\Profiler\Profiler::GetDefaultProfiler()->record('Configuration loaded and available'); // Give me core settings! // This will do the defines for the site, and provide any core variables to get started. $core_settings = ConfigHandler::LoadConfigFile("configuration"); if (!$core_settings) { if(EXEC_MODE == 'WEB'){ $newURL = 'install/'; //header('HTTP/1.1 302 Moved Temporarily'); //header("Location:" . $newURL); // This is not just redirected automatically because many browsers remember the redirect and just insist on redirecting from / to /install! // The notice about needing to refresh the page is again, because browsers may cache the install message. die("Please <a href=\"{$newURL}\">install Core Plus.</a><br/><br/>(You may need to hard-refresh this page a time or two if you just installed)"); } else{ die('Please install core plus through the web interface first!' . "\n"); } }