You are here

function PclZip::duplicate in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/PCLZip/pclzip.lib.php \PclZip::duplicate()

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/PCLZip/pclzip.lib.php, line 1162

Class

PclZip

Code

function duplicate($p_archive) {
  $v_result = 1;

  // ----- Reset the error handler
  $this
    ->privErrorReset();

  // ----- Look if the $p_archive is a PclZip object
  if (is_object($p_archive) && get_class($p_archive) == 'pclzip') {

    // ----- Duplicate the archive
    $v_result = $this
      ->privDuplicate($p_archive->zipname);
  }
  else {
    if (is_string($p_archive)) {

      // ----- Check that $p_archive is a valid zip file
      // TBC : Should also check the archive format
      if (!is_file($p_archive)) {

        // ----- Error log
        PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename '" . $p_archive . "'");
        $v_result = PCLZIP_ERR_MISSING_FILE;
      }
      else {

        // ----- Duplicate the archive
        $v_result = $this
          ->privDuplicate($p_archive);
      }
    }
    else {

      // ----- Error log
      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add");
      $v_result = PCLZIP_ERR_INVALID_PARAMETER;
    }
  }

  // ----- Return
  return $v_result;
}