@@ -193,7 +193,7 @@ |
||
193 | 193 | protected function getWorkflowName($workflowDefinitionName) |
194 | 194 | { |
195 | 195 | $mtime = explode(' ', microtime()); |
196 | - $time = date('YmdHis', $mtime[1]). substr($mtime[0], 2, 3); |
|
196 | + $time = date('YmdHis', $mtime[1]) . substr($mtime[0], 2, 3); |
|
197 | 197 | return $time . '/' . getmypid() . '/' . $workflowDefinitionName; |
198 | 198 | } |
199 | 199 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | if (count($workflowDefinitions)) { |
51 | 51 | |
52 | 52 | $workflowParameters = array(); |
53 | - foreach($signalParameters as $parameter => $value) { |
|
53 | + foreach ($signalParameters as $parameter => $value) { |
|
54 | 54 | $convertedParameter = $this->convertSignalMember($signalName, $parameter); |
55 | 55 | $workflowParameters['signal:' . $convertedParameter] = $value; |
56 | 56 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | { |
119 | 119 | $defs = array(); |
120 | 120 | |
121 | - foreach($this->innerService->getMigrationsDefinitions() as $key => $definition) { |
|
121 | + foreach ($this->innerService->getMigrationsDefinitions() as $key => $definition) { |
|
122 | 122 | if ($definition->status == MigrationDefinition::STATUS_TO_PARSE) { |
123 | 123 | $definition = $this->innerService->parseMigrationDefinition($definition); |
124 | 124 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $defs = array(); |
148 | 148 | $resources = array(); |
149 | 149 | |
150 | - foreach($this->getWorkflowsDefinitions($paths) as $key => $definition) { |
|
150 | + foreach ($this->getWorkflowsDefinitions($paths) as $key => $definition) { |
|
151 | 151 | /// @todo add safety check that we got back in fact a WorkflowDefinition |
152 | 152 | if ($definition->signalName === $signalName && $definition->status == MigrationDefinition::STATUS_PARSED) { |
153 | 153 | $defs[$key] = $definition; |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | $collection = new MigrationDefinitionCollection($defs); |
159 | 159 | |
160 | - $code = '<?php return '.var_export($collection, true).';'; |
|
160 | + $code = '<?php return ' . var_export($collection, true) . ';'; |
|
161 | 161 | $cache->write($code, $resources); |
162 | 162 | |
163 | 163 | return $collection; |
@@ -45,7 +45,9 @@ discard block |
||
45 | 45 | { |
46 | 46 | $workflowDefinitions = $this->getValidWorkflowsDefinitionsForSignal($signalName); |
47 | 47 | |
48 | - if ($this->logger) $this->logger->debug("Found " . count($workflowDefinitions) . " workflow definitions for signal '$signalName'"); |
|
48 | + if ($this->logger) { |
|
49 | + $this->logger->debug("Found " . count($workflowDefinitions) . " workflow definitions for signal '$signalName'"); |
|
50 | + } |
|
49 | 51 | |
50 | 52 | if (count($workflowDefinitions)) { |
51 | 53 | |
@@ -59,7 +61,9 @@ discard block |
||
59 | 61 | foreach ($workflowDefinitions as $workflowDefinition) { |
60 | 62 | |
61 | 63 | if (self::$workflowExecuting > 0 && $workflowDefinition->avoidRecursion) { |
62 | - if ($this->logger) $this->logger->debug("Skipping workflow '{$workflowDefinition->name}' to avoid recursion (workflow already executing)"); |
|
64 | + if ($this->logger) { |
|
65 | + $this->logger->debug("Skipping workflow '{$workflowDefinition->name}' to avoid recursion (workflow already executing)"); |
|
66 | + } |
|
63 | 67 | return; |
64 | 68 | } |
65 | 69 | |
@@ -83,7 +87,9 @@ discard block |
||
83 | 87 | self::$workflowExecuting += 1; |
84 | 88 | try { |
85 | 89 | |
86 | - if ($this->logger) $this->logger->debug("Executing workflow '{$workflowDefinition->name}' with parameters: " . preg_replace("/\n+/s", ' ', preg_replace('/^(Array| +|\(|\))/m', '', print_r($workflowParameters, true)))); |
|
90 | + if ($this->logger) { |
|
91 | + $this->logger->debug("Executing workflow '{$workflowDefinition->name}' with parameters: " . preg_replace("/\n+/s", ' ', preg_replace('/^(Array| +|\(|\))/m', '', print_r($workflowParameters, true)))); |
|
92 | + } |
|
87 | 93 | |
88 | 94 | /// @todo allow setting of default lang ? |
89 | 95 | $this->innerService->executeMigration($wfd, $workflowDefinition->useTransaction, null, $workflowDefinition->runAs, false, null, $workflowParameters); |
@@ -62,7 +62,7 @@ |
||
62 | 62 | $avoidRecursion = $dsl[WorkflowDefinition::MANIFEST_AVOIDRECURSION_ELEMENT]; |
63 | 63 | } |
64 | 64 | |
65 | - } while(false); |
|
65 | + } while (false); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | return new WorkflowDefinition( |
@@ -5,25 +5,25 @@ discard block |
||
5 | 5 | const WORKFLOW_TYPE_STRING = 'ezworkflowenginehook'; |
6 | 6 | |
7 | 7 | static $signalMapping = array( |
8 | - 'content_addlocation' => array( 'pre' => false, 'post' => 'LocationService\CreateLocationSignal' ), |
|
8 | + 'content_addlocation' => array('pre' => false, 'post' => 'LocationService\CreateLocationSignal'), |
|
9 | 9 | // this legacy operation does not allow us to retrieve in all scenarios the object_id, needed for the corresponding signal |
10 | 10 | //'content_delete' => array( 'pre' => false, 'post' => 'ContentService\DeleteContentSignal' ), |
11 | - 'content_hide' => array( 'pre' => false, 'post' => 'LocationService\HideLocationSignal' ), |
|
12 | - 'content_move' => array( 'pre' => false, 'post' => 'LocationService\MoveSubtreeSignal' ), |
|
13 | - 'content_publish' => array( 'pre' => false, 'post' => 'ContentService\PublishVersionSignal' ), |
|
11 | + 'content_hide' => array('pre' => false, 'post' => 'LocationService\HideLocationSignal'), |
|
12 | + 'content_move' => array('pre' => false, 'post' => 'LocationService\MoveSubtreeSignal'), |
|
13 | + 'content_publish' => array('pre' => false, 'post' => 'ContentService\PublishVersionSignal'), |
|
14 | 14 | // this legacy operation does not allow us to retrieve in all scenarios the object_id, needed for the corresponding signal |
15 | 15 | //'content_removelocation' => array( 'pre' => false, 'post' => 'LocationService\DeleteLocationSignal' ), |
16 | 16 | // this legacy operation does not seem to have any corresponding eZ5 signal... |
17 | 17 | //'content_removetranslation' => '', |
18 | - 'content_sort' => array( 'pre' => false, 'post' => 'LocationService\UpdateLocationSignal' ), |
|
19 | - 'content_swap' => array( 'pre' => false, 'post' => 'LocationService\SwapLocationSignal' ), |
|
20 | - 'content_updatealwaysavailable' => array( 'pre' => false, 'post' => 'ContentService\UpdateContentMetadataSignal' ), |
|
21 | - 'content_updateinitiallanguage' => array( 'pre' => false, 'post' => 'ContentService\UpdateContentMetadataSignal' ), |
|
22 | - 'content_updatemainassignment' => array( 'pre' => false, 'post' => 'ContentService\UpdateContentMetadataSignal' ), |
|
18 | + 'content_sort' => array('pre' => false, 'post' => 'LocationService\UpdateLocationSignal'), |
|
19 | + 'content_swap' => array('pre' => false, 'post' => 'LocationService\SwapLocationSignal'), |
|
20 | + 'content_updatealwaysavailable' => array('pre' => false, 'post' => 'ContentService\UpdateContentMetadataSignal'), |
|
21 | + 'content_updateinitiallanguage' => array('pre' => false, 'post' => 'ContentService\UpdateContentMetadataSignal'), |
|
22 | + 'content_updatemainassignment' => array('pre' => false, 'post' => 'ContentService\UpdateContentMetadataSignal'), |
|
23 | 23 | // this legacy operation needs hackish workarounds to retrieve the modified state(s), needed for the corresponding signal |
24 | 24 | //'content_updateobjectstate' => 'ObjectStateService\SetContentStateSignal' ), |
25 | - 'content_updatepriority' => array( 'pre' => false, 'post' => 'LocationService\UpdateLocationSignal' ), |
|
26 | - 'content_updatesection' => array( 'pre' => false, 'post' => 'SectionService\AssignSectionSignal' ), |
|
25 | + 'content_updatepriority' => array('pre' => false, 'post' => 'LocationService\UpdateLocationSignal'), |
|
26 | + 'content_updatesection' => array('pre' => false, 'post' => 'SectionService\AssignSectionSignal'), |
|
27 | 27 | ); |
28 | 28 | |
29 | 29 | /** |
@@ -31,38 +31,38 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function __construct() |
33 | 33 | { |
34 | - $this->eZWorkflowEventType( self::WORKFLOW_TYPE_STRING, ezpI18n::tr( 'ezworkflowengine/eventtypes', 'Run WorkFlowEngineBundle workflows' ) ); |
|
35 | - $this->setTriggerTypes( array( '*' => true ) ); |
|
34 | + $this->eZWorkflowEventType(self::WORKFLOW_TYPE_STRING, ezpI18n::tr('ezworkflowengine/eventtypes', 'Run WorkFlowEngineBundle workflows')); |
|
35 | + $this->setTriggerTypes(array('*' => true)); |
|
36 | 36 | } |
37 | 37 | |
38 | - public function execute( $process, $event ) |
|
38 | + public function execute($process, $event) |
|
39 | 39 | { |
40 | - $parameters = $process->attribute( 'parameter_list' ); |
|
41 | - $tmp = explode( '_', $parameters['trigger_name'], 2 ); |
|
42 | - $triggerName = reset( $tmp ); |
|
40 | + $parameters = $process->attribute('parameter_list'); |
|
41 | + $tmp = explode('_', $parameters['trigger_name'], 2); |
|
42 | + $triggerName = reset($tmp); |
|
43 | 43 | $operationName = $parameters['module_name'] . '_' . $parameters['module_function']; |
44 | 44 | |
45 | - $signalName = $this->getsignalName( $triggerName, $operationName ); |
|
46 | - if ( !$signalName ) |
|
45 | + $signalName = $this->getsignalName($triggerName, $operationName); |
|
46 | + if (!$signalName) |
|
47 | 47 | { |
48 | - eZDebug::writeError( "Trigger '$triggerName $operationName' can not be mapped to eZ5 workflow signal. Aborting eZ4 workflow" ); |
|
48 | + eZDebug::writeError("Trigger '$triggerName $operationName' can not be mapped to eZ5 workflow signal. Aborting eZ4 workflow"); |
|
49 | 49 | return eZWorkflowType::STATUS_REJECTED; |
50 | 50 | } |
51 | 51 | |
52 | - $signalsParameters = $this->convertParameters( $triggerName, $operationName, $parameters ); |
|
52 | + $signalsParameters = $this->convertParameters($triggerName, $operationName, $parameters); |
|
53 | 53 | |
54 | - if ( !$signalsParameters ) |
|
54 | + if (!$signalsParameters) |
|
55 | 55 | { |
56 | - eZDebug::writeNotice( "Parameters for trigger '$triggerName $operationName' do not map to an eZ5 workflow. Continuing the eZ4 workflow" ); |
|
56 | + eZDebug::writeNotice("Parameters for trigger '$triggerName $operationName' do not map to an eZ5 workflow. Continuing the eZ4 workflow"); |
|
57 | 57 | // this is a way to gracefully avoid triggering eZ5 workflows without failing the ez4 one |
58 | 58 | return eZWorkflowType::STATUS_ACCEPTED; |
59 | 59 | } |
60 | 60 | |
61 | 61 | foreach ($signalsParameters as $signalParameters) |
62 | 62 | { |
63 | - if ( !is_array( $signalParameters ) || ! count( $signalParameters ) ) |
|
63 | + if (!is_array($signalParameters) || !count($signalParameters)) |
|
64 | 64 | { |
65 | - eZDebug::writeError( "Parameters for trigger '$triggerName $operationName' can not be mapped to eZ5 workflow parameters. Aborting eZ4 workflow" ); |
|
65 | + eZDebug::writeError("Parameters for trigger '$triggerName $operationName' can not be mapped to eZ5 workflow parameters. Aborting eZ4 workflow"); |
|
66 | 66 | return eZWorkflowType::STATUS_REJECTED; |
67 | 67 | } |
68 | 68 | |
@@ -70,18 +70,18 @@ discard block |
||
70 | 70 | $signalParameters['legacyOperation'] = $operationName; |
71 | 71 | |
72 | 72 | $serviceContainer = ezpKernel::instance()->getServiceContainer(); |
73 | - $workflowService = $serviceContainer->get( 'ez_workflowengine_bundle.workflow_service' ); |
|
73 | + $workflowService = $serviceContainer->get('ez_workflowengine_bundle.workflow_service'); |
|
74 | 74 | |
75 | 75 | try |
76 | 76 | { |
77 | - eZDebug::writeDebug( "Triggering any eZ5 workflows available for signal '$signalName' with parameters:" . |
|
78 | - preg_replace( "/\n+/s", ' ', preg_replace('/^(Array| +|\(|\))/m', '', print_r( $signalParameters, true ) ) ), |
|
77 | + eZDebug::writeDebug("Triggering any eZ5 workflows available for signal '$signalName' with parameters:" . |
|
78 | + preg_replace("/\n+/s", ' ', preg_replace('/^(Array| +|\(|\))/m', '', print_r($signalParameters, true))), |
|
79 | 79 | __METHOD__ |
80 | 80 | ); |
81 | - $workflowService->triggerWorkflow( $signalName, $signalParameters ); |
|
82 | - } catch ( \Exception $e ) |
|
81 | + $workflowService->triggerWorkflow($signalName, $signalParameters); |
|
82 | + } catch (\Exception $e) |
|
83 | 83 | { |
84 | - eZDebug::writeError( $e->getMessage(), __METHOD__ ); |
|
84 | + eZDebug::writeError($e->getMessage(), __METHOD__); |
|
85 | 85 | return eZWorkflowType::STATUS_REJECTED; |
86 | 86 | } |
87 | 87 | } |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | * @param string $operationName |
96 | 96 | * @return string mixed |
97 | 97 | */ |
98 | - protected function getsignalName( $triggerName, $operationName ) |
|
98 | + protected function getsignalName($triggerName, $operationName) |
|
99 | 99 | { |
100 | - if ( !isset( self::$signalMapping[$operationName][$triggerName] ) ) |
|
100 | + if (!isset(self::$signalMapping[$operationName][$triggerName])) |
|
101 | 101 | { |
102 | 102 | return $triggerName . '_' . $operationName; |
103 | 103 | } |
@@ -112,26 +112,26 @@ discard block |
||
112 | 112 | * @return array[] Each element is an array of parameters, used to trigger an ez5 workflow. Return array( false ) |
113 | 113 | * for error conditions and array() to ignore ez5 workflows but continue the ez4 one |
114 | 114 | */ |
115 | - protected function convertParameters( $triggerName, $operationName, array $parameters ) |
|
115 | + protected function convertParameters($triggerName, $operationName, array $parameters) |
|
116 | 116 | { |
117 | 117 | /// @see https://doc.ez.no/display/EZP/Signals+reference |
118 | - switch( $operationName ) |
|
118 | + switch ($operationName) |
|
119 | 119 | { |
120 | 120 | case 'content_addlocation': |
121 | 121 | $out = array(); |
122 | 122 | // loop over all locations of content and find the ones which are children of the parents from the trigger |
123 | 123 | // NB: will break if eZ allows to create 2 locations in the same place for a single content... |
124 | 124 | $locations = eZContentObjectTreeNode::fetchByContentObjectID($parameters['object_id']); |
125 | - foreach( $parameters['select_node_id_array'] as $parentNodeId ) |
|
125 | + foreach ($parameters['select_node_id_array'] as $parentNodeId) |
|
126 | 126 | { |
127 | - foreach( $locations as $contentLocation ) |
|
127 | + foreach ($locations as $contentLocation) |
|
128 | 128 | { |
129 | - if ( $contentLocation->attribute( 'parent_node_id' ) == $parentNodeId ) |
|
129 | + if ($contentLocation->attribute('parent_node_id') == $parentNodeId) |
|
130 | 130 | { |
131 | 131 | $out[] = array( |
132 | 132 | 'contentId' => $parameters['object_id'], |
133 | 133 | /// @todo grab location id of created node |
134 | - 'locationId' => $contentLocation->attribute( 'node_id' ), |
|
134 | + 'locationId' => $contentLocation->attribute('node_id'), |
|
135 | 135 | ); |
136 | 136 | break; |
137 | 137 | } |
@@ -148,26 +148,26 @@ discard block |
||
148 | 148 | |
149 | 149 | case 'content_hide': |
150 | 150 | $objectId = $this->objectIdFromNodeId($parameters['node_id']); |
151 | - if ( !$objectId ) |
|
151 | + if (!$objectId) |
|
152 | 152 | { |
153 | - return array( false ); |
|
153 | + return array(false); |
|
154 | 154 | } |
155 | - return array( array( |
|
155 | + return array(array( |
|
156 | 156 | 'locationId' => $parameters['node_id'], |
157 | 157 | 'contentId' => $objectId, |
158 | - ) ); |
|
158 | + )); |
|
159 | 159 | |
160 | 160 | case 'content_move': |
161 | - return array( array( |
|
161 | + return array(array( |
|
162 | 162 | 'subtreeId' => $parameters['node_id'], |
163 | 163 | 'newParentLocationId' => $parameters['new_parent_node_id'], |
164 | - ) ); |
|
164 | + )); |
|
165 | 165 | |
166 | 166 | case 'content_publish': |
167 | - return array( array( |
|
167 | + return array(array( |
|
168 | 168 | 'contentId' => $parameters['object_id'], |
169 | 169 | 'versionNo' => $parameters['version'], |
170 | - ) ); |
|
170 | + )); |
|
171 | 171 | |
172 | 172 | /*case 'content_removelocation': |
173 | 173 | $out = array(); |
@@ -203,66 +203,66 @@ discard block |
||
203 | 203 | //case 'content_removetranslation': |
204 | 204 | |
205 | 205 | case 'content_sort': |
206 | - $objectId = $this->objectIdFromNodeId( $parameters['node_id'] ); |
|
207 | - if ( !$objectId ) |
|
206 | + $objectId = $this->objectIdFromNodeId($parameters['node_id']); |
|
207 | + if (!$objectId) |
|
208 | 208 | { |
209 | - return array( false ); |
|
209 | + return array(false); |
|
210 | 210 | } |
211 | - return array( array( |
|
211 | + return array(array( |
|
212 | 212 | 'contentId' => $objectId, |
213 | 213 | 'locationId' => $parameters['node_id'], |
214 | - ) ); |
|
214 | + )); |
|
215 | 215 | |
216 | 216 | case 'content_swap': |
217 | - $objectId1 = $this->objectIdFromNodeId( $parameters['node_id'] ); |
|
218 | - $objectId2 = $this->objectIdFromNodeId( $parameters['selected_node_id'] ); |
|
219 | - if ( !$objectId1 || !$objectId2 ) |
|
217 | + $objectId1 = $this->objectIdFromNodeId($parameters['node_id']); |
|
218 | + $objectId2 = $this->objectIdFromNodeId($parameters['selected_node_id']); |
|
219 | + if (!$objectId1 || !$objectId2) |
|
220 | 220 | { |
221 | - return array( false ); |
|
221 | + return array(false); |
|
222 | 222 | } |
223 | - return array( array( |
|
223 | + return array(array( |
|
224 | 224 | 'content1Id' => $objectId1, |
225 | 225 | 'location1Id' => $parameters['node_id'], |
226 | 226 | 'content2Id' => $objectId2, |
227 | 227 | 'location2Id' => $parameters['selected_node_id'], |
228 | - ) ); |
|
228 | + )); |
|
229 | 229 | |
230 | 230 | case 'content_updatemainassignment': |
231 | - return array( array( |
|
231 | + return array(array( |
|
232 | 232 | 'contentId' => $parameters['object_id'], |
233 | - ) ); |
|
233 | + )); |
|
234 | 234 | |
235 | 235 | case 'content_updatepriority': |
236 | 236 | $objectId = $this->objectIdFromNodeId($parameters['node_id']); |
237 | - if ( !$objectId ) |
|
237 | + if (!$objectId) |
|
238 | 238 | { |
239 | - return array( false ); |
|
239 | + return array(false); |
|
240 | 240 | } |
241 | - return array( array( |
|
241 | + return array(array( |
|
242 | 242 | 'contentId' => '', |
243 | 243 | 'locationId' => $parameters['node_id'], |
244 | - ) ); |
|
244 | + )); |
|
245 | 245 | |
246 | 246 | case 'content_updatesection': |
247 | 247 | $objectId = $this->objectIdFromNodeId($parameters['node_id']); |
248 | - if ( !$objectId ) |
|
248 | + if (!$objectId) |
|
249 | 249 | { |
250 | - return array( false ); |
|
250 | + return array(false); |
|
251 | 251 | } |
252 | - return array( array( |
|
252 | + return array(array( |
|
253 | 253 | 'contentId' => $objectId, |
254 | 254 | 'sectionId' => $parameters['selected_section_id'], |
255 | - ) ); |
|
255 | + )); |
|
256 | 256 | |
257 | 257 | case 'content_updateinitiallanguage': |
258 | - return array( array( |
|
258 | + return array(array( |
|
259 | 259 | 'contentId' => $parameters['object_id'], |
260 | - ) ); |
|
260 | + )); |
|
261 | 261 | |
262 | 262 | case 'content_updatealwaysavailable': |
263 | - return array( array( |
|
263 | + return array(array( |
|
264 | 264 | 'contentId' => $parameters['object_id'], |
265 | - ) ); |
|
265 | + )); |
|
266 | 266 | |
267 | 267 | /*case 'content_updateobjectstate': |
268 | 268 | /// @todo we get an array of all states, but the eZ5 event needs to know which one changed |
@@ -275,21 +275,21 @@ discard block |
||
275 | 275 | // in case of an unmapped legacy operation, we let through all parameters unmodified - except a few known ones |
276 | 276 | // (is it really a good idea to remove the known params?) |
277 | 277 | default: |
278 | - return array( array_diff_key( $parameters, array( 'workflow_id', 'trigger_name', 'module_name', 'module_function', 'user_id' ) ) ); |
|
278 | + return array(array_diff_key($parameters, array('workflow_id', 'trigger_name', 'module_name', 'module_function', 'user_id'))); |
|
279 | 279 | } |
280 | 280 | } |
281 | 281 | |
282 | - protected function objectIdFromNodeId( $nodeID ) |
|
282 | + protected function objectIdFromNodeId($nodeID) |
|
283 | 283 | { |
284 | - $node = eZContentObjectTreeNode::fetch( $nodeID ); |
|
285 | - if ( !is_object( $node ) ) |
|
284 | + $node = eZContentObjectTreeNode::fetch($nodeID); |
|
285 | + if (!is_object($node)) |
|
286 | 286 | { |
287 | - eZDebug::writeError( 'Unable to fetch node ' . $nodeID, __METHOD__ ); |
|
287 | + eZDebug::writeError('Unable to fetch node ' . $nodeID, __METHOD__); |
|
288 | 288 | return null; |
289 | 289 | } |
290 | 290 | |
291 | - return $node->attribute( 'contentobject_id' ); |
|
291 | + return $node->attribute('contentobject_id'); |
|
292 | 292 | } |
293 | 293 | } |
294 | 294 | |
295 | -eZWorkflowEventType::registerEventType( eZWorkflowEngineHookType::WORKFLOW_TYPE_STRING, 'eZWorkflowEngineHookType' ); |
|
295 | +eZWorkflowEventType::registerEventType(eZWorkflowEngineHookType::WORKFLOW_TYPE_STRING, 'eZWorkflowEngineHookType'); |
@@ -12,11 +12,11 @@ |
||
12 | 12 | */ |
13 | 13 | class WorkflowDefinition extends MigrationDefinition |
14 | 14 | { |
15 | - const MANIFEST_STEP_TYPE= 'workflow'; |
|
16 | - const MANIFEST_SIGNAL_ELEMENT= 'signal'; |
|
17 | - const MANIFEST_RUNAS_ELEMENT= 'run_as'; |
|
18 | - const MANIFEST_USETRANSACTION_ELEMENT= 'transaction'; |
|
19 | - const MANIFEST_AVOIDRECURSION_ELEMENT= 'avoid_recursion'; |
|
15 | + const MANIFEST_STEP_TYPE = 'workflow'; |
|
16 | + const MANIFEST_SIGNAL_ELEMENT = 'signal'; |
|
17 | + const MANIFEST_RUNAS_ELEMENT = 'run_as'; |
|
18 | + const MANIFEST_USETRANSACTION_ELEMENT = 'transaction'; |
|
19 | + const MANIFEST_AVOIDRECURSION_ELEMENT = 'avoid_recursion'; |
|
20 | 20 | |
21 | 21 | protected $signalName; |
22 | 22 | // unlike migrations, workflows default to run as current user |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $executed = 0; |
93 | 93 | $failed = 0; |
94 | 94 | |
95 | - foreach($suspendedWorkflows as $suspendedWorkflow) { |
|
95 | + foreach ($suspendedWorkflows as $suspendedWorkflow) { |
|
96 | 96 | $output->writeln("<info>Resuming {$suspendedWorkflow->name}</info>"); |
97 | 97 | |
98 | 98 | try { |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | $time = microtime(true) - $start; |
108 | 108 | $output->writeln("Resumed $executed workflows, failed $failed"); |
109 | - $output->writeln("Time taken: ".sprintf('%.2f', $time)." secs, memory: ".sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)). ' MB'); |
|
109 | + $output->writeln("Time taken: " . sprintf('%.2f', $time) . " secs, memory: " . sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)) . ' MB'); |
|
110 | 110 | |
111 | 111 | if ($failed) { |
112 | 112 | return 2; |
@@ -93,7 +93,7 @@ |
||
93 | 93 | |
94 | 94 | $output->writeln('<info>Workflow: ' . $workflow->name . '</info>'); |
95 | 95 | $output->writeln('Status: ' . $status); |
96 | - $output->writeln('Executed on: <info>' . ($workflow->executionDate != null ? date("Y-m-d H:i:s", $workflow->executionDate) : '--'). '</info>'); |
|
96 | + $output->writeln('Executed on: <info>' . ($workflow->executionDate != null ? date("Y-m-d H:i:s", $workflow->executionDate) : '--') . '</info>'); |
|
97 | 97 | $output->writeln('Execution notes: <info>' . $workflow->executionError . '</info>'); |
98 | 98 | $output->writeln('Signal: <info>' . $workflow->signalName . '</info>'); |
99 | 99 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | { |
18 | 18 | $this->setName('kaliop:workflows:cleanup') |
19 | 19 | ->addOption('older-than', 'o', InputOption::VALUE_REQUIRED, "Only remove workflows which have finished since N minutes", 86400) |
20 | - ->addOption('failed', 'f', InputOption::VALUE_NONE, "Remove failed instead of finished workflows") |
|
20 | + ->addOption('failed', 'f', InputOption::VALUE_NONE, "Remove failed instead of finished workflows") |
|
21 | 21 | ->addOption('dry-run', 'd', InputOption::VALUE_NONE, "Only list workflows to remove, without actually doing it") |
22 | 22 | ->setDescription('Removes old workflows from the list of executed ones') |
23 | 23 | ; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | break; |
49 | 49 | } |
50 | 50 | |
51 | - foreach($workflows as $workflow) { |
|
51 | + foreach ($workflows as $workflow) { |
|
52 | 52 | if ($workflow->executionDate < $maxAge) { |
53 | 53 | $toRemove[] = $workflow; |
54 | 54 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | $total += count($workflows); |
58 | 58 | $offset += $limit; |
59 | - } while(true); |
|
59 | + } while (true); |
|
60 | 60 | |
61 | 61 | if ($input->getOption('dry-run')) { |
62 | 62 | $action = "To remove: "; |