1
0
mirror of https://github.com/mrclay/minify.git synced 2025-08-19 04:11:20 +02:00

add checkAllowDirs to sourceFactoryOptions

needed to be able to specify the option via config
This commit is contained in:
Elan Ruusamäe
2016-10-12 16:34:39 +03:00
parent 60b89dcc0d
commit 9ca1bc9e74

View File

@@ -3,7 +3,6 @@
namespace Minify;
use Props\Container;
use Psr\Log\LoggerInterface;
/**
* @property \Minify_CacheInterface $cache
@@ -104,12 +103,14 @@ class App extends Container {
if (empty($config->documentRoot)) {
return $app->env->getDocRoot();
}
return $app->env->normalizePath($config->documentRoot);
};
$this->env = function (App $app) {
$config = $app->config;
$envArgs = empty($config->envArgs) ? array() : $config->envArgs;
return new \Minify_Env($envArgs);
};
@@ -117,6 +118,7 @@ class App extends Container {
$format = "%channel%.%level_name%: %message% %context% %extra%";
$handler = new \Monolog\Handler\ErrorLogHandler();
$handler->setFormatter(new \Monolog\Formatter\LineFormatter($format));
return $handler;
};
@@ -142,11 +144,13 @@ class App extends Container {
if ($value === true || $value instanceof \FirePHP) {
$logger->pushHandler($app->errorLogHandler);
$logger->pushHandler(new \Monolog\Handler\FirePHPHandler());
return $logger;
}
if ($value instanceof \Monolog\Handler\HandlerInterface) {
$logger->pushHandler($value);
return $logger;
}
@@ -154,6 +158,7 @@ class App extends Container {
if (is_object($value) && is_callable(array($value, 'log'))) {
$handler = new \Minify\Logger\LegacyHandler($value);
$logger->pushHandler($handler);
return $logger;
}
@@ -232,6 +237,10 @@ class App extends Container {
$ret['allowDirs'] = $serveOptions['minApp']['allowDirs'];
}
if (isset($serveOptions['checkAllowDirs'])) {
$ret['checkAllowDirs'] = $serveOptions['checkAllowDirs'];
}
if (is_numeric($app->config->uploaderHoursBehind)) {
$ret['uploaderHoursBehind'] = $app->config->uploaderHoursBehind;
}
@@ -258,6 +267,7 @@ class App extends Container {
*/
private function typeOf($var) {
$type = gettype($var);
return $type === 'object' ? get_class($var) : $type;
}
}