diff --git a/app/Providers/Annotation.php b/app/Providers/Annotation.php index f4d4ec68..28273a94 100644 --- a/app/Providers/Annotation.php +++ b/app/Providers/Annotation.php @@ -26,15 +26,19 @@ class Annotation extends Provider $this->di->setShared($this->serviceName, function () use ($config) { if ($config->get('env') == ENV_DEV) { + $annotations = new MemoryAnnotations(); + } else { + $statsKey = '_ANNOTATION_'; + $annotations = new RedisAnnotations([ 'host' => $config->path('redis.host'), 'port' => $config->path('redis.port'), 'auth' => $config->path('redis.auth'), - 'index' => $config->path('redis.index') ?: 0, - 'lifetime' => $config->path('annotation.lifetime') ?: 30 * 86400, + 'index' => $config->path('redis.index'), + 'lifetime' => $config->path('annotation.lifetime'), 'prefix' => $statsKey . ':', 'statsKey' => $statsKey, ]); diff --git a/app/Providers/Cache.php b/app/Providers/Cache.php index 283dfcd7..dadaed95 100644 --- a/app/Providers/Cache.php +++ b/app/Providers/Cache.php @@ -33,7 +33,7 @@ class Cache extends Provider 'host' => $config->path('redis.host'), 'port' => $config->path('redis.port'), 'auth' => $config->path('redis.auth'), - 'index' => $config->path('redis.index') ?: 0, + 'index' => $config->path('redis.index'), ]); }); } diff --git a/app/Providers/Database.php b/app/Providers/Database.php index e4116a64..d39f3dfa 100644 --- a/app/Providers/Database.php +++ b/app/Providers/Database.php @@ -42,8 +42,11 @@ class Database extends Provider $connection = new MySqlAdapter($options); if ($config->get('env') == ENV_DEV) { + $eventsManager = new EventsManager(); + $eventsManager->attach('db', new DbListener()); + $connection->setEventsManager($eventsManager); } diff --git a/app/Providers/MetaData.php b/app/Providers/MetaData.php index 7c6b4426..9f0cdbb2 100644 --- a/app/Providers/MetaData.php +++ b/app/Providers/MetaData.php @@ -26,15 +26,19 @@ class MetaData extends Provider $this->di->setShared($this->serviceName, function () use ($config) { if ($config->get('env') == ENV_DEV) { + $metaData = new MemoryMetaData(); + } else { + $statsKey = '_METADATA_'; + $metaData = new RedisMetaData([ 'host' => $config->path('redis.host'), 'port' => $config->path('redis.port'), 'auth' => $config->path('redis.auth'), - 'index' => $config->path('redis.index') ?: 0, - 'lifetime' => $config->path('metadata.lifetime') ?: 30 * 86400, + 'index' => $config->path('redis.index'), + 'lifetime' => $config->path('metadata.lifetime'), 'prefix' => $statsKey . ':', 'statsKey' => $statsKey, ]); diff --git a/app/Providers/Session.php b/app/Providers/Session.php index 17226821..8bfdc2a3 100644 --- a/app/Providers/Session.php +++ b/app/Providers/Session.php @@ -28,8 +28,8 @@ class Session extends Provider 'host' => $config->path('redis.host'), 'port' => $config->path('redis.port'), 'auth' => $config->path('redis.auth'), - 'index' => $config->path('redis.index') ?: 0, - 'lifetime' => $config->path('session.lifetime') ?: 24 * 3600, + 'index' => $config->path('redis.index'), + 'lifetime' => $config->path('session.lifetime'), 'prefix' => '_SESSION_:', ]); diff --git a/app/Providers/Volt.php b/app/Providers/Volt.php index 1e4b4e3a..b2e469e5 100644 --- a/app/Providers/Volt.php +++ b/app/Providers/Volt.php @@ -99,6 +99,16 @@ class Volt extends Provider return 'kg_anonymous(' . $resolvedArgs . ')'; }); + $compiler->addFilter('split', function ($resolvedArgs, $exprArgs) use ($compiler) { + $firstArgument = $compiler->expression($exprArgs[0]['expr']); + if (isset($exprArgs[1])) { + $secondArgument = $compiler->expression($exprArgs[1]['expr']); + } else { + $secondArgument = ''; + } + return sprintf('explode(%s,%s)', $secondArgument, $firstArgument); + }); + return $volt; }); }