Merge branch 'master' into PHRAS-2529_enable_debug_depending_on_environment

This commit is contained in:
Nicolas Maillat
2019-05-16 22:29:57 +02:00
committed by GitHub
29 changed files with 2694 additions and 3670 deletions

View File

@@ -74,10 +74,10 @@ class PermalinkController extends AbstractDelivery
public function deliverPermaview(Request $request, $sbas_id, $record_id, $subdef)
{
return $this->doDeliverPermaview($sbas_id, $record_id, $request->query->get('token'), $subdef);
return $this->doDeliverPermaview($sbas_id, $record_id, $request->query->get('token'), $subdef, $request->query->get('t'));
}
private function doDeliverPermaview($sbas_id, $record_id, $token, $subdefName)
private function doDeliverPermaview($sbas_id, $record_id, $token, $subdefName, $currentTime = null)
{
$databox = $this->findDataboxById($sbas_id);
$record = $this->retrieveRecord($databox, $token, $record_id, $subdefName);
@@ -105,6 +105,7 @@ class PermalinkController extends AbstractDelivery
'token' => $token,
'record' => $record,
'recordUrl' => $information->getUrl(),
'currentTime' => $currentTime
]);
}

View File

@@ -43,7 +43,7 @@ class SubdefsEditor extends AbstractEditor
<?xml version="1.0" encoding="UTF-8"?>
<tasksettings>
<embedded>1</embedded>
<sbas/>
<sbas>0</sbas>
<type_image>1</type_image>
<type_video>1</type_video>
<type_audio>1</type_audio>

View File

@@ -26,6 +26,7 @@ use PHPExiftool\Driver\Metadata\Metadata;
use PHPExiftool\Driver\Value\Mono as MonoValue;
use Symfony\Component\Filesystem\Exception\IOException;
class ArchiveJob extends AbstractJob
{
const MINCOLD = 5;
@@ -69,6 +70,10 @@ class ArchiveJob extends AbstractJob
protected function doJob(JobData $data)
{
$app = $data->getApplication();
// quick fix to reconnect if mysql is lost
$app->getApplicationBox()->get_connection();
$task = $data->getTask();
$settings = simplexml_load_string($task->getSettings());
@@ -82,6 +87,9 @@ class ArchiveJob extends AbstractJob
$databox = $app->findDataboxById($sbasId);
// quick fix to reconnect if mysql is lost
$databox->get_connection();
$TColls = [];
$collection = null;
foreach ($databox->get_collections() as $coll) {
@@ -561,6 +569,10 @@ class ArchiveJob extends AbstractJob
private function archive(Application $app, \databox $databox, \DOMDOcument $dom, \DOMElement $node, $path, $path_archived, $path_error, $depth, $moveError, $moveArchived, $stat0, $stat1)
{
// quick fix to reconnect if mysql is lost
$app->getApplicationBox()->get_connection();
$databox->get_connection();
if ($node->getAttribute('temperature') == 'hot') {
return;
}
@@ -819,6 +831,10 @@ class ArchiveJob extends AbstractJob
private function archiveGrp(Application $app, \databox $databox, \DOMDocument $dom, \DOMElement $node, $path, $path_archived, $path_error, array &$nodesToDel, $moveError, $moveArchived, $stat0, $stat1)
{
// quick fix to reconnect if mysql is lost
$app->getApplicationBox()->get_connection();
$databox->get_connection();
$xpath = new \DOMXPath($dom);
// grp folders stay in place
@@ -983,6 +999,10 @@ class ArchiveJob extends AbstractJob
public function createStory(Application $app, \collection $collection, $pathfile, $captionFile, $stat0, $stat1)
{
// quick fix to reconnect if mysql is lost
$app->getApplicationBox()->get_connection();
$databox->get_connection();
$status = \databox_status::operation_or($stat0, $stat1);
$media = $app->getMediaFromUri($pathfile);
@@ -1031,6 +1051,10 @@ class ArchiveJob extends AbstractJob
*/
public function createRecord(Application $app, \collection $collection, $pathfile, $captionFile, $grp_rid, $force, $stat0, $stat1)
{
// quick fix to reconnect if mysql is lost
$app->getApplicationBox()->get_connection();
$collection->get_connection();
$status = \databox_status::operation_or($stat0, $stat1);
$media = $app->getMediaFromUri($pathfile);
@@ -1096,6 +1120,10 @@ class ArchiveJob extends AbstractJob
*/
private function archiveFilesToGrp(Application $app, \databox $databox, \DOMDocument $dom, \DOMElement $node, $path, $path_archived, $path_error, $grp_rid, $stat0, $stat1, $moveError, $moveArchived)
{
// quick fix to reconnect if mysql is lost
$app->getApplicationBox()->get_connection();
$databox->get_connection();
$nodesToDel = [];
for ($n = $node->firstChild; $n; $n = $n->nextSibling) {
if (!$this->isStarted()) {
@@ -1133,6 +1161,10 @@ class ArchiveJob extends AbstractJob
*/
private function archiveFile(Application $app, \databox $databox, \DOMDocument $dom, \DOMElement $node, $path, $path_archived, $path_error, array &$nodesToDel, $grp_rid, $stat0, $stat1, $moveError, $moveArchived)
{
// quick fix to reconnect if mysql is lost
$app->getApplicationBox()->get_connection();
$databox->get_connection();
$match = $node->getAttribute('match');
if ($match == '*') {
@@ -1187,6 +1219,10 @@ class ArchiveJob extends AbstractJob
*/
private function archiveFileAndCaption(Application $app, \databox $databox, \DOMDocument $dom, \DOMElement $node, \DOMElement $captionFileNode = null, $path, $path_archived, $path_error, $grp_rid, array &$nodesToDel, $stat0, $stat1, $moveError, $moveArchived)
{
// quick fix to reconnect if mysql is lost
$app->getApplicationBox()->get_connection();
$databox->get_connection();
$file = $node->getAttribute('name');
$cid = $node->getAttribute('cid');
$captionFileName = $captionFileNode ? $captionFileNode->getAttribute('name') : null;
@@ -1360,6 +1396,9 @@ class ArchiveJob extends AbstractJob
*/
protected function getLazaretSession(Application $app)
{
// quick fix to reconnect if mysql is lost
$app->getApplicationBox()->get_connection();
$lazaretSession = new LazaretSession();
$app['orm.em']->persist($lazaretSession);

View File

@@ -70,12 +70,13 @@ class SubdefsJob extends AbstractJob
$app->getApplicationBox()->get_connection();
$allDb = count($settings->xpath('sbas[text()="0"]')) > 0;
foreach ($app->getDataboxes() as $databox) {
if (!$this->isStarted()) {
break;
}
if(count($settings->xpath("sbas[text()=".$databox->get_sbas_id() ."]")) == 0) {
if(!$allDb && count($settings->xpath("sbas[text()=".$databox->get_sbas_id() ."]")) == 0) {
continue;
}

View File

@@ -25,7 +25,7 @@ class Notifier implements NotifierInterface
private $logger;
/** @var integer */
private $timeout = 10;
private $timeout = 1;
public function __construct(\ZMQSocket $socket, LoggerInterface $logger)
{