Rev 14507 | Rev 16766 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
<?php
/**
* Global Configuration Override
*
* You can use this file for overriding configuration values from modules, etc.
* You would place values in here that are agnostic to the environment and not
* sensitive to security.
*
* NOTE: In practice, this file will typically be INCLUDED in your source
* control, so do not include passwords or other sensitive information in this
* file.
*/
use Laminas\Session\Storage\SessionArrayStorage;
use Laminas\Session\Validator\RemoteAddr;
use Laminas\Session\Validator\HttpUserAgent;
use Laminas\Session\SaveHandler\Cache;
return [
'session' => [
'config' => [
'class' => 'Laminas\Session\Config\SessionConfig',
'options' => [
//'name' => 'LeadersLinked',
'use_cookies' => true,
'cookie_lifetime' => 60*60*24,
//'cookie_httponly' => true,
//'cookie_secure' => true,
//'cookie_domain' => 'leaderslinked.com',
'gc_maxlifetime' => 60*60*24*30,
],
],
'storage' => SessionArrayStorage::class,
'validators' => [
RemoteAddr::class,
HttpUserAgent::class,
],
],
'caches' => [
'leaders-linked-cache' => [
'adapter' => [
'name' =>'filesystem',
'options' => [
'ttl' => 7200,
],
],
/*'adapter' => [
'name' =>'memcached',
'options' => [
'ttl' => 7200,
'servers' => [
[
'host' => '127.0.0.1',
'port' =>11211
]
],
'namespace' => 'LL',
'liboptions' => [
'COMPRESSION' => true,
'binary_protocol' => true,
'no_block' => true,
'connect_timeout' => 100
]
],
],*/
'plugins' => [
'exception_handler' => [
'throw_exceptions' => false
],
],
]
],
/* 'db' => [
'adapters' => [
'leaders-linked-db' => [
'driver' => 'Pdo',
'dsn' => 'mysql:dbname=leaderslinked;host=localhost',
'username' => 'test',
'password' => 'T3st001-',
'driver_options' => array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''
),
],
]
],*/
'service_manager' => [
'factories' => [
//'Laminas\Db\Adapter\Adapter' => 'Laminas\Db\Adapter\AdapterServiceFactory',
'leaders-linked-db' => function ($sm) {
$config = $sm->get('config');
$sandbox = $config['leaderslinked.runmode.sandbox'];
if($sandbox) {
$host = $config['leaderslinked.database.sandbox_host'];
$port = $config['leaderslinked.database.sandbox_port'];
$dbname = $config['leaderslinked.database.sandbox_dbname'];
$user = $config['leaderslinked.database.sandbox_user'];
$password = $config['leaderslinked.database.sandbox_password'];
} else {
$host = $config['leaderslinked.database.production_host'];
$port = $config['leaderslinked.database.production_port'];
$dbname = $config['leaderslinked.database.production_dbname'];
$user = $config['leaderslinked.database.production_user'];
$password = $config['leaderslinked.database.production_password'];
}
$adapter = new \Laminas\Db\Adapter\Adapter([
'driver' => 'Pdo',
'dsn' => 'mysql:dbname=' . $dbname . ';host=' . $host . ';port=' . $port,
'username' => $user,
'password' => $password,
'driver_options' => [
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''
],
]);
return $adapter;
},
'leaders-linked-log' => function($sm) {
$formatter = new \Laminas\Log\Formatter\Base();
$formatter->setDateTimeFormat('Y-m-d H:i:s');
$mapping = array(
'timestamp' => 'added_on',
'priority' => 'priority_level',
'priorityName' => 'priority_name',
'message' => 'message',
'extra' => [
'user_id' => 'user_id',
'ip' => 'ip'
]
);
$adapter = $sm->get('leaders-linked-db');
$writer = new \Laminas\Log\Writer\Db($adapter, 'tbl_logs', $mapping);
$writer->setFormatter($formatter);
$logger = new \Laminas\Log\Logger();
$logger->addWriter($writer);
return $logger;
},
'leaders-linked-session' => function ($sm) {
$config = $sm->get('config');
if (isset($config['session'])) {
$session = $config['session'];
$sessionConfig = null;
if (isset($session['config'])) {
$class = isset($session['config']['class']) ? $session['config']['class'] : 'Laminas\Session\Config\SessionConfig';
$options = isset($session['config']['options']) ? $session['config']['options'] : [];
$options['remember_me_seconds'] = 7200; // 60 * 60 * 2seconds
$options['use_cookies'] = true;
$sessionConfig = new $class();
$sessionConfig->setOptions($options);
}
$sessionStorage = null;
if (isset($session['storage'])) {
$class = $session['storage'];
$sessionStorage = new $class();
}
$sessionManager = new \Laminas\Session\SessionManager();
$sessionManager->setConfig($sessionConfig);
$sessionManager->setStorage($sessionStorage);
$cache = $sm->get('leaders-linked-cache');
$saveHandler = new Cache($cache);
$sessionManager->setSaveHandler($saveHandler);
} else {
$sessionManager = new \Laminas\Session\SessionManager();
}
\Laminas\Session\Container::setDefaultManager($sessionManager);
return $sessionManager;
},
],
'abstract_factories' => [
'Laminas\Cache\Service\StorageCacheAbstractServiceFactory',
]
],
];