commit
19c2d0fddc
@ -58,10 +58,9 @@ return function(array $config_array = []) {
|
|||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
// Create Config Object
|
// Create Config Object
|
||||||
$container->set('config', function() {
|
$container->set('config', function() use ($config_array) {
|
||||||
return new Config();
|
return new Config($config_array);
|
||||||
});
|
});
|
||||||
$container->setInstance('config', new Config($config_array));
|
|
||||||
|
|
||||||
// Create Cache Object
|
// Create Cache Object
|
||||||
$container->set('cache', function($container) {
|
$container->set('cache', function($container) {
|
||||||
|
@ -17,15 +17,19 @@
|
|||||||
namespace Aviat\AnimeClient\Command;
|
namespace Aviat\AnimeClient\Command;
|
||||||
|
|
||||||
use Aura\Session\SessionFactory;
|
use Aura\Session\SessionFactory;
|
||||||
use Aviat\AnimeClient\AnimeClient;
|
use Aviat\AnimeClient\{
|
||||||
|
AnimeClient,
|
||||||
|
Model,
|
||||||
|
Util
|
||||||
|
};
|
||||||
use Aviat\AnimeClient\Auth\HummingbirdAuth;
|
use Aviat\AnimeClient\Auth\HummingbirdAuth;
|
||||||
use Aviat\AnimeClient\Model;
|
use Aviat\Banker\Pool;
|
||||||
use Aviat\AnimeClient\Util;
|
|
||||||
use Aviat\Ion\Cache\CacheManager;
|
|
||||||
use Aviat\Ion\Config;
|
use Aviat\Ion\Config;
|
||||||
use Aviat\Ion\Di\Container;
|
use Aviat\Ion\Di\Container;
|
||||||
use ConsoleKit\Command;
|
use ConsoleKit\Command;
|
||||||
use ConsoleKit\Widgets\Box;
|
use ConsoleKit\Widgets\Box;
|
||||||
|
use Monolog\Handler\RotatingFileHandler;
|
||||||
|
use Monolog\Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for console command setup
|
* Base class for console command setup
|
||||||
@ -54,24 +58,30 @@ class BaseCommand extends Command {
|
|||||||
*/
|
*/
|
||||||
protected function setupContainer()
|
protected function setupContainer()
|
||||||
{
|
{
|
||||||
$CONF_DIR = realpath(__DIR__ . '/../../app/config/');
|
$APP_DIR = realpath(__DIR__ . '/../../app');
|
||||||
|
$CONF_DIR = realpath("{$APP_DIR}/config/");
|
||||||
require_once $CONF_DIR . '/base_config.php'; // $base_config
|
require_once $CONF_DIR . '/base_config.php'; // $base_config
|
||||||
|
|
||||||
$config = AnimeClient::loadToml($CONF_DIR);
|
$config = AnimeClient::loadToml($CONF_DIR);
|
||||||
$config_array = array_merge($base_config, $config);
|
$config_array = array_merge($base_config, $config);
|
||||||
|
|
||||||
$di = function ($config_array) {
|
$di = function ($config_array) use ($APP_DIR) {
|
||||||
$container = new Container();
|
$container = new Container();
|
||||||
|
|
||||||
|
$app_logger = new Logger('animeclient');
|
||||||
|
$app_logger->pushHandler(new RotatingFileHandler("{$APP_DIR}/logs/app.log", Logger::NOTICE));
|
||||||
|
$container->setLogger($app_logger, 'default');
|
||||||
|
|
||||||
// Create Config Object
|
// Create Config Object
|
||||||
$container->set('config', function() {
|
$container->set('config', function() use ($config_array) {
|
||||||
return new Config();
|
return new Config($config_array);
|
||||||
});
|
});
|
||||||
$container->setInstance('config', $config_array);
|
|
||||||
|
|
||||||
// Create Cache Object
|
// Create Cache Object
|
||||||
$container->set('cache', function($container) {
|
$container->set('cache', function($container) {
|
||||||
return new CacheManager($container->get('config'));
|
$logger = $container->getLogger();
|
||||||
|
$config = $container->get('config')->get('cache');
|
||||||
|
return new Pool($config, $logger);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create session Object
|
// Create session Object
|
||||||
|
@ -37,4 +37,3 @@ class ClearCache extends BaseCommand {
|
|||||||
$this->echoBox('API Cache has been cleared.');
|
$this->echoBox('API Cache has been cleared.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// End of ClearCache.php
|
|
@ -100,8 +100,8 @@ class MenuGenerator extends UrlGenerator {
|
|||||||
|
|
||||||
foreach ($menu_config as $title => $path)
|
foreach ($menu_config as $title => $path)
|
||||||
{
|
{
|
||||||
$has = $this->string($path)->contains($this->path());
|
$has = $this->string($this->path())->contains($path);
|
||||||
$selected = ($has && strlen($path) >= strlen($this->path()));
|
$selected = ($has && strlen($this->path()) >= strlen($path));
|
||||||
|
|
||||||
$link = $this->helper->a($this->url($path), $title);
|
$link = $this->helper->a($this->url($path), $title);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user