gzwrite example



        return true;
    }

    /** * @param resource $fileHandler * @param string $content */
    private function write($fileHandler$content)
    {
        gzwrite($fileHandler$content);
    }

    /** * Makes sure all files get closed and replaces the old sitemaps with the freshly generated ones */
    private function moveFiles()
    {
        /** @var Sitemap[] $sitemaps */
        foreach ($this->sitemaps as $shopId => $sitemaps) {
            // Delete old sitemaps for this siteId             foreach ($this->filesystem->listContents(sprintf('shop-%d', $shopId)) as $file) {
                
$v_buffer = @gzread($p_src$v_read_size);
        @fwrite($p_dest$v_buffer$v_read_size);
        $p_size -= $v_read_size;
      }
    }
    else if ($p_mode==2)
    {
      while ($p_size != 0)
      {
        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
        $v_buffer = @fread($p_src$v_read_size);
        @gzwrite($p_dest$v_buffer$v_read_size);
        $p_size -= $v_read_size;
      }
    }
    else if ($p_mode==3)
    {
      while ($p_size != 0)
      {
        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
        $v_buffer = @gzread($p_src$v_read_size);
        @gzwrite($p_dest$v_buffer$v_read_size);
        $p_size -= $v_read_size;
      }
$this->printHeader();

        $this->tmpFiles[] = $filePath;
    }

    /** * @param Url[] $urls */
    public function write(array $urls): void
    {
        foreach ($urls as $url) {
            gzwrite($this->handle, (string) $url);
            ++$this->urlCount;

            if ($this->urlCount % self::MAX_URLS === 0) {
                $this->printFooter();
                gzclose($this->handle);
                ++$this->index;
                $path = $this->getTmpFilePath($this->context);
                $this->openGzip($path);
                $this->printHeader();
                $this->tmpFiles[] = $path;
            }
        }
Home | Imprint | This part of the site doesn't use cookies.