]> git.mxchange.org Git - friendica.git/commitdiff
Adapt run-command for console.php executions
authorPhilipp <admin@philipp.info>
Thu, 2 Jan 2025 19:53:16 +0000 (20:53 +0100)
committerPhilipp <admin@philipp.info>
Sun, 5 Jan 2025 22:13:40 +0000 (23:13 +0100)
src/Core/System.php
src/Core/Worker.php
src/Core/Worker/Daemon.php

index 95a411f3d193b15a843ce66f69111b9691fc527e..31a76058aefcb39677ab9596ffd99a668fac4019 100644 (file)
@@ -164,9 +164,10 @@ class System
         * Executes a child process with 'proc_open'
         *
         * @param string $command The command to execute
-        * @param array  $args    Arguments to pass to the command ( [ 'key' => value, 'key2' => value2, ... ]
+        * @param array  $args    Arguments to pass to the command ( ['arg1', 'arg2', ... ] )
+        * @param array  $options Options to pass to the command ( [ 'key' => value, 'key2' => value2, ... ]
         */
-       public function run(string $command, array $args)
+       public function run(string $command, array $args = [], array $options = [])
        {
                if (!function_exists('proc_open')) {
                        $this->logger->warning('"proc_open" not available - quitting');
@@ -175,7 +176,11 @@ class System
 
                $cmdline = $this->config->get('config', 'php_path', 'php') . ' ' . escapeshellarg($command);
 
-               foreach ($args as $key => $value) {
+               foreach ($args as $argumment) {
+                       $cmdline .= ' ' . $argumment;
+               }
+
+               foreach ($options as $key => $value) {
                        if (!is_null($value) && is_bool($value) && !$value) {
                                continue;
                        }
index 533da588c439cf648fd8fce3d722d8232f9fe428..386f3e0f110c4a92b1b65fd9e5e5f2b93e92fe20 100644 (file)
@@ -1207,7 +1207,7 @@ class Worker
                if (Worker\Daemon::isMode() && DI::config()->get('system', 'worker_fork')) {
                        self::forkProcess($do_cron);
                } else {
-                       DI::system()->run('bin/console.php worker', ['no_cron' => !$do_cron]);
+                       DI::system()->run('bin/console.php', ['worker'], ['no_cron' => !$do_cron]);
                }
                if (Worker\Daemon::isMode()) {
                        Worker\IPC::SetJobState(false);
index 8cffd98854c999ac975d787d091b626a4bf97340..ee5f7a98ae94077a7506c3cd70b18135a7431963 100644 (file)
@@ -115,7 +115,7 @@ class Daemon
        private static function spawn()
        {
                Logger::notice('Starting new daemon process');
-               DI::system()->run('bin/console.php daemon', ['start']);
+               DI::system()->run('bin/console.php', ['start']);
                Logger::notice('New daemon process started');
        }
 }