Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Deprecate API that will be removed #162

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading