Tinebase ActionQueue - cli execute call passed job as array
authorPaul Mehrer <p.mehrer@metaways.de>
Tue, 4 Jul 2017 12:27:10 +0000 (14:27 +0200)
committerPaul Mehrer <p.mehrer@metaways.de>
Tue, 4 Jul 2017 13:36:22 +0000 (15:36 +0200)
receiving functions (like Calendar_Controller::sendEventNotifications)
may receive json serialized data and needs to be able to handle arrays

Change-Id: I9cb31f05502ed141a256632e7060fa99f903d7fd
Reviewed-on: http://gerrit.tine20.com/customers/5011
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Paul Mehrer <p.mehrer@metaways.de>
Tested-by: Paul Mehrer <p.mehrer@metaways.de>
tine20/Calendar/Controller.php
tine20/Tinebase/ActionQueue/Worker.php

index d440c73..2b58591 100644 (file)
@@ -408,13 +408,19 @@ class Calendar_Controller extends Tinebase_Controller_Event implements Tinebase_
      * send notifications 
      * 
      * @param Calendar_Model_Event       $_event
-     * @param Tinebase_Model_FullAccount $_updater
-     * @param Sting                      $_action
+     * @param Tinebase_Model_FullUser    $_updater
+     * @param String                     $_action
      * @param Calendar_Model_Event       $_oldEvent
      * @return void
      */
     public function sendEventNotifications($_event, $_updater, $_action, $_oldEvent = NULL)
     {
+        if (is_array($_event)) {
+            $_event = new Calendar_Model_Event($_event, true);
+        }
+        if (is_array($_oldEvent)) {
+            $_oldEvent = new Calendar_Model_Event($_oldEvent, true);
+        }
         Calendar_Controller_EventNotifications::getInstance()->doSendNotifications($_event, $_updater, $_action, $_oldEvent);
     }
     
index 99845dd..78d65eb 100755 (executable)
@@ -232,6 +232,10 @@ class Tinebase_ActionQueue_Worker extends Console_Daemon
         // execute in subprocess
         //if ($this->_getConfig()->tine20->executionMethod === self::EXECUTION_METHOD_EXEC_CLI) {
         chdir(__DIR__);
+            if (is_object($job)) {
+                /** @var Tinebase_Record_Interface $job */
+                $job = $job->toArray(true);
+            }
             exec('php -d include_path=' . escapeshellarg(get_include_path()) .
                 ' ./../../tine20.php --method Tinebase.executeQueueJob message=' .
                 escapeshellarg(json_encode($job)), $output, $exitCode);