mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-20 02:11:36 +00:00
- refactoring architecture - fix incomplete ssh logs - code editor for scripts in the app - remove Jobs and SSHCommands
21 lines
478 B
PHP
21 lines
478 B
PHP
<?php
|
|
|
|
namespace App\SSH;
|
|
|
|
use ReflectionClass;
|
|
|
|
trait HasScripts
|
|
{
|
|
private function getScript(string $name, array $vars = []): string
|
|
{
|
|
$reflector = new ReflectionClass($this);
|
|
$scriptsDir = dirname($reflector->getFileName()).'/scripts';
|
|
$script = file_get_contents($scriptsDir.'/'.$name);
|
|
foreach ($vars as $key => $value) {
|
|
$script = str_replace('__'.$key.'__', $value, $script);
|
|
}
|
|
|
|
return $script;
|
|
}
|
|
}
|