/** * (non-PHPDoc) * * @see \phpbu\App\Backup\Sync::setup() * @param array $config * @throws \phpbu\App\Backup\Sync\Exception */ public function setup(array $config) { if (!class_exists('\\ObjectStorage')) { throw new Exception('SoftLayer SDK not loaded: use composer "softlayer/objectstorage": "dev-master" to install'); } if (!Arr::isSetAndNotEmptyString($config, 'user')) { throw new Exception('SoftLayer user is mandatory'); } if (!Arr::isSetAndNotEmptyString($config, 'secret')) { throw new Exception('SoftLayer password is mandatory'); } if (!Arr::isSetAndNotEmptyString($config, 'container')) { throw new Exception('SoftLayer container name is mandatory'); } if (!Arr::isSetAndNotEmptyString($config, 'host')) { throw new Exception('SoftLayer host is mandatory'); } if (!Arr::isSetAndNotEmptyString($config, 'path')) { throw new Exception('SoftLayer path is mandatory'); } $this->user = $config['user']; $this->secret = $config['secret']; $this->container = $config['container']; $this->host = $config['host']; $this->path = Str::withLeadingSlash(Str::withTrailingSlash(Str::replaceDatePlaceholders($config['path']))); }
/** * (non-PHPDoc) * * @see \phpbu\App\Backup\Sync::setup() * @param array $config * @throws \phpbu\App\Backup\Sync\Exception */ public function setup(array $config) { if (!class_exists('\\Barracuda\\Copy\\API')) { throw new Exception('Copy api not loaded: use composer "barracuda/copy": "1.1.*" to install'); } if (!Arr::isSetAndNotEmptyString($config, 'app.key')) { throw new Exception('API access key is mandatory'); } if (!Arr::isSetAndNotEmptyString($config, 'app.secret')) { throw new Exception('API access secret is mandatory'); } if (!Arr::isSetAndNotEmptyString($config, 'user.key')) { throw new Exception('User access key is mandatory'); } if (!Arr::isSetAndNotEmptyString($config, 'user.secret')) { throw new Exception('User access secret is mandatory'); } if (!Arr::isSetAndNotEmptyString($config, 'path')) { throw new Exception('copy.com path is mandatory'); } $this->appKey = $config['app.key']; $this->appSecret = $config['app.secret']; $this->userKey = $config['user.key']; $this->userSecret = $config['user.secret']; $this->path = Str::withTrailingSlash(Str::replaceDatePlaceholders($config['path'])); }
/** * (non-PHPDoc) * * @see \phpbu\App\Backup\Sync::setup() * @param array $config * @throws \phpbu\App\Backup\Sync\Exception */ public function setup(array $config) { if (!class_exists('\\Aws\\S3\\S3Client')) { throw new Exception('Amazon SDK not loaded: use composer "aws/aws-sdk-php": "2.7.*" to install'); } if (!Arr::isSetAndNotEmptyString($config, 'key')) { throw new Exception('AWS key is mandatory'); } if (!Arr::isSetAndNotEmptyString($config, 'secret')) { throw new Exception('AWS secret is mandatory'); } if (!Arr::isSetAndNotEmptyString($config, 'bucket')) { throw new Exception('AWS S3 bucket name is mandatory'); } if (!Arr::isSetAndNotEmptyString($config, 'region')) { throw new Exception('AWS S3 region is mandatory'); } if (!Arr::isSetAndNotEmptyString($config, 'path')) { throw new Exception('AWS S3 path / object-key is mandatory'); } $this->key = $config['key']; $this->secret = $config['secret']; $this->bucket = $config['bucket']; $this->region = $config['region']; $this->path = Str::withTrailingSlash(Str::replaceDatePlaceholders($config['path'])); $this->acl = Arr::getValue($config, 'acl', 'private'); }
/** * (non-PHPDoc) * * @see \phpbu\App\Backup\Sync::setup() * @param array $config * @throws \phpbu\App\Backup\Sync\Exception */ public function setup(array $config) { if (!class_exists('\\Mackey\\Yandex\\Client')) { throw new Exception('Yandex.Disk sdk not loaded: use composer to install "arhitector/yandex"'); } if (!Arr::isSetAndNotEmptyString($config, 'token')) { throw new Exception('API access token is mandatory'); } if (!Arr::isSetAndNotEmptyString($config, 'path')) { throw new Exception('yandex.disk path is mandatory'); } $this->token = $config['token']; $this->path = Str::withTrailingSlash(Str::replaceDatePlaceholders($config['path'])); }
/** * (non-PHPDoc) * * @see \phpbu\App\Backup\Sync::setup() * @param array $config * @throws \phpbu\App\Backup\Sync\Exception */ public function setup(array $config) { if (!class_exists('\\Dropbox\\Client')) { throw new Exception('Dropbox sdk not loaded: use composer "dropbox/dropbox-sdk": "1.1.*" to install'); } if (!Arr::isSetAndNotEmptyString($config, 'token')) { throw new Exception('API access token is mandatory'); } if (!Arr::isSetAndNotEmptyString($config, 'path')) { throw new Exception('dropbox path is mandatory'); } $this->token = $config['token']; $this->path = Str::withTrailingSlash(Str::replaceDatePlaceholders($config['path'])); }
/** * Setup. * * @see \phpbu\App\Backup\Crypter * @param array $options * @throws Exception */ public function setup(array $options = array()) { if (!Util\Arr::isSetAndNotEmptyString($options, 'algorithm')) { throw new Exception('openssl expects \'algorithm\''); } if (!Util\Arr::isSetAndNotEmptyString($options, 'password') && !Util\Arr::isSetAndNotEmptyString($options, 'certFile')) { throw new Exception('openssl expects \'key\' or \'password\''); } $this->pathToOpenSSL = Util\Arr::getValue($options, 'pathToOpenSSL'); $this->showStdErr = Util\Str::toBoolean(Util\Arr::getValue($options, 'showStdErr', ''), false); $this->keepUncrypted = Util\Str::toBoolean(Util\Arr::getValue($options, 'keepUncrypted', ''), false); $this->certFile = $this->toAbsolutePath(Util\Arr::getValue($options, 'certFile')); $this->algorithm = Util\Arr::getValue($options, 'algorithm'); $this->password = Util\Arr::getValue($options, 'password'); }
/** * Setup. * * @see \phpbu\App\Backup\Crypter * @param array $options * @throws Exception */ public function setup(array $options = array()) { if (!Util\Arr::isSetAndNotEmptyString($options, 'algorithm')) { throw new Exception('mcrypt \'algorithm\' is mandatory'); } $this->pathToMcrypt = Util\Arr::getValue($options, 'pathToMcrypt'); $this->showStdErr = Util\Str::toBoolean(Util\Arr::getValue($options, 'showStdErr', ''), false); $this->keepUncrypted = Util\Str::toBoolean(Util\Arr::getValue($options, 'keepUncrypted', ''), false); $this->key = Util\Arr::getValue($options, 'key'); $this->keyFile = $this->toAbsolutePath(Util\Arr::getValue($options, 'keyFile')); $this->algorithm = $options['algorithm']; $this->hash = Util\Arr::getValue($options, 'hash'); $this->config = $this->toAbsolutePath(Util\Arr::getValue($options, 'config')); if (empty($this->key) && empty($this->keyFile)) { throw new Exception('one of \'key\' or \'keyFile\' is mandatory'); } }
/** * (non-PHPDoc) * * @see \phpbu\App\Backup\Sync::setup() * @param array $config * @throws \phpbu\App\Backup\Sync\Exception */ public function setup(array $config) { if (!class_exists('\\phpseclib\\Net\\SFTP')) { throw new Exception('phpseclib not installed - use composer to install "phpseclib/phpseclib" version 2.x'); } if (!Arr::isSetAndNotEmptyString($config, 'host')) { throw new Exception('option \'host\' is missing'); } if (!Arr::isSetAndNotEmptyString($config, 'user')) { throw new Exception('option \'user\' is missing'); } if (!Arr::isSetAndNotEmptyString($config, 'password')) { throw new Exception('option \'password\' is missing'); } $path = Arr::getValue($config, 'path', ''); if ('/' === substr($path, 0, 1)) { throw new Exception('absolute path is not allowed'); } $this->host = $config['host']; $this->user = $config['user']; $this->password = $config['password']; $this->remotePath = Str::withoutTrailingSlash(Str::replaceDatePlaceholders($path)); }
public function setup(array $config) { if (!function_exists('ftp_connect')) { throw new Exception('ftp functions not enabled'); } if (!Arr::isSetAndNotEmptyString($config, 'host')) { throw new Exception('option \'host\' is missing'); } if (!Arr::isSetAndNotEmptyString($config, 'user')) { throw new Exception('option \'user\' is missing'); } if (!Arr::isSetAndNotEmptyString($config, 'password')) { throw new Exception('option \'password\' is missing'); } $path = Arr::getValue($config, 'path', ''); if ('/' === substr($path, 0, 1)) { throw new Exception('absolute path is not allowed'); } $this->host = $config['host']; $this->user = $config['user']; $this->password = $config['password']; $this->remotePath = Str::withoutTrailingSlash(Str::replaceDatePlaceholders($path)); }
/** * (non-PHPDoc) * * @see \phpbu\App\Backup\Sync::setup() * @param array $options * @throws \phpbu\App\Backup\Sync\Exception */ public function setup(array $options) { $this->pathToRsync = Util\Arr::getValue($options, 'pathToRsync'); if (Util\Arr::isSetAndNotEmptyString($options, 'args')) { $this->args = $options['args']; } else { if (!Util\Arr::isSetAndNotEmptyString($options, 'path')) { throw new Exception('option \'path\' is missing'); } $this->path = Util\Str::replaceDatePlaceholders($options['path']); if (Util\Arr::isSetAndNotEmptyString($options, 'user')) { $this->user = $options['user']; } if (Util\Arr::isSetAndNotEmptyString($options, 'host')) { $this->host = $options['host']; } $this->excludes = Util\Str::toList(Util\Arr::getValue($options, 'exclude', ''), ':'); $this->delete = Util\Str::toBoolean(Util\Arr::getValue($options, 'delete', ''), false); $this->isDirSync = Util\Str::toBoolean(Util\Arr::getValue($options, 'dirsync', ''), false); } }