PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 3.2.5
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v3.2.5
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
wp-optimize / vendor / symfony / process / PhpProcess.php

PhpProcess.php in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 3.2.5, at vendor/symfony/process/PhpProcess.php

77 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <[email protected]>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\Process;
13
14 use Symfony\Component\Process\Exception\RuntimeException;
15
16 /**
17 * PhpProcess runs a PHP script in an independent process.
18 *
19 * $p = new PhpProcess('<?php echo "foo"; ?>');
20 * $p->run();
21 * print $p->getOutput()."\n";
22 *
23 * @author Fabien Potencier <[email protected]>
24 */
25 class PhpProcess extends Process
26 {
27 /**
28 * @param string $script The PHP script to run (as a string)
29 * @param string|null $cwd The working directory or null to use the working dir of the current PHP process
30 * @param array|null $env The environment variables or null to use the same environment as the current PHP process
31 * @param int $timeout The timeout in seconds
32 * @param array $options An array of options for proc_open
33 */
34 public function __construct($script, $cwd = null, array $env = null, $timeout = 60, array $options = null)
35 {
36 $executableFinder = new PhpExecutableFinder();
37 if (false === $php = $executableFinder->find(false)) {
38 $php = null;
39 } else {
40 $php = array_merge([$php], $executableFinder->findArguments());
41 }
42 if ('phpdbg' === \PHP_SAPI) {
43 $file = tempnam(sys_get_temp_dir(), 'dbg');
44 file_put_contents($file, $script);
45 register_shutdown_function('unlink', $file);
46 $php[] = $file;
47 $script = null;
48 }
49 if (null !== $options) {
50 @trigger_error(sprintf('The $options parameter of the %s constructor is deprecated since Symfony 3.3 and will be removed in 4.0.', __CLASS__), \E_USER_DEPRECATED);
51 }
52
53 parent::__construct($php, $cwd, $env, $script, $timeout, $options);
54 }
55
56 /**
57 * Sets the path to the PHP binary to use.
58 */
59 public function setPhpBinary($php)
60 {
61 $this->setCommandLine($php);
62 }
63
64 /**
65 * {@inheritdoc}
66 */
67 public function start(callable $callback = null/*, array $env = []*/)
68 {
69 if (null === $this->getCommandLine()) {
70 throw new RuntimeException('Unable to find the PHP executable.');
71 }
72 $env = 1 < \func_num_args() ? func_get_arg(1) : null;
73
74 parent::start($callback, $env);
75 }
76 }
77