public static function initiate($settings)
    {
        // Create an entry in our database.
        $taskStatus = new BackgroundTaskStatus();
        $taskStatus->TaskClass = get_called_class();
        $taskStatus->TaskSettings = $settings;
        $taskStatus->save();

        $task = new static();

        $additionalArguments = $task->getShellArguments();
        $additionalArgumentString = "";

        foreach ($additionalArguments as $argument) {
            $additionalArgumentString .= escapeshellarg($argument);
        }

        if (BackgroundTasksModule::$debugServerName) {
            // This setting can be used to make command line tasks use a named configuration
            // in your IDE - this matches up to the PHP Server name in PhpStorm, found in
            // Settings -> Languages and Frameworks -> PHP -> Servers -> Name

            $command = 'PHP_IDE_CONFIG=' . escapeshellarg('serverName=' . BackgroundTasksModule::$debugServerName) . ' ';
        } else {
            $command = '';
        }

        $runningRhubarbAppClass = escapeshellarg(get_class(Application::current()));
        $command .= "rhubarb_app=$runningRhubarbAppClass /usr/bin/env php " . realpath(VENDOR_DIR . "/rhubarbphp/rhubarb/platform/execute-cli.php") . " " .
            realpath(__DIR__ . "/Scripts/task-runner.php") . " " . escapeshellarg(get_called_class()) . " " . $taskStatus->BackgroundTaskStatusID . " " . $additionalArgumentString . " > /dev/null 2>&1 &";

        Log::debug("Launching background task " . $taskStatus->UniqueIdentifier, "BACKGROUND", $command);

        exec($command);

        return $taskStatus;
    }
public static function initiate($settings)
    {
        // Create an entry in our database.
        $taskStatus = new BackgroundTaskStatus();
        $taskStatus->TaskClass = get_called_class();
        $taskStatus->TaskSettings = $settings;
        $taskStatus->save();

        $task = new static();

        $additionalArguments = $task->getShellArguments();
        $additionalArgumentString = "";

        foreach ($additionalArguments as $argument) {
            $additionalArgumentString .= escapeshellarg($argument);
        }

        if (BackgroundTasksModule::$debugServerName) {
            // This setting can be used to make command line tasks use a named configuration
            // in your IDE - this matches up to the PHP Server name in PhpStorm, found in
            // Settings -> Languages and Frameworks -> PHP -> Servers -> Name

            $command = 'PHP_IDE_CONFIG=' . escapeshellarg('serverName=' . BackgroundTasksModule::$debugServerName) . ' ';
        } else {
            $command = '';
        }

        $runningRhubarbAppClass = escapeshellarg(get_class(Application::current()));
        $command .= "rhubarb_app=$runningRhubarbAppClass /usr/bin/env php " . realpath(VENDOR_DIR . "/rhubarbphp/rhubarb/platform/execute-cli.php") . " " .
            realpath(__DIR__ . "/Scripts/task-runner.php") . " " . escapeshellarg(get_called_class()) . " " . $taskStatus->BackgroundTaskStatusID . " " . $additionalArgumentString . " > /dev/null 2>&1 &";

        Log::debug("Launching background task " . $taskStatus->UniqueIdentifier, "BACKGROUND", $command);

        exec($command);

        return $taskStatus;
    }
public static function initiate ( $ settings ) { // Create an entry in our database. $ taskStatus = new BackgroundTaskStatus ( ) ; $ taskStatus -> TaskClass = get_called_class ( ) ; $ taskStatus -> TaskSettings = $ settings ; $ taskStatus -> save ( ) ; $ task = new static ( ) ; $ additionalArguments = $ task -> getShellArguments ( ) ; $ additionalArgumentString = "" ; foreach ( $ additionalArguments as $ argument ) { $ additionalArgumentString .= escapeshellarg ( $ argument ) ; } if ( BackgroundTasksModule :: $ debugServerName ) { // This setting can be used to make command line tasks use a named configuration // in your IDE - this matches up to the PHP Server name in PhpStorm, found in // Settings -> Languages and Frameworks -> PHP -> Servers -> Name $ command = 'PHP_IDE_CONFIG=' . escapeshellarg ( 'serverName=' . BackgroundTasksModule :: $ debugServerName ) . ' ' ; } else { $ command = '' ; } $ runningRhubarbAppClass = escapeshellarg ( get_class ( Application :: current ( ) ) ) ; $ command .= "rhubarb_app=$runningRhubarbAppClass /usr/bin/env php " . realpath ( VENDOR_DIR . "/rhubarbphp/rhubarb/platform/execute-cli.php" ) . " " . realpath ( __DIR__ . "/Scripts/task-runner.php" ) . " " . escapeshellarg ( get_called_class ( ) ) . " " . $ taskStatus -> BackgroundTaskStatusID . " " . $ additionalArgumentString . " > /dev/null 2>&1 &" ; Log :: debug ( "Launching background task " . $ taskStatus -> UniqueIdentifier , "BACKGROUND" , $ command ) ; exec ( $ command ) ; return $ taskStatus ; }
Initiates execution of the background task.

@param array $settings Settings which will be passed to the execute method of the BackgroundTask (must be JSON serialisable)

@return BackgroundTaskStatus The status object for this task.
Initiates execution of the background task .