public function didExportRow()
 {
     $this->currentRowCount++;
     if ($this->updateProgress()) {
         if ($this->delegate && $this->delegate->isCancelled()) {
             $this->cancelled = true;
             return;
         }
     }
     if (SGBoot::isFeatureAvailable('BACKGROUND_MODE') && $this->delegate->isBackgroundMode()) {
         SGBackgroundMode::next();
     }
 }
Exemple #2
0
 private function addFileToArchive($path)
 {
     if ($this->shouldExcludeFile($path)) {
         return;
     }
     //check if it is a directory
     if (is_dir($path)) {
         $this->backupDirectory($path);
         return;
     }
     //it is a file, try to add it to archive
     if (is_readable($path)) {
         $file = substr($path, strlen($this->rootDirectory));
         $file = str_replace('\\', '/', $file);
         $this->sgbp->addFileFromPath($file, $path);
     } else {
         $this->warn('Could not read file (skipping): ' . $path);
     }
     //update progress and check cancellation
     $this->currentBackupFileCount++;
     if ($this->updateProgress()) {
         if ($this->delegate && $this->delegate->isCancelled()) {
             return;
         }
     }
     if (SGBoot::isFeatureAvailable('BACKGROUND_MODE') && $this->delegate->isBackgroundMode()) {
         SGBackgroundMode::next();
     }
 }
Exemple #3
0
 private function addFileToArchive($file, $stateData)
 {
     $path = $this->rootDirectory . $file;
     if ($this->shouldExcludeFile($path)) {
         return true;
     }
     //check if it is a directory
     if (is_dir($path)) {
         $this->sgbp->addFile($file, '');
         //create empty directory
         return true;
     }
     //it is a file, try to add it to archive
     if (is_readable($path)) {
         $this->sgbp->addFileFromPath($file, $path, $stateData);
     } else {
         $this->warn('Could not read file (skipping): ' . $path);
     }
     //update progress and check cancellation
     $this->currentBackupFileCount++;
     if ($this->updateProgress()) {
         if ($this->delegate && $this->delegate->isCancelled()) {
             return false;
         }
     }
     if (SGBoot::isFeatureAvailable('BACKGROUND_MODE') && $this->delegate->isBackgroundMode()) {
         SGBackgroundMode::next();
     }
     return true;
 }