Skip to content

Commit

Permalink
WIP on #26; further work postposed until we explore #31.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjordan committed Jan 10, 2019
1 parent 0a0bd33 commit 6acab00
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
23 changes: 12 additions & 11 deletions src/Command/CheckFixityCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
// that digest with a new one.
if (count($this->persistPlugins) > 0) {
foreach ($this->persistPlugins as $persist_plugin_name) {

$this->event_detail = new FixityEventDetailManager($this->params);
$this->event_detail->add('event_detail', 'wassup.');
// var_dump($this->event_detail->getDetails());

$json_object_array = json_decode($resource_id, true);
$resource_id = $json_object_array['resource_id'];
$last_modified_timestamp = $json_object_array['last_modified_timestamp'];
Expand Down Expand Up @@ -202,11 +197,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
$current_digest_value = $current_digest_plugin_output['digest_value'];
} else {
$current_digest_plugin_output_ok = false;
}
}

// Initialize $outcome to 'fail', change it to 'success' only if conditions are met.
$outcome = 'fail';
if ($current_digest_plugin_output_ok) {
// Initialize $outcome to 'fail', change it to 'success' only if conditions are met.
$outcome = 'fail';
print "Pre\n";
$this->event_detail = new FixityEventDetailManager($this->params);
print "Post\n";

// var_dump("reference_event_digest_value");
// var_dump($reference_event_digest_value);
Expand Down Expand Up @@ -246,7 +244,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
// }
}
} else {
$this->logger->error("Fetchdigest plugin ran.", array(
$this->logger->error("Fetchdigest plugin ran but could not fetch digest.", array(
'plugin_name' => $this->fetchDigestPlugin,
'return_code' => $get_current_digest_plugin_return_code,
'http_response_code' => $current_digest_plugin_return_value,
Expand All @@ -266,14 +264,17 @@ protected function execute(InputInterface $input, OutputInterface $output)
'--outcome' => $outcome,
'--operation' => 'persist_fix_event',
));

// Aaarrrgggghhhh! $this->event_detail is getting squashed in the persist plugin.
// var_dump($this->event_detail->getDetails());

$persist_fix_event_plugin_output = new BufferedOutput();
$persist_fix_event_plugin_return_code = $persist_fix_event_plugin_command->run(
$persist_fix_event_plugin_input,
$persist_fix_event_plugin_output,
$this->event_detail
);
// Currently not used.
// $persist_fix_event_plugin_output_string = $persist_fix_event_plugin_output->fetch();

$this->logger->info(
"Persist plugin ran.",
array(
Expand Down
2 changes: 1 addition & 1 deletion src/Command/PluginFetchDigestFromShell.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected function configure()
protected function execute(InputInterface $input, OutputInterface $output)
{
$file_path = $input->getOption('resource_id');
var_dump("From plugin");
var_dump("From fetchdigest plugin");
var_dump($file_path);
$external_digest_program_command = $this->external_program . ' ' . $file_path;
$external_digest_program_command = escapeshellcmd($external_digest_program_command);
Expand Down
1 change: 1 addition & 0 deletions src/Command/PluginPersistToCsv.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public function __construct(
// Set log output path in config/packages/{environment}/monolog.yaml
$this->logger = $logger;
$this->event_detail = $event_detail;
var_dump("From persist plugin");
var_dump($this->event_detail->getDetails());

parent::__construct();
Expand Down
3 changes: 2 additions & 1 deletion src/Service/FixityEventDetailManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function __construct(ParameterBagInterface $params = null)
} else {
$this->serialize_delimiter = ';';
}
var_dump("Hi from the event detail manager");
}

/**
Expand All @@ -35,7 +36,7 @@ public function __construct(ParameterBagInterface $params = null)
* Associative array with 'event_detail' and 'event_outcome_detail_note'
* as keys whose values are an array of strings.
*/
public function add($key, $value)
public function add($key, $value = '')
{
if (!strlen($value)) {
return $this->event_details;
Expand Down

0 comments on commit 6acab00

Please sign in to comment.