-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'hotfix/3.5.23' into master
- Loading branch information
Showing
16 changed files
with
355 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
namespace Phabalicious\Artifact\Actions\Base; | ||
|
||
use Phabalicious\Artifact\Actions\ActionBase; | ||
use Phabalicious\Configuration\HostConfig; | ||
use Phabalicious\Method\ScriptMethod; | ||
use Phabalicious\Method\TaskContextInterface; | ||
use Phabalicious\ShellProvider\CommandResult; | ||
use Phabalicious\ShellProvider\ShellProviderInterface; | ||
use Phabalicious\Validation\ValidationService; | ||
use Psr\Log\LoggerInterface; | ||
|
||
class LogAction extends ActionBase | ||
{ | ||
const SEVERITY_MAPPINGS = [ | ||
'error' => 'error', | ||
'warning' => 'warning', | ||
'notice' => 'notice', | ||
'info' => 'info', | ||
'debug' => 'debug' | ||
]; | ||
|
||
public function __construct() | ||
{ | ||
} | ||
|
||
protected function validateArgumentsConfig(array $action_arguments, ValidationService $validation) | ||
{ | ||
$validation->hasKey('message', 'Log action needs a message'); | ||
if (!empty($validation->getConfig()['severity'])) { | ||
$validation->isOneOf( | ||
'severity', | ||
array_keys(self::SEVERITY_MAPPINGS) | ||
); | ||
} | ||
} | ||
|
||
protected function runImplementation( | ||
HostConfig $host_config, | ||
TaskContextInterface $context, | ||
ShellProviderInterface $shell, | ||
string $install_dir, | ||
string $target_dir | ||
) { | ||
$severity = $this->getArguments()['severity'] ?? 'notice'; | ||
$message = $this->getArguments()['message']; | ||
|
||
$fn = self::SEVERITY_MAPPINGS[$severity]; | ||
$context->getConfigurationService()->getLogger()->{$fn}($message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
namespace Phabalicious\Artifact\Actions\Base; | ||
|
||
use Phabalicious\Artifact\Actions\ActionBase; | ||
use Phabalicious\Configuration\HostConfig; | ||
use Phabalicious\Method\ScriptMethod; | ||
use Phabalicious\Method\TaskContextInterface; | ||
use Phabalicious\ShellProvider\CommandResult; | ||
use Phabalicious\ShellProvider\ShellProviderInterface; | ||
use Phabalicious\Validation\ValidationService; | ||
use Psr\Log\LoggerInterface; | ||
|
||
class MessageAction extends ActionBase | ||
{ | ||
const MESSAGE_TYPE_MAPPING = [ | ||
'error' => 'error', | ||
'warning' => 'warning', | ||
'note' => 'note', | ||
'comment' => 'comment', | ||
'success' => 'success' | ||
]; | ||
|
||
public function __construct() | ||
{ | ||
} | ||
|
||
protected function validateArgumentsConfig(array $action_arguments, ValidationService $validation) | ||
{ | ||
$validation->hasKey('message', 'Log action needs a message'); | ||
if (!empty($validation->getConfig()['type'])) { | ||
$validation->isOneOf( | ||
'type', | ||
array_keys(self::MESSAGE_TYPE_MAPPING) | ||
); | ||
} | ||
} | ||
|
||
protected function runImplementation( | ||
HostConfig $host_config, | ||
TaskContextInterface $context, | ||
ShellProviderInterface $shell, | ||
string $install_dir, | ||
string $target_dir | ||
) { | ||
$severity = $this->getArguments()['type'] ?? 'note'; | ||
$message = $this->getArguments()['message']; | ||
|
||
$fn = self::MESSAGE_TYPE_MAPPING[$severity]; | ||
$context->io()->{$fn}($message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.