Ejemplo n.º 1
0
 public function backup()
 {
     if ($this->isLocalBackupEnabled() || $this->isFTPBackupEnabled()) {
         $sourceConfig = DatabaseConfig::getInstanceFromConfigFile();
         $source = new MysqlSource($sourceConfig);
         $fileDest = new File($sourceConfig);
         $dbBackup = new DatabaseBackup($source, $fileDest);
         $dbBackup->backup();
         $this->location->limitBackup();
         $this->zip->addFile($fileDest->getFilePath(), false);
         foreach ($this->folderList as $folder) {
             $path = $this->getFolderPath($folder);
             $folder = $this->addTrailingSlash($folder);
             $this->zip->addDirectory($path, $folder);
         }
         $this->zip->close();
         $this->location->save($this->getBackupFileName());
         if (file_exists($fileDest->getFilePath())) {
             //unlink($fileDest->getFilePath());
         }
     }
 }