/** * (non-PHPdoc) * @ignore * @see \mithra62\Validate\RuleInterface::validate() */ public function validate($field, $input, array $params = array()) { try { if ($input == '' || empty($params['0'])) { return false; } $params = $params['0']; if (empty($params['rcf_username']) || empty($params['rcf_api']) || empty($params['rcf_container'])) { return false; } $local = new Remote(new Local(dirname($this->getTestFilePath()))); $client = Rcf::getRemoteClient($params, true); if ($client instanceof \OpenCloud\ObjectStore\Resource\Container) { $contents = $local->read($this->test_file); $filesystem = new Remote(new Rcf($client, $params['rcf_container'])); if ($filesystem->has($this->test_file)) { $filesystem->delete($this->test_file); } else { if ($filesystem->write($this->test_file, $contents)) { $filesystem->delete($this->test_file); } } return true; } } catch (\Exception $e) { return false; } }
/** * (non-PHPdoc) * @ignore * @see \mithra62\Validate\RuleInterface::validate() */ public function validate($field, $input, array $params = array()) { try { if ($input == '' || empty($params['0'])) { return false; } $params = $params['0']; if (empty($params['rcf_username']) || empty($params['rcf_api'])) { return false; } return m62Rcf::getRemoteClient($params, false); } catch (\Exception $e) { return false; } }
/** * (non-PHPdoc) * @see \mithra62\Validate\RuleInterface::validate() * @ignore */ public function validate($field, $input, array $params = array()) { try { if ($input == '' || empty($params['0'])) { return false; } $params = $params['0']; if (empty($params['rcf_username']) || empty($params['rcf_api']) || empty($params['rcf_container'])) { return false; } $client = Rcf::getRemoteClient($params, true); if ($client instanceof \OpenCloud\ObjectStore\Resource\Container) { $filesystem = new Remote(new Rcf($client, $params['rcf_container'])); $filesystem->getAdapter()->listContents(); return true; } } catch (\Exception $e) { return false; } }
/** * Returns an instance of the Fileysystem object * @return \mithra62\BackupPro\Remote */ public function getFileSystem() { $container = m62Rcf::getRemoteClient($this->settings); $filesystem = new Remote(new m62Rcf($container)); $filesystem->checkBackupDirs(); return $filesystem; }