private function importRemainingChangesets(Tracker_Artifact $artifact, array $xml_changesets, Tracker_Artifact_XMLImport_ArtifactFieldsDataBuilder $fields_data_builder) { $count = 0; $this->logger->info('art #' . $artifact->getId()); foreach ($xml_changesets as $xml_changeset) { try { $count++; $this->logger->debug("changeset {$count}"); $initial_comment_body = ''; $initial_comment_format = Tracker_Artifact_Changeset_Comment::TEXT_COMMENT; if (isset($xml_changeset->comments) && count($xml_changeset->comments->comment) > 0) { $initial_comment_body = (string) $xml_changeset->comments->comment[0]->body; $initial_comment_format = (string) $xml_changeset->comments->comment[0]->body['format']; } $submitted_by = $this->getSubmittedBy($xml_changeset); $changeset = $this->new_changeset_creator->create($artifact, $fields_data_builder->getFieldsData($xml_changeset, $submitted_by), $initial_comment_body, $submitted_by, $this->getSubmittedOn($xml_changeset), $this->send_notifications, $initial_comment_format); if ($changeset) { $this->updateComments($changeset, $xml_changeset); } else { $this->logger->warn("Impossible to create changeset {$count}: " . $GLOBALS['Response']->getAndClearRawFeedback()); } } catch (Tracker_NoChangeException $exception) { $this->logger->warn("No Change for changeset {$count}"); } catch (Exception $exception) { $this->logger->warn("Unexpected error at changeset {$count}: " . $exception->getMessage()); } } }
/** * @return Tracker_Artifact|null The created artifact */ private function importOneArtifact(Tracker $tracker, SimpleXMLElement $xml_artifact, Tracker_Artifact_XMLImport_ArtifactFieldsDataBuilder $fields_data_builder) { $this->logger->push('art #' . (string) $xml_artifact['id']); if (count($xml_artifact->changeset) > 0) { $changesets = $this->getSortedBySubmittedOn($xml_artifact->changeset); $first_changeset = array_shift($changesets); $artifact = $this->importInitialChangeset($tracker, $first_changeset, $fields_data_builder); $this->logger->info("--> new artifact {$artifact->getId()}"); if (count($changesets)) { $this->importRemainingChangesets($artifact, $changesets, $fields_data_builder); } $this->logger->pop(); return $artifact; } }
public function itPopPrefixes2() { $wrapper = new WrapperLogger($this->logger, 'tracker'); expect($this->logger)->info()->count(3); expect($this->logger)->info('[tracker] stuff')->at(0); expect($this->logger)->info('[tracker][53] bla')->at(1); expect($this->logger)->info('[tracker][54] coin')->at(2); $wrapper->info('stuff'); $wrapper->push('53'); $wrapper->info('bla'); $wrapper->pop(); $wrapper->push('54'); $wrapper->info('coin'); }