mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-13 19:51:30 +00:00
Build modified streamline images
The official image from streamline does not currently work for the arm64 platform. As a temporary measure, the source code and docker build scripts have been lifted from the official images and are used to build locally. Some additional modifications are made to reduce overall image size, these are documented in docker/README.md
This commit is contained in:
+97
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Cron;
|
||||
|
||||
use DateTimeInterface;
|
||||
|
||||
/**
|
||||
* Minutes field. Allows: * , / -.
|
||||
*/
|
||||
class MinutesField extends AbstractField
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $rangeStart = 0;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $rangeEnd = 59;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isSatisfiedBy(DateTimeInterface $date, $value, bool $invert):bool
|
||||
{
|
||||
if ($value === '?') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->isSatisfied((int)$date->format('i'), $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @param string|null $parts
|
||||
*/
|
||||
public function increment(DateTimeInterface &$date, $invert = false, $parts = null): FieldInterface
|
||||
{
|
||||
if (is_null($parts)) {
|
||||
$date = $this->timezoneSafeModify($date, ($invert ? "-" : "+") ."1 minute");
|
||||
return $this;
|
||||
}
|
||||
|
||||
$current_minute = (int) $date->format('i');
|
||||
|
||||
$parts = false !== strpos($parts, ',') ? explode(',', $parts) : [$parts];
|
||||
sort($parts);
|
||||
$minutes = [];
|
||||
foreach ($parts as $part) {
|
||||
$minutes = array_merge($minutes, $this->getRangeForExpression($part, 59));
|
||||
}
|
||||
|
||||
$position = $invert ? \count($minutes) - 1 : 0;
|
||||
if (\count($minutes) > 1) {
|
||||
for ($i = 0; $i < \count($minutes) - 1; ++$i) {
|
||||
if ((!$invert && $current_minute >= $minutes[$i] && $current_minute < $minutes[$i + 1]) ||
|
||||
($invert && $current_minute > $minutes[$i] && $current_minute <= $minutes[$i + 1])) {
|
||||
$position = $invert ? $i : $i + 1;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$target = (int) $minutes[$position];
|
||||
$originalMinute = (int) $date->format("i");
|
||||
|
||||
if (! $invert) {
|
||||
if ($originalMinute >= $target) {
|
||||
$distance = 60 - $originalMinute;
|
||||
$date = $this->timezoneSafeModify($date, "+{$distance} minutes");
|
||||
|
||||
$originalMinute = (int) $date->format("i");
|
||||
}
|
||||
|
||||
$distance = $target - $originalMinute;
|
||||
$date = $this->timezoneSafeModify($date, "+{$distance} minutes");
|
||||
} else {
|
||||
if ($originalMinute <= $target) {
|
||||
$distance = ($originalMinute + 1);
|
||||
$date = $this->timezoneSafeModify($date, "-{$distance} minutes");
|
||||
|
||||
$originalMinute = (int) $date->format("i");
|
||||
}
|
||||
|
||||
$distance = $originalMinute - $target;
|
||||
$date = $this->timezoneSafeModify($date, "-{$distance} minutes");
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user