Update to Drupal 8.2.6. For more information, see https://www.drupal.org/project/drupal/releases/8.2.6

This commit is contained in:
Pantheon Automation 2017-02-02 16:28:38 -08:00 committed by Greg Anderson
parent db56c09587
commit f1e72395cb
588 changed files with 26857 additions and 2777 deletions

View file

@ -22,10 +22,9 @@ abstract class AbstractPipes implements PipesInterface
public $pipes = array();
/** @var string */
protected $inputBuffer = '';
private $inputBuffer = '';
/** @var resource|null */
protected $input;
private $input;
/** @var bool */
private $blocked = true;
@ -91,9 +90,8 @@ abstract class AbstractPipes implements PipesInterface
if (!isset($this->pipes[0])) {
return;
}
$e = array();
$r = null !== $this->input ? array($this->input) : $e;
$input = $this->input;
$r = $e = array();
$w = array($this->pipes[0]);
// let's have a look if something changed in streams
@ -110,7 +108,7 @@ abstract class AbstractPipes implements PipesInterface
}
}
foreach ($r as $input) {
if ($input) {
for (;;) {
$data = fread($input, self::CHUNK_SIZE);
if (!isset($data[0])) {
@ -124,7 +122,7 @@ abstract class AbstractPipes implements PipesInterface
return array($this->pipes[0]);
}
}
if (!isset($data[0]) && feof($input)) {
if (feof($input)) {
// no more data to read on input resource
// use an empty buffer in the next reads
$this->input = null;
@ -136,9 +134,7 @@ abstract class AbstractPipes implements PipesInterface
if (null === $this->input && !isset($this->inputBuffer[0])) {
fclose($this->pipes[0]);
unset($this->pipes[0]);
}
if (!$w) {
} elseif (!$w) {
return array($this->pipes[0]);
}
}

View file

@ -39,10 +39,10 @@ interface PipesInterface
/**
* Reads data in file handles and pipes.
*
* @param bool $blocking Whether to use blocking calls or not.
* @param bool $close Whether to close pipes if they've reached EOF.
* @param bool $blocking Whether to use blocking calls or not
* @param bool $close Whether to close pipes if they've reached EOF
*
* @return string[] An array of read data indexed by their fd.
* @return string[] An array of read data indexed by their fd
*/
public function readAndWrite($blocking, $close = false);

View file

@ -120,7 +120,7 @@ class UnixPipes extends AbstractPipes
do {
$data = fread($pipe, self::CHUNK_SIZE);
$read[$type] .= $data;
} while (isset($data[0]));
} while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
if (!isset($read[$type][0])) {
unset($read[$type]);
@ -149,7 +149,7 @@ class UnixPipes extends AbstractPipes
* @param Process $process
* @param string|resource $input
*
* @return UnixPipes
* @return static
*/
public static function create(Process $process, $input)
{

View file

@ -47,15 +47,40 @@ class WindowsPipes extends AbstractPipes
// Workaround for this problem is to use temporary files instead of pipes on Windows platform.
//
// @see https://bugs.php.net/bug.php?id=51800
$this->files = array(
Process::STDOUT => tempnam(sys_get_temp_dir(), 'out_sf_proc'),
Process::STDERR => tempnam(sys_get_temp_dir(), 'err_sf_proc'),
$pipes = array(
Process::STDOUT => Process::OUT,
Process::STDERR => Process::ERR,
);
foreach ($this->files as $offset => $file) {
if (false === $file || false === $this->fileHandles[$offset] = @fopen($file, 'rb')) {
throw new RuntimeException('A temporary file could not be opened to write the process output to, verify that your TEMP environment variable is writable');
$tmpCheck = false;
$tmpDir = sys_get_temp_dir();
$lastError = 'unknown reason';
set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
for ($i = 0;; ++$i) {
foreach ($pipes as $pipe => $name) {
$file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
if (file_exists($file) && !unlink($file)) {
continue 2;
}
$h = fopen($file, 'xb');
if (!$h) {
$error = $lastError;
if ($tmpCheck || $tmpCheck = unlink(tempnam(false, 'sf_check_'))) {
continue;
}
restore_error_handler();
throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $error));
}
if (!$h || !$this->fileHandles[$pipe] = fopen($file, 'rb')) {
continue 2;
}
if (isset($this->files[$pipe])) {
unlink($this->files[$pipe]);
}
$this->files[$pipe] = $file;
}
break;
}
restore_error_handler();
}
parent::__construct($input);
@ -158,7 +183,7 @@ class WindowsPipes extends AbstractPipes
* @param Process $process The process
* @param $input
*
* @return WindowsPipes
* @return static
*/
public static function create(Process $process, $input)
{