Skip to content

Commit

Permalink
Make 'temp' argument to the binary backend driver optional
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Apr 9, 2015
1 parent 8768968 commit 8602688
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion framework/Crypt/lib/Horde/Crypt/Pgp.php
Expand Up @@ -853,7 +853,7 @@ protected function _initDrivers()
if (Horde_Crypt_Pgp_Backend_Binary::supported()) {
$this->_backends[] = new Horde_Crypt_Pgp_Backend_Binary(
$this->_params['program'],
$this->_params['temp']
isset($this->_params['temp']) ? $this->_params['temp'] : null
);
}
}
Expand Down
7 changes: 5 additions & 2 deletions framework/Crypt/lib/Horde/Crypt/Pgp/Backend/Binary.php
Expand Up @@ -62,9 +62,12 @@ class Horde_Crypt_Pgp_Backend_Binary
* @param string $gnupg The path to the GnuPG binary.
* @param string $temp Location of temporary directory.
*/
public function __construct($gnupg, $temp)
public function __construct($gnupg, $temp = null)
{
$this->_tempdir = Horde_Util::createTempDir(true, $temp);
$this->_tempdir = Horde_Util::createTempDir(
true,
is_null($temp) ? sys_get_temp_dir() : $temp
);

/* Store the location of GnuPG and set common options. */
$this->_gnupg = array(
Expand Down
4 changes: 1 addition & 3 deletions framework/Crypt/test/Horde/Crypt/Pgp/BinaryTest.php
Expand Up @@ -27,9 +27,7 @@ protected function _setUp()
));
}

return array(
new Horde_Crypt_Pgp_Backend_Binary($gnupg, sys_get_temp_dir())
);
return array(new Horde_Crypt_Pgp_Backend_Binary($gnupg));
}

}
3 changes: 1 addition & 2 deletions framework/Crypt/test/Horde/Crypt/PgpKeyserverTest.php
Expand Up @@ -21,8 +21,7 @@ protected function setUp()

$this->_ks = new Horde_Crypt_Pgp_Keyserver(
Horde_Crypt::factory('Pgp', array(
'program' => '/usr/bin/gpg',
'temp' => sys_get_temp_dir()
'program' => '/usr/bin/gpg'
))
);
}
Expand Down

0 comments on commit 8602688

Please sign in to comment.