예제 #1
0
 /**
  * Class constructor, config should overwrite following option:
  * * remotepath.
  *
  * @param array $config
  *
  * @throws Exception\MisconfigurationException Occures if the remote path can not be created
  */
 public function __construct(array $config = null)
 {
     parent::__construct($config);
     if (null !== $this->_remotepath && false === file_exists($this->_remotepath)) {
         if (false === @mkdir($this->_remotepath, 0755, true)) {
             throw new Exception\MisconfigurationException(sprintf('Can not create remote path %s', $this->_remotepath));
         }
     }
 }
예제 #2
0
 /**
  * Class constructor, config can overwrite following options:
  * * host
  * * port
  * * username
  * * password
  * * remotepath.
  *
  * @param array $config
  *
  * @throws \BackBee\Util\Transport\Exception\TransportException Occures if extensions OpenSSL or libssh2 are unavailable
  */
 public function __construct(array $config = array())
 {
     parent::__construct($config);
     if (false === extension_loaded('openssl')) {
         throw new TransportException('The SFTP transport requires openssl extension.');
     }
     if (false === function_exists('ssh2_connect')) {
         throw new TransportException('The SFTP transport requires libssh2 extension.');
     }
 }
예제 #3
0
 public function __construct(array $config = null)
 {
     parent::__construct($config);
     if (null !== $config) {
         if (array_key_exists('passive', $config)) {
             $this->_passive = true === $config['passive'];
         }
         if (array_key_exists('mode', $config)) {
             $this->_mode = defined('FTP_' . strtoupper($config['mode'])) ? constant('FTP_' . strtoupper($config['mode'])) : $this->_mode;
         }
     }
 }