Merge branch 'fix-keys'

This commit is contained in:
Dmitry Khomutov 2018-03-16 20:47:06 +07:00
commit 09edebc0bc
No known key found for this signature in database
GPG key ID: EC19426474B37AAC
3 changed files with 10 additions and 14 deletions

View file

@ -472,13 +472,11 @@ class Build extends BaseBuild
*/ */
protected function writeSshKey($cloneTo) protected function writeSshKey($cloneTo)
{ {
$keyPath = $cloneTo . 'temp'; $tempKeyFile = tempnam(sys_get_temp_dir(), 'key_');
$keyFile = $keyPath . '.key';
file_put_contents($keyFile, $this->getProject()->getSshPrivateKey()); file_put_contents($tempKeyFile, $this->getProject()->getSshPrivateKey());
chmod($keyFile, 0600);
return $keyFile; return $tempKeyFile;
} }
/** /**
@ -491,9 +489,6 @@ class Build extends BaseBuild
*/ */
protected function writeSshWrapper($cloneTo, $keyFile) protected function writeSshWrapper($cloneTo, $keyFile)
{ {
$path = $cloneTo . 'temp';
$wrapperFile = $path . '.sh';
$sshFlags = '-o CheckHostIP=no -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o PasswordAuthentication=no'; $sshFlags = '-o CheckHostIP=no -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o PasswordAuthentication=no';
// Write out the wrapper script for this build: // Write out the wrapper script for this build:
@ -502,11 +497,12 @@ class Build extends BaseBuild
ssh {$sshFlags} -o IdentityFile={$keyFile} $* ssh {$sshFlags} -o IdentityFile={$keyFile} $*
OUT; OUT;
$tempShFile = tempnam(sys_get_temp_dir(), 'sh_');
file_put_contents($wrapperFile, $script); file_put_contents($tempShFile, $script);
shell_exec('chmod +x "' . $wrapperFile . '"'); shell_exec('chmod +x "' . $tempShFile . '"');
return $wrapperFile; return $tempShFile;
} }
/** /**

View file

@ -99,7 +99,7 @@ class PhpCpd extends Plugin implements ZeroConfigPluginInterface
$phpcpd = $this->findBinary('phpcpd'); $phpcpd = $this->findBinary('phpcpd');
$tmpFileName = tempnam('/tmp', 'phpcpd'); $tmpFileName = tempnam(sys_get_temp_dir(), 'phpcpd_');
$cmd = $phpcpd . ' --log-pmd "%s" %s "%s"'; $cmd = $phpcpd . ' --log-pmd "%s" %s "%s"';
$success = $this->builder->executeCommand($cmd, $tmpFileName, $ignore, $this->path); $success = $this->builder->executeCommand($cmd, $tmpFileName, $ignore, $this->path);

View file

@ -161,7 +161,7 @@ class PhpUnit extends Plugin implements ZeroConfigPluginInterface
$buildPath = $this->build->getBuildPath(); $buildPath = $this->build->getBuildPath();
// Save the results into a log file // Save the results into a log file
$logFile = @tempnam($buildPath, 'jLog_'); $logFile = tempnam(sys_get_temp_dir(), 'jlog_');
$options->addArgument('log-' . $logFormat, $logFile); $options->addArgument('log-' . $logFormat, $logFile);
// Removes any current configurations files // Removes any current configurations files
@ -258,7 +258,7 @@ class PhpUnit extends Plugin implements ZeroConfigPluginInterface
$this->builder, 'php_unit', $error['message'], $severity, $error['file'], $error['line'] $this->builder, 'php_unit', $error['message'], $severity, $error['file'], $error['line']
); );
} }
@unlink($logFile); unlink($logFile);
} else { } else {
throw new \Exception('log output file does not exist: ' . $logFile); throw new \Exception('log output file does not exist: ' . $logFile);
} }