mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Merge branch 'master' into PHRAS-2008_add_notice
This commit is contained in:
@@ -284,11 +284,20 @@ class ElasticsearchOptions
|
||||
'label' => 'Aperture',
|
||||
'field' => 'metadata_tags.Aperture',
|
||||
'query' => 'meta.Aperture=%s',
|
||||
'output_formatter' => function($value) {
|
||||
return round($value, 1);
|
||||
},
|
||||
],
|
||||
'shutterspeed_aggregate' => [
|
||||
'label' => 'Shutter speed',
|
||||
'field' => 'metadata_tags.ShutterSpeed',
|
||||
'query' => 'meta.ShutterSpeed=%s',
|
||||
'output_formatter' => function($value) {
|
||||
if($value < 1.0 && $value != 0) {
|
||||
$value = '1/' . round(1.0 / $value);
|
||||
}
|
||||
return $value . ' s.';
|
||||
},
|
||||
],
|
||||
'flashfired_aggregate' => [
|
||||
'label' => 'FlashFired',
|
||||
@@ -297,6 +306,10 @@ class ElasticsearchOptions
|
||||
'choices' => [
|
||||
"aggregated (2 values: fired = 0 or 1)" => -1,
|
||||
],
|
||||
'output_formatter' => function($value) {
|
||||
static $map = ['0'=>"No flash", '1'=>"Flash"];
|
||||
return array_key_exists($value, $map) ? $map[$value] : $value;
|
||||
},
|
||||
],
|
||||
'framerate_aggregate' => [
|
||||
'label' => 'FrameRate',
|
||||
|
@@ -7,6 +7,7 @@ use Alchemy\Phrasea\SearchEngine\Elastic\ElasticsearchOptions;
|
||||
use Alchemy\Phrasea\SearchEngine\Elastic\Structure\Structure;
|
||||
use Alchemy\Phrasea\SearchEngine\SearchEngineSuggestion;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use igorw;
|
||||
|
||||
class FacetsResponse
|
||||
{
|
||||
@@ -55,12 +56,21 @@ class FacetsResponse
|
||||
private function buildBucketsValues($name, $buckets)
|
||||
{
|
||||
$values = array();
|
||||
|
||||
// does this aggregate has an output_formatter ? if not use a equality formatter
|
||||
/** @var callable $formatter */
|
||||
$formatter = igorw\get_in(
|
||||
ElasticsearchOptions::getAggregableTechnicalFields(), [$name, 'output_formatter'],
|
||||
function($v){return $v;}
|
||||
);
|
||||
|
||||
foreach ($buckets as $bucket) {
|
||||
if (!isset($bucket['key']) || !isset($bucket['doc_count'])) {
|
||||
$this->throwAggregationResponseError();
|
||||
}
|
||||
|
||||
$values[] = array(
|
||||
'value' => $bucket['key'],
|
||||
'value' => $formatter($bucket['key']),
|
||||
'count' => $bucket['doc_count'],
|
||||
'query' => $this->buildQuery($name, $bucket['key']),
|
||||
);
|
||||
|
@@ -74,6 +74,6 @@ class PhpRequirements extends RequirementCollection implements RequirementInterf
|
||||
$this->addPhpIniRecommendation('session.use_cookies', true, true);
|
||||
|
||||
$this->addPhpIniRecommendation('session.cookie_http_only', true, true);
|
||||
$this->addPhpIniRecommendation('session.cookie_secure', true, true);
|
||||
$this->addPhpIniRecommendation('session.cookie_secure', true, true, 'session.cookie_secure should be enabled in php.ini, but only if you use HTTPS');
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user