Пример #1
0
 public function testCompressFile()
 {
     $src = dirname(__FILE__) . '/sample/releases.xml';
     $dest = dirname(__FILE__) . '/backup/releases.xml.zip';
     taoUpdate_helpers_Zip::compressFile($src, $dest);
     $zip = new ZipArchive();
     $zip->open($dest);
     $this->assertFalse($zip->locateName('releases.xml') === false);
     helpers_File::remove($dest);
 }
 /**
  * 
  * @access
  * @author "Lionel Lecaque, <*****@*****.**>"
  * @param unknown $folder
  * @throws taoUpdate_models_classes_UpdateException
  */
 public function storeDatabase($folder)
 {
     $dbBackupHelper = new taoUpdate_helpers_DbBackup();
     $fileContent = $dbBackupHelper->backup();
     $filepath = $folder . DIRECTORY_SEPARATOR . self::DB_BACKUP_FILE_PREFFIX . TAO_VERSION . self::DB_BACKUP_FILE_SUFFIX;
     if (!file_put_contents($filepath, $fileContent)) {
         throw new taoUpdate_models_classes_UpdateException('fail to create SQL file');
     }
     if (is_file($filepath)) {
         taoUpdate_helpers_Zip::compressFile($filepath, $filepath . '.zip');
         if (is_file($filepath . '.zip')) {
             helpers_File::remove($filepath);
         }
     }
 }