static function continueWorkflow($workflowProcessID)
 {
     $operationResult = null;
     $theProcess = eZWorkflowProcess::fetch($workflowProcessID);
     if ($theProcess != null) {
         //restore memento and run it
         $bodyMemento = eZOperationMemento::fetchChild($theProcess->attribute('memento_key'));
         if ($bodyMemento === null) {
             eZDebug::writeError($bodyMemento, "Empty body memento in workflow.php");
             return $operationResult;
         }
         $bodyMementoData = $bodyMemento->data();
         $mainMemento = $bodyMemento->attribute('main_memento');
         if (!$mainMemento) {
             return $operationResult;
         }
         $mementoData = $bodyMemento->data();
         $mainMementoData = $mainMemento->data();
         $mementoData['main_memento'] = $mainMemento;
         $mementoData['skip_trigger'] = false;
         $mementoData['memento_key'] = $theProcess->attribute('memento_key');
         $bodyMemento->remove();
         $operationParameters = array();
         if (isset($mementoData['parameters'])) {
             $operationParameters = $mementoData['parameters'];
         }
         $operationResult = eZOperationHandler::execute($mementoData['module_name'], $mementoData['operation_name'], $operationParameters, $mementoData);
     }
     return $operationResult;
 }
 static function create($mementoKey, $data = array(), $isMainKey = false, $mainKey = null)
 {
     if (is_array($mementoKey)) {
         $mementoKey = eZOperationMemento::createKey($mementoKey);
     }
     $serializedData = serialize($data);
     return new eZOperationMemento(array('id' => null, 'main' => $isMainKey ? 1 : 0, 'memento_key' => $mementoKey, 'main_key' => $isMainKey ? $mementoKey : $mainKey, 'memento_data' => $serializedData));
 }
示例#3
0
    $offset = 0;
}
$limitList = array(1 => 10, 2 => 25, 3 => 50, 4 => 100);
$limit = 10;
$limitId = eZPreferences::value('admin_workflow_processlist_limit');
if ($limitId and isset($limitList[$limitId])) {
    $limit = $limitList[$limitId];
}
$viewParameters = array('offset' => $offset);
$plist = eZWorkflowProcess::fetchList($conds, true, $offset, $limit);
$plistCount = eZWorkflowProcess::count(eZWorkflowProcess::definition(), $conds);
$totalProcessCount = 0;
$outList2 = array();
foreach ($plist as $p) {
    $mementoMain = eZOperationMemento::fetchMain($p->attribute('memento_key'));
    $mementoChild = eZOperationMemento::fetchChild($p->attribute('memento_key'));
    if (!$mementoMain or !$mementoChild) {
        continue;
    }
    $mementoMainData = $mementoMain->data();
    $mementoChildData = $mementoChild->data();
    $triggers = eZTrigger::fetchList(array('module_name' => $mementoChildData['module_name'], 'function_name' => $mementoChildData['operation_name'], 'name' => $mementoChildData['name']));
    if (count($triggers) > 0) {
        $trigger = $triggers[0];
        if (is_object($trigger)) {
            $nkey = $trigger->attribute('module_name') . '/' . $trigger->attribute('function_name') . '/' . $trigger->attribute('name');
            if (!isset($outList2[$nkey])) {
                $outList2[$nkey] = array('trigger' => $trigger, 'process_list' => array());
            }
            $outList2[$nkey]['process_list'][] = $p;
            $totalProcessCount++;
示例#4
0
    if ( $productCount > 0 )
    {
        $cli->warning( "$productCount product collections still exists, must be a leak" );
    }
}

if ( $clean['forgotpassword'] )
{
    $cli->output( "Removing all forgot password requests" );
    eZForgotPassword::cleanup();
}

if ( $clean['workflow'] )
{
    $cli->output( "Removing all workflow processes and operation mementos" );
    eZOperationMemento::cleanup();
    eZWorkflowProcess::cleanup();
}

if ( $clean['collaboration'] )
{
    $cli->output( "Removing all collaboration elements" );
    eZCollaborationItem::cleanup();
}

if ( $clean['collectedinformation'] )
{
    $cli->output( "Removing all collected information" );
    eZInformationCollection::cleanup();
}
示例#5
0
            }
        }

        if ( $process->attribute( 'status' ) == eZWorkflow::STATUS_CANCELLED )
        {
            ++$removedProcessCount;
            $process->removeThis();
        }
        else
        {
            $process->store();
        }
    }
    else
    {   //restore memento and run it
        $bodyMemento = eZOperationMemento::fetchChild( $process->attribute( 'memento_key' ) );
        if ( $bodyMemento === null )
        {
            eZDebug::writeError( $bodyMemento, "Empty body memento in workflow.php" );
            $db->commit();
            continue;
        }
        $bodyMementoData = $bodyMemento->data();
        $mainMemento = $bodyMemento->attribute( 'main_memento' );
        if ( !$mainMemento )
        {
            $db->commit();
            continue;
        }

        $mementoData = $bodyMemento->data();
 function runWorkflow()
 {
     $workflowProcessList = eZWorkflowProcess::fetchForStatus(eZWorkflow::STATUS_DEFERRED_TO_CRON);
     foreach ($workflowProcessList as $process) {
         $workflow = eZWorkflow::fetch($process->attribute("workflow_id"));
         if ($process->attribute("event_id") != 0) {
             $workflowEvent = eZWorkflowEvent::fetch($process->attribute("event_id"));
         }
         $process->run($workflow, $workflowEvent, $eventLog);
         // Store changes to process
         if ($process->attribute('status') != eZWorkflow::STATUS_DONE) {
             if ($process->attribute('status') == eZWorkflow::STATUS_RESET || $process->attribute('status') == eZWorkflow::STATUS_FAILED || $process->attribute('status') == eZWorkflow::STATUS_NONE || $process->attribute('status') == eZWorkflow::STATUS_CANCELLED || $process->attribute('status') == eZWorkflow::STATUS_BUSY) {
                 $bodyMemento = eZOperationMemento::fetchMain($process->attribute('memento_key'));
                 $mementoList = eZOperationMemento::fetchList($process->attribute('memento_key'));
                 $bodyMemento->remove();
                 foreach ($mementoList as $memento) {
                     $memento->remove();
                 }
             }
             if ($process->attribute('status') == eZWorkflow::STATUS_CANCELLED) {
                 $process->removeThis();
             } else {
                 $process->store();
             }
         } else {
             //restore memento and run it
             $bodyMemento = eZOperationMemento::fetchChild($process->attribute('memento_key'));
             if (is_null($bodyMemento)) {
                 eZDebug::writeError($bodyMemento, "Empty body memento in workflow.php");
                 continue;
             }
             $bodyMementoData = $bodyMemento->data();
             $mainMemento = $bodyMemento->attribute('main_memento');
             if (!$mainMemento) {
                 continue;
             }
             $mementoData = $bodyMemento->data();
             $mainMementoData = $mainMemento->data();
             $mementoData['main_memento'] = $mainMemento;
             $mementoData['skip_trigger'] = true;
             $mementoData['memento_key'] = $process->attribute('memento_key');
             $bodyMemento->remove();
             $operationParameters = array();
             if (isset($mementoData['parameters'])) {
                 $operationParameters = $mementoData['parameters'];
             }
             $operationResult = eZOperationHandler::execute($mementoData['module_name'], $mementoData['operation_name'], $operationParameters, $mementoData);
             $process->removeThis();
         }
     }
 }
 /**
  * Packs the current body data (memento) for save & re-use
  *
  * @param string $bodyName
  * @param array $bodyKeys
  * @param array $operationKeys
  * @param array $operationParameterDefinitions
  * @param array $operationParameters
  * @param int $bodyCallCount
  * @param array $currentLoopData
  * @param string $operationName
  * @return The memento
  */
 function storeBodyMemento($bodyName, $bodyKeys, $operationKeys, $operationParameterDefinitions, $operationParameters, &$bodyCallCount, $currentLoopData, $operationName)
 {
     $this->storeOperationMemento($operationKeys, $operationParameterDefinitions, $operationParameters, $bodyCallCount, $operationName);
     $keyArray = $this->makeKeyArray($operationKeys, $operationParameterDefinitions, $operationParameters);
     $http = eZHTTPTool::instance();
     $keyArray['session_key'] = $http->sessionID();
     $mementoData = array();
     $mementoData['name'] = $bodyName;
     $mementoData['parameters'] = $operationParameters;
     $mementoData['loop_data'] = $currentLoopData;
     $mementoData['module_name'] = $this->ModuleName;
     $mementoData['operation_name'] = $operationName;
     $memento = eZOperationMemento::create($keyArray, $mementoData, false, $this->Memento->attribute('memento_key'));
     $memento->store();
     return $memento;
 }