<?php

class CommandSqlSectionBackup extends Command{
  
  public function Execute($VarDb) {
//    $VarDb = 'dbconfig';
    $VarSql = $this->ObjUpdateMod->ObjSystemMod->Backup($VarDb);
    
    $VarFileNameZip = $VarDb .'.zip';
    $VarFileNameSql = $VarDb .'.sql';
    $VarFileNameZipPath = $this->ObjUpdateMod->UpdateBackupFolder. $VarFileNameZip;

    $zip = new ZipArchive();
    if ($zip->open($VarFileNameZipPath, ZIPARCHIVE::CREATE)!==TRUE) {
      return FALSE;
    }
    $zip->addFromString($VarFileNameSql, $VarSql);
    $zip->close();
    if (true === file_exists($VarFileNameZipPath)){
      return TRUE;
    }
    else{
      return FALSE;
    }
//    return FALSE;
  }
}
?>