public function itDoesNotChangeTheFingerprint() { $logger = new WorkflowBackendLogger($this->backend_logger); expect($this->backend_logger)->log('[WF] [12345] toto', Feedback::DEBUG)->once(); $logger->defineFingerprint(12345); $logger->defineFingerprint(67890); $logger->debug('toto'); }
private function updateParent(Tracker_Artifact $parent, Tracker_Artifact $child, Tracker_Workflow_Trigger_TriggerRule $rule) { $target = $rule->getTarget(); try { $comment = '<p>' . $GLOBALS['Language']->getText('workflow_trigger_rules_processor', 'parent_update', array('art #' . $child->getId(), $child->getLastChangeset()->getUri())) . '</p>'; $comment .= '<p>' . $rule->getAsChangesetComment() . '</p>'; $parent->createNewChangeset($target->getFieldData(), $comment, $this->workflow_user, true, Tracker_Artifact_Changeset_Comment::HTML_COMMENT); $this->logger->debug('Parent successfully updated.'); } catch (Tracker_Exception $e) { $this->logger->debug('Error while updating the parent artifact: ' . $e->getMessage()); $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_common_artifact', 'error_processor_update', array($parent->fetchDirectLinkToArtifact(), $e->getMessage())), CODENDI_PURIFIER_DISABLED); } }
public function processTriggers(Tracker_Artifact_Changeset $changeset) { $this->logger->start(__METHOD__, $changeset->getId()); $dar_rules = $this->dao->searchForInvolvedRulesIdsByChangesetId($changeset->getId()); foreach ($dar_rules as $row) { $rule = $this->getRuleById($row['rule_id']); $this->logger->debug("Found matching rule " . json_encode($rule->fetchFormattedForJson())); $this->rules_processor->process($changeset->getArtifact(), $rule); } $this->logger->end(__METHOD__, $changeset->getId()); }
/** * Execute actions after transition happens (if there is one) * * @param PFUser $user The user who changed things * @param Array $fields_data Request field data (array[field_id] => data) * @param Tracker_Artifact_Changeset $new_changeset The changeset that has just been created * @param Tracker_Artifact_Changeset $previous_changeset The changeset just before (null for a new artifact) * * @return void */ public function after(array $fields_data, Tracker_Artifact_Changeset $new_changeset, Tracker_Artifact_Changeset $previous_changeset = null) { $this->logger->defineFingerprint($new_changeset->getArtifact()->getId()); $this->logger->start(__METHOD__, $new_changeset->getId(), $previous_changeset ? $previous_changeset->getId() : 'null'); if (isset($fields_data[$this->getFieldId()])) { $transition = $this->getCurrentTransition($fields_data, $previous_changeset); if ($transition) { $transition->after($new_changeset); } } $this->trigger_rules_manager->processTriggers($new_changeset); $this->logger->end(__METHOD__, $new_changeset->getId(), $previous_changeset ? $previous_changeset->getId() : 'null'); }