* SvnDriver::$useCache: false by default

* setting is adjust in 'interactive' mode when auth fails
main
till 13 years ago
parent 061d91b4a8
commit a3363a8560

@ -21,6 +21,13 @@ class SvnDriver extends VcsDriver implements VcsDriverInterface
*/ */
protected $useAuth = false; protected $useAuth = false;
/**
* @var boolean $useCache To determine if we should cache the credentials
* supplied by the user. By default: no cache.
* @see self::getSvnAuthCache()
*/
protected $useCache = false;
/** /**
* @var string $svnUsername * @var string $svnUsername
*/ */
@ -75,14 +82,23 @@ class SvnDriver extends VcsDriver implements VcsDriverInterface
// this could be any failure, but let's see if it's auth related // this could be any failure, but let's see if it's auth related
if ($status == 1 && $this->io->isInteractive()) { if ($status == 1 && $this->io->isInteractive()) {
if ($this->useAuth === false && strpos($output, 'authorization failed:') !== false) { if (strpos($output, 'authorization failed:') === false) {
return $output;
$this->io->write("The Subversion server ({$this->baseUrl}) request credentials:"); }
if (!$this->useAuth) {
$this->io->write("The Subversion server ({$this->baseUrl}) requested credentials:");
$this->svnUsername = $this->io->ask("Username"); $this->svnUsername = $this->io->ask("Username");
$this->svnPassword = $this->io->ask("Password"); $this->svnPassword = $this->io->ask("Password");
$this->useAuth = true; $this->useAuth = true;
$cacheTrueAnswers = array('yes', 'y', 'true', 'ja', 'si', 'da');
$cacheAnswer = strtolower($this->io->ask("Should we Subversion cache these credentials?", 'no'));
if (in_array($cacheAnswer, $cacheTrueAnswers)) {
$this->useCache = true;
}
// restart the process // restart the process
$output = $this->execute($command, $url); $output = $this->execute($command, $url);
} }
@ -228,7 +244,10 @@ class SvnDriver extends VcsDriver implements VcsDriverInterface
*/ */
public function getSvnAuthCache() public function getSvnAuthCache()
{ {
return '--no-auth-cache '; if (!$this->useCache) {
return '--no-auth-cache ';
}
return '';
} }
/** /**

Loading…
Cancel
Save