Return command used to start the standalone server.

@return string
17709
public function getCommand(): string
    {
        $port = $this->config->getPort();

        $java_bin = $this->config->getJavaBin();

        $jars = [];
        $classpaths = $this->config->getClasspaths();
        foreach ($classpaths as $classpath) {
            if (preg_match('/\*\.jar$/', $classpath)) {
                $directory = preg_replace('/\*\.jar$/', '', $classpath);
                $files = glob("$directory/*.jar");
                //foreach ($files as $file) {
                foreach ($files as $file) {
                    $jars[] = $file;
                }
                //}
            } else {
                $jars[] = $classpath;
            }
        }

        $jars[] = $this->config->getServerJar();
        $classpath = implode(':', $jars);
        $threads = $this->config->getThreads();

        $directives = ' -D' . implode(' -D', [
                    'php.java.bridge.daemon="false"',
                    "php.java.bridge.threads=$threads"
        ]);

        $command = sprintf(
            '%s -cp "%s" %s php.java.bridge.Standalone SERVLET:%d',
            $java_bin,
            $classpath,
            $directives,
            $port
        );

        return $command;
    }
89174
public static function getCommand(): Command
    {
        if (is_null(self::$exec)) {
            self::$exec = new Command();
        }
        return self::$exec;
    }
158610
public function start() {
		if( $this->isRunning() ) {
			return;
		}

		$script = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'server' . DIRECTORY_SEPARATOR . 'server.php';

		$stdout = tempnam(sys_get_temp_dir(), 'mockserv-stdout-');
		$cmd    = "php -S {$this->host}:{$this->port} " . escapeshellarg($script);

		if( !putenv(self::TMP_ENV . '=' . $this->tmpDir) ) {
			throw new Exceptions\RuntimeException('Unable to put environmental variable');
		}
		$fullCmd = sprintf('%s > %s 2>&1 & echo $!',
			escapeshellcmd($cmd),
			escapeshellarg($stdout)
		);

		InternalServer::incrementRequestCounter($this->tmpDir, 0);

		$this->pid = exec(
			$fullCmd,
			$o,
			$ret
		);

		if( !ctype_digit($this->pid) ) {
			throw new Exceptions\ServerException("Error starting server, received '{$this->pid}', expected int PID");
		}

		sleep(1); // just to make sure it's fully started up, maybe not necessary

		if( !$this->isRunning() ) {
			throw new Exceptions\ServerException("Failed to start server. Is something already running on port {$this->port}?");
		}

		$this->started = true;

		register_shutdown_function(function () {
			if( $this->isRunning() ) {
				$this->stop();
			}
		});
	}
512895
public static function getCommand() {
		foreach (self::$commands as $command => $attributes) {
			if (isset(self::$options[$command]) || isset(self::$options[$attributes["commandShort"]])) {
				return $command;
			}
		}
		return false;
	}
173345
public function getCommand() : string
    {
        return $this->cmd
        . (count($this->options)   ? ' ' . implode(' ', $this->options)   : '')
        . ($this->isSilent         ? ' 2> /dev/null'                      : '');
    }
269995
protected function pazpar2InitURL()
    {
        $URL = $this->getPazpar2BaseURL() . '?command=init';
        if ($this->getServiceName() != null) {
            $URL .= '&service=' . urlencode($this->getServiceName());
        }

        return $URL;
    }
1148546
public function get_start() {
        if (!empty($this->start)) {
            return $this->start;
        }

        // Much faster than reading the first log in the site.
        $admins = get_admins();
        $this->start = 9999999999;
        foreach ($admins as $admin) {
            if ($admin->firstaccess < $this->start) {
                $this->start = $admin->firstaccess;
            }
        }
        return $this->start;
    }
144392
protected function start() {
        $args = $this->getServerArguments();
        if ($args['command']) {
            $commandClass = $this->getCommandClassFromNameAndModule($args['command'], null);
        } else {
            $commandClass = $this->notFoundCommand;
        }
        if (!class_exists($commandClass)) {
            $this->alert('Command ' . $commandClass . ' not found!', array(
                'requestedCommand' => $args['command'],
                'requestedModule' => '-'
            ));
            $commandClass = $this->notFoundCommand;
        }

        $command = $this->loadCommand($commandClass);
        $command->setActiveAction($args['action']);
        $command->run($args['params']);
    }
375469
public function getCommand(): Command
    {
        if ($this->command === null) {
            $this->command = new Command($this->controllerObjectName, $this->controllerCommandName);
        }
        return $this->command;
    }
761750
public function getCommand()
    {
        $options = $this->defaultOptions;

        if ($this->options !== null) {
            $options = $this->options;
        }

        if ($this->verbose === true) {
            $options .= ' --verbose';
        }

        if ($this->checksum === true) {
            $options .= ' --checksum';
        }

        if ($this->identityFile !== null) {
            $options .= ' -e "ssh -i ' . $this->identityFile . ' -p' . $this->remotePort . '"';
        } else {
            if ($this->remoteShell !== null) {
                $options .= ' -e "' . $this->remoteShell . '"';
            }
        }

        if ($this->dryRun === true) {
            $options .= ' --dry-run';
        }

        if ($this->delete === true) {
            $options .= ' --delete-after --ignore-errors --force';
        }

        if ($this->itemizeChanges === true) {
            $options .= ' --itemize-changes';
        }
        if ($this->backupDir !== null) {
            $options .= ' -b --backup-dir="' . $this->backupDir . '"';
        }

        if ($this->exclude !== null) {
            //remove trailing comma if any
            $this->exclude = trim($this->exclude, ',');
            $options .= ' --exclude="' . str_replace(',', '" --exclude="', $this->exclude) . '"';
        }

        if ($this->excludeFile !== null) {
            $options .= ' --exclude-from="' . $this->excludeFile . '"';
        }

        $this->setOptions($options);

        $options .= ' "' . $this->sourceDir . '" "' . $this->destinationDir . '"';

        escapeshellcmd($options);
        $options .= ' 2>&1';

        return $this->rsyncPath . ' ' . $options;
    }
527666
protected function getServer()
    {
        $server = new Server();
        $server->setHost($this->getHost())
            ->setRoot($this->getServerRoot())
            ->setBranch($this->getServerBranch())
            ->setCodeVersion($this->getServerCodeVersion());
        $extras = $this->getServerExtras();
        if (!$extras) {
            $extras = array();
        }

        $server->setExtras($extras);
        if (isset($_SERVER) && array_key_exists('argv', $_SERVER)) {
            $server->setArgv($_SERVER['argv']);
        }
        return $server;
    }
328224
protected function _buildCommand()
    {
        $command = $this->_binary;
        $options = (array)$this->getConfig('options');
        foreach ($options as $key => $value) {
            if (empty($value)) {
                continue;
            } elseif ($value === true) {
                $command .= ' --' . $key;
            } else {
                $command .= sprintf(' --%s %s', $key, escapeshellarg($value));
            }
        }

        return $command;
    }
746538
public function getEnv()
    {
        if (Request::isCli()) {
            return 'cli';
        }

        if (isset($_SERVER['SERVER_NAME'])) {
            $host = $_SERVER['SERVER_NAME'];
        } else {
            $host = $_SERVER['HTTP_HOST'];
            if ($_SERVER['SERVER_PORT'] != 80) {
                $host = explode(':', $host);
                $host = $host[0];
            }
        }

        switch ($host) {
            case $_SERVER['SERVER_ADDR'] :
                // no break
            case '127.0.0.1':
                //no break
            case 'localhost':
                return 'development';
        }

        $domain = substr($host, strrpos($host, '.') + 1);

        if ($domain == 'dev' || $domain == 'loc' || $domain == 'test') {
            return 'development';
        }

        if (substr($_SERVER['HTTP_HOST'], 0, 7) == '192.168') {
            return 'development';
        }
        return 'product';
    }
224069
public function buildCommand()
    {
        $command = $this->command . ' >> ' . $this->_output . ' 2>&1 &';

        return $this->_user ? 'sudo -u ' . $this->_user . ' ' . $command : $command;
    }
265072
public function buildCommand()
    {
        $command = $this->compileCommand();

        if (! is_null($this->user) && ! windows_os()) {
            return 'sudo -u ' .$this->user .' -- sh -c \'' .$command .'\'';
        }

        return $command;
    }
1026971
public static function run()
	{
		// fetch the commandline options
		$run_migration = \Cli::option('migrate', \Cli::option('m', false));
		$run_validation = $run_migration ? true : \Cli::option('validate', \Cli::option('v', false));

		// if no run options are present, show the help
		if ( ! $run_migration and ! $run_validation )
		{
			return static::help();
		}

		// step 1: run validation
		$validated = true;
		if ($run_validation)
		{
			$validated = static::run_validation();
		}

		// step 2: run migration
		if ($run_migration)
		{
			if ($validated)
			{
				$migrated = static::run_migration();
				if ($migrated)
				{
					\Cli::write('Migration succesfully finished', 'light_green');
				}
				else
				{
					\Cli::write("\n".'Migration failed. Skipping the remainder of the migration. Please correct the errors and run again.', 'light_red');
				}
			}
			else
			{
				\Cli::write("\n".'Validation failed. Skipping the actual migration. Please correct the errors.', 'light_red');
			}
		}
	}
1053694
private function getCommand()
    {
        // Prefix command with exec on non Windows systems to ensure that we
        // receive the correct pid.
        // See http://php.net/manual/en/function.proc-get-status.php#93382
        $commandPrefix = $this->isWindows() ? '' : 'exec ';
        return $commandPrefix . escapeshellarg(realpath($this->config['path'])) . ' ' . $this->getCommandParameters();
    }