Skip to content

Commit

Permalink
Merge branch '5' into 6
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Sep 14, 2024
2 parents cfe8506 + f7ba0a5 commit c3ae8f8
Showing 1 changed file with 28 additions and 18 deletions.
46 changes: 28 additions & 18 deletions src/Task/RealMeSetupTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use SilverStripe\Control\Director;
use SilverStripe\Control\Controller;
use SilverStripe\Dev\BuildTask;
use SilverStripe\Dev\Deprecation;

/**
* Class RealMeSetupTask
Expand Down Expand Up @@ -71,14 +72,16 @@ public function run($request)

$this->outputMetadataXmlContent($forEnv);

$this->message(PHP_EOL . _t(
RealMeSetupTask::class . '.BUILD_FINISH',
'RealMe setup complete. Please copy the XML into a file for upload to the {env} environment or DIA ' .
'to complete the integration',
array('env' => $forEnv)
));
Deprecation::withNoReplacement(function () use ($forEnv) {
$this->message(PHP_EOL . _t(
RealMeSetupTask::class . '.BUILD_FINISH',
'RealMe setup complete. Please copy the XML into a file for upload to the {env} environment or ' .
'DIA to complete the integration',
array('env' => $forEnv)
));
});
} catch (Exception $e) {
$this->message($e->getMessage() . PHP_EOL);
Deprecation::withNoReplacement(fn() => $this->message($e->getMessage() . PHP_EOL));
}
}

Expand Down Expand Up @@ -135,10 +138,13 @@ private function validateInputs($forEnv)
));
}

$this->message(_t(
RealMeSetupTask::class . '.VALIDATION_SUCCESS',
'Validation succeeded, continuing with setup...'
));

Deprecation::withNoReplacement(function () {
$this->message(_t(
RealMeSetupTask::class . '.VALIDATION_SUCCESS',
'Validation succeeded, continuing with setup...'
));
});
}

/**
Expand All @@ -149,12 +155,14 @@ private function validateInputs($forEnv)
private function outputMetadataXmlContent($forEnv)
{
// Output metadata XML so that it can be sent to RealMe via the agency
$this->message(_t(
RealMeSetupTask::class . '.OUPUT_PREFIX',
'Metadata XML is listed below for the \'{env}\' RealMe environment, this should be sent to the agency so ' .
'they can pass it on to RealMe Operations staff',
['env' => $forEnv]
) . PHP_EOL . PHP_EOL);
Deprecation::withNoReplacement(function () use ($forEnv) {
$this->message(_t(
RealMeSetupTask::class . '.OUPUT_PREFIX',
'Metadata XML is listed below for the \'{env}\' RealMe environment, this should be sent to the ' .
'agency so they can pass it on to RealMe Operations staff',
['env' => $forEnv]
) . PHP_EOL . PHP_EOL);
});

$configDir = $this->getConfigurationTemplateDir();
$templateFile = Controller::join_links($configDir, 'metadata.xml');
Expand All @@ -181,7 +189,7 @@ private function outputMetadataXmlContent($forEnv)
)
);

$this->message($message);
Deprecation::withNoReplacement(fn() => $this->message($message));
}

/**
Expand Down Expand Up @@ -227,9 +235,11 @@ private function getConfigurationTemplateDir()
* Output a message to the console
* @param string $message
* @return void
* @deprecated 5.5.0 Will be replaced with new $output parameter in the run() method
*/
private function message($message)
{
Deprecation::notice('5.5.0', 'Will be replaced with new $output parameter in the run() method');
echo $message . PHP_EOL;
}

Expand Down

0 comments on commit c3ae8f8

Please sign in to comment.