diff --git a/instances/example/config/configuration_files.config.php b/instances/example/config/configuration_files.config.php index 1675e518..8a4d22d4 100644 --- a/instances/example/config/configuration_files.config.php +++ b/instances/example/config/configuration_files.config.php @@ -1,3 +1,4 @@ 'www.sifo.local', 'to' => 'http://sifo.local' ), + array( 'from' => 'www2.sifo.local', 'to' => 'http://sifo.local' ), +); + +$config['instance_type'] = 'instantiable'; + +$config['sifo.local'] = array( + 'devel' => true, // Domain is marked as development + 'has_debug' => true, // Domain shows the floating debug box. + 'instance' => 'example', + 'language' => 'en_US', + 'language_domain' =>'messages', + 'lang_in_subdomain' => array( 'es' => 'es_ES', 'en' => 'en_US' ), + 'www_as_subdomain' => false, + 'static_host' => 'http://static.sifo.local', + 'media_host' => 'http://static.sifo.local', // Alternative static content (media). Comment to disable. + 'database' => array( + 'db_driver' => 'mysql', // To use transactions you must use mysqli driver. + 'db_host' => '127.0.0.1', + 'db_user' => 'root', + 'db_password' => 'root', + 'db_name' => 'yourdatabase', + 'db_init_commands' => array( 'SET NAMES utf8' ) // Commands launched before the queries. + ), + 'php_ini_sets' => array( // Empty array if you don't want any php.ini overriden. + 'log_errors' => 'On', + 'error_log' => ROOT_PATH . '/logs/errors_' . date( 'Y-m' ) . '.log', // Store a different error file per month. For the lazy rotator :) + ), +); diff --git a/src/Sifo/Domains.php b/src/Sifo/Domains.php index cfd75dbc..8c950f5a 100644 --- a/src/Sifo/Domains.php +++ b/src/Sifo/Domains.php @@ -60,6 +60,21 @@ static public function getInstance() return self::$singleton; } + /** + * Singleton for domain calculation. + * + * @return Domains + */ + static public function getInstanceFromDomainName($domainName) + { + if ( !isset( self::$singleton ) ) + { + self::$singleton = new self($domainName); + } + + return self::$singleton; + } + private function __construct( $host = null ) { $filter_server = FilterServer::getInstance(); diff --git a/test/Sifo/DomainsTest.php b/test/Sifo/DomainsTest.php new file mode 100644 index 00000000..76d7cdf6 --- /dev/null +++ b/test/Sifo/DomainsTest.php @@ -0,0 +1,19 @@ +assertSame(self::DOMAIN_NAME, $domain->getDomain()); + } +} diff --git a/test/bootstrap.php b/test/bootstrap.php index a23c8c70..d2f6b46f 100644 --- a/test/bootstrap.php +++ b/test/bootstrap.php @@ -10,4 +10,6 @@ if (false === defined('ROOT_PATH')) { define('ROOT_PATH', $rootDir); } + +$_SERVER['HTTP_HOST'] = 'sifo.local'; Bootstrap::$instance = 'example';