Merge branch 'master' into PHRAS-2504-ginga-subtitle

This commit is contained in:
Nicolas Maillat
2020-07-08 23:43:36 +02:00
committed by GitHub
4 changed files with 25 additions and 20 deletions

View File

@@ -37,7 +37,7 @@ RUN echo "deb http://deb.debian.org/debian stretch main non-free" > /etc/apt/sou
swftools \
unoconv \
unzip \
xpdf \
poppler-utils \
libreoffice-base-core \
libreoffice-impress \
libreoffice-calc \

View File

@@ -11,13 +11,10 @@
namespace Alchemy\Phrasea\SearchEngine\Elastic;
use Alchemy\Phrasea\SearchEngine\Elastic\Exception\MergeException;
use Alchemy\Phrasea\SearchEngine\Elastic\Mapping;
use Alchemy\Phrasea\SearchEngine\Elastic\Structure\Field;
use Alchemy\Phrasea\SearchEngine\Elastic\Structure\Flag;
use appbox;
use DateTime;
use igorw;
use Exception;
class RecordHelper
{
@@ -100,31 +97,31 @@ class RecordHelper
$a = explode(';', preg_replace('/\D+/', ';', trim($value)));
switch (count($a)) {
case 1: // yyyy
$date = new \DateTime($a[0] . '-01-01'); // will throw if date is not valid
$date = new DateTime($a[0] . '-01-01'); // will throw if date is not valid
$v_fix = $date->format('Y');
break;
case 2: // yyyy;mm
$date = new \DateTime( $a[0] . '-' . $a[1] . '-01');
$date = new DateTime( $a[0] . '-' . $a[1] . '-01');
$v_fix = $date->format('Y-m');
break;
case 3: // yyyy;mm;dd
$date = new \DateTime($a[0] . '-' . $a[1] . '-' . $a[2]);
$date = new DateTime($a[0] . '-' . $a[1] . '-' . $a[2]);
$v_fix = $date->format('Y-m-d');
break;
case 4:
$date = new \DateTime($a[0] . '-' . $a[1] . '-' . $a[2] . ' ' . $a[3] . ':00:00');
$date = new DateTime($a[0] . '-' . $a[1] . '-' . $a[2] . ' ' . $a[3] . ':00:00');
$v_fix = $date->format('Y-m-d H:i:s');
break;
case 5:
$date = new \DateTime($a[0] . '-' . $a[1] . '-' . $a[2] . ' ' . $a[3] . ':' . $a[4] . ':00');
$date = new DateTime($a[0] . '-' . $a[1] . '-' . $a[2] . ' ' . $a[3] . ':' . $a[4] . ':00');
$v_fix = $date->format('Y-m-d H:i:s');
break;
case 6:
$date = new \DateTime($a[0] . '-' . $a[1] . '-' . $a[2] . ' ' . $a[3] . ':' . $a[4] . ':' . $a[5]);
$date = new DateTime($a[0] . '-' . $a[1] . '-' . $a[2] . ' ' . $a[3] . ':' . $a[4] . ':' . $a[5]);
$v_fix = $date->format('Y-m-d H:i:s');
break;
}
} catch (\Exception $e) {
} catch (Exception $e) {
// no-op, v_fix = null
}
@@ -151,8 +148,16 @@ class RecordHelper
return (bool) $value;
case FieldMapping::TYPE_STRING:
$value = substr($value, 0, 32766); // for lucene limit, before a better solution
return str_replace("\0", '', $value);
$value = str_replace("\0", '', $value); // no null char for lucene !
if( strlen($value) > 32766) { // for lucene limit, before a better solution
for($l=32766; $l > 0; $l--) {
if(ord(substr($value, $l-1, 1)) < 128) {
break;
}
}
$value = substr($value, 0, $l);
}
return $value;
default:
return $value;

View File

@@ -65,7 +65,7 @@
"normalize-css": "^2.1.0",
"npm": "^6.0.0",
"npm-modernizr": "^2.8.3",
"phraseanet-production-client": "0.34.254-d",
"phraseanet-production-client": "0.34.255-d",
"requirejs": "^2.3.5",
"tinymce": "^4.0.28",
"underscore": "^1.8.3",

View File

@@ -7678,10 +7678,10 @@ phraseanet-common@^0.4.5-d:
js-cookie "^2.1.0"
pym.js "^1.3.1"
phraseanet-production-client@0.34.254-d:
version "0.34.254-d"
resolved "https://registry.yarnpkg.com/phraseanet-production-client/-/phraseanet-production-client-0.34.254-d.tgz#52a798b8c1f9994cf677db6ad6aeb9909c811f80"
integrity sha512-EvTbTbDbdoWGfqZtqJGEl6xeE6vyk43IF5eVMCy7c6qkaYjTuyiTqvI8eMXSJ2gKvsEidaa6AsHigUL9lKuVcA==
phraseanet-production-client@0.34.255-d:
version "0.34.255-d"
resolved "https://registry.yarnpkg.com/phraseanet-production-client/-/phraseanet-production-client-0.34.255-d.tgz#40e9c97ebb5fd77dd117f2d766126a94437b63ff"
integrity sha512-UQpkjhkKLPF63107y1nG+cd1wxUq2jAmbO58yrp3tJLsfQt1nGAkUfvZb9VEJ3/zbvKcjRmjnHHFDa08RcViww==
dependencies:
"@mapbox/mapbox-gl-language" "^0.9.2"
"@turf/turf" "^5.1.6"