예제 #1
0
  /**
   * Do the actual file save. This function is called to save the data file AND
   * the metadata sidecar file.
   * @param \BackupMigrate\Core\File\BackupFileReadableInterface $file
   * @throws \BackupMigrate\Core\Exception\BackupMigrateException
   */
  function _saveFile(BackupFileReadableInterface $file) {
    // Check if the directory exists.
    $this->checkDirectory();

    copy($file->realpath(), $this->_idToPath($file->getFullName()));
    // @TODO: use copy/unlink if the temp file and the destination do not share a stream wrapper.
  }
예제 #2
0
 /**
  * Do the actual file save. This function is called to save the data file AND
  * the metadata sidecar file.
  * @param \BackupMigrate\Core\File\BackupFileReadableInterface $file
  * @throws \BackupMigrate\Core\Exception\BackupMigrateException
  */
 function _saveFile(BackupFileReadableInterface $file)
 {
     // Check if the directory exists.
     $this->checkDirectory();
     // @TODO Decide what the appropriate file_exists strategy should be.
     file_unmanaged_move($file->realpath(), $this->confGet('directory') . $file->getFullName(), FILE_EXISTS_REPLACE);
 }
예제 #3
0
 /**
  * Gzip decode a file.
  *
  * @param \BackupMigrate\Core\File\BackupFileReadableInterface $from
  * @param \BackupMigrate\Core\File\BackupFileWritableInterface $to
  * @return bool
  */
 protected function _ZipDecode(BackupFileReadableInterface $from, BackupFileWritableInterface $to)
 {
     $success = FALSE;
     if (class_exists('ZipArchive')) {
         $zip = new \ZipArchive();
         $res = $zip->open($to->realpath(), constant("ZipArchive::CREATE"));
         if ($res === TRUE) {
             $zip->addFile($from->realpath(), $from->getMeta('filename'));
             $success = $zip->close();
         }
     }
     return $success;
 }