示例#1
0
文件: Gcs.php 项目: hhgr/hhgolf
 /**
  * Returns the Filesystem object setup for work
  * @return \mithra62\BackupPro\Remote
  */
 public function getFileSystem()
 {
     $client = m62Gcs::getRemoteClient($this->settings['gcs_access_key'], $this->settings['gcs_secret_key']);
     $options = array();
     if ($this->settings['gcs_reduced_redundancy'] == '1') {
         $options['StorageClass'] = 'REDUCED_REDUNDANCY';
     }
     $adapter = new m62Gcs($client, $this->settings['gcs_bucket'], $this->settings['gcs_optional_prefix'], $options);
     $filesystem = new Remote($adapter);
     $filesystem->checkBackupDirs();
     return $filesystem;
 }
示例#2
0
文件: Ftp.php 项目: hhgr/hhgolf
 /**
  * Returns an instance of the Fileysystem object
  * @return \mithra62\BackupPro\Remote
  */
 public function getFileSystem()
 {
     $filesystem = new Remote(new m62Ftp(['host' => $this->settings['ftp_hostname'], 'username' => $this->settings['ftp_username'], 'password' => $this->settings['ftp_password'], 'port' => $this->settings['ftp_port'], 'passive' => isset($this->settings['ftp_passive']) ? $this->settings['ftp_passive'] : '0', 'ssl' => !empty($this->settings['ftp_ssl']) ? $this->settings['ftp_ssl'] : '0', 'timeout' => !empty($this->settings['ftp_timeout']) ? $this->settings['ftp_timeout'] : '30']));
     $filesystem->getAdapter()->setRoot($this->settings['ftp_store_location']);
     $filesystem->checkBackupDirs();
     return $filesystem;
 }
示例#3
0
文件: Rcf.php 项目: hhgr/hhgolf
 /**
  * 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;
 }
示例#4
0
文件: Local.php 项目: hhgr/hhgolf
 /**
  * Should create a file using the Driver service
  * @param string $file The path to the file to create on the service
  * @param string $type
  * @return bool
  */
 public function createFile($file, $type = 'database')
 {
     $filesystem = new Remote(new m62Local($this->settings['backup_store_location']));
     $filesystem->checkBackupDirs();
     $file_name = basename($file);
     $new_path = $this->settings['backup_store_location'] . DIRECTORY_SEPARATOR . $type . DIRECTORY_SEPARATOR . $file_name;
     if (!file_exists($new_path)) {
         return copy($file, $new_path);
     }
 }