mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-21 15:10:25 +00:00
Create MicroweberShellExecutor.php
This commit is contained in:
parent
928fee3f0d
commit
38ada71ca7
1 changed files with 23 additions and 0 deletions
23
web/Modules/Microweber/MicroweberShellExecutor.php
Normal file
23
web/Modules/Microweber/MicroweberShellExecutor.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Microweber;
|
||||
|
||||
use MicroweberPackages\SharedServerScripts\Shell\Adapters\NativeShellExecutor;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
class MicroweberShellExecutor extends NativeShellExecutor
|
||||
{
|
||||
public function executeCommand(array $args, $cwd = null, $env = null)
|
||||
{
|
||||
// Escape shell arguments
|
||||
$args = array_map('escapeshellarg', $args);
|
||||
$command = implode(' ', $args);
|
||||
|
||||
if (!empty($cwd)) {
|
||||
$command = 'cd ' . escapeshellarg($cwd) . ' && ' . $command;
|
||||
}
|
||||
|
||||
return shell_exec($command);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue