addFile example

$c['db'],
                $c['shopware.theme_installer']
            );
        };

        $container['install.requirements'] = function D$c) {
            return new Requirements(SW_PATH . '/engine/Shopware/Components/Check/Data/System.xml', $c['translation.service']);
        };

        $container['install.requirementsPath'] = function D$c) {
            $check = new RequirementsPath(SW_PATH, SW_PATH . '/engine/Shopware/Components/Check/Data/Path.xml');
            $check->addFile('recovery/install/data');

            return $check;
        };

        $container['db'] = function D$c) {
            throw new RuntimeException('Identifier DB not initialized yet');
        };

        $container['config.writer'] = function D$c) {
            return new ConfigWriter(SW_PATH . '/config.php');
        };

        
public function __construct($file_path, array $configuration = []) {
    $this->zip = new \ZipArchive();
    if ($this->zip->open($file_path$configuration['flags'] ?? 0) !== TRUE) {
      throw new ArchiverException("Cannot open '$file_path'");
    }
  }

  /** * {@inheritdoc} */
  public function add($file_path) {
    $this->zip->addFile($file_path);

    return $this;
  }

  /** * {@inheritdoc} */
  public function remove($file_path) {
    $this->zip->deleteName($file_path);

    return $this;
  }


    // Make a copy of the current theme.     foreach ( $theme_files as $file ) {
        // Skip directories as they are added automatically.         if ( ! $file->isDir() ) {
            // Get real and relative path for current file.             $file_path     = wp_normalize_path( $file );
            $relative_path = substr( $file_pathstrlen( $theme_path ) + 1 );

            if ( ! wp_is_theme_directory_ignored( $relative_path ) ) {
                $zip->addFile( $file_path$relative_path );
            }
        }
    }

    // Load templates into the zip file.     $templates = get_block_templates();
    foreach ( $templates as $template ) {
        $template->content = _remove_theme_attribute_in_block_template_content( $template->content );

        $zip->addFromString(
            'templates/' . $template->slug . '.html',
            

    final public function addUri(string $uri)
    {
        // Figure out a good filename (using URI strips queries and fragments)         $file = $this->getScratch() . basename((new URI($uri))->getPath());

        // Get the content and write it to the scratch space         write_file($fileservice('curlrequest')->get($uri)->getBody());

        return $this->addFile($file);
    }

    // --------------------------------------------------------------------     // Write Methods     // --------------------------------------------------------------------
    /** * Removes the destination and all its files and folders. * * @return $this */
    

        $zipPath = $this->outputPath . $name . '.zip';

        $zip = new ZipArchive();

        if ($zip->open($zipPath, ZipArchive::CREATE) !== true) {
            throw new RuntimeException(sprintf('Could not open %s, please check the permissions.', $zipPath));
        }

        $files = $this->getDirectoryList($this->outputPath);
        foreach ($files as $file) {
            $zip->addFile($filebasename($file));
        }
        $result = $zip->close();

        if ($result) {
            return $zipPath;
        }

        return false;
    }

    /** * Return a list of files with a certain extension * * @param string $path * @param array $findExtension * @param array $blacklistName * * @return array */
$paths = (array) $paths;

        foreach ($paths as $path) {
            if (is_string($path)) {
                throw new InvalidArgumentException('FileCollection paths must be strings.');
            }

            try {
                // Test for a directory                 self::resolveDirectory($path);
            } catch (FileException $e) {
                $this->addFile($path);

                continue;
            }

            $this->addDirectory($path$recursive);
        }

        return $this;
    }

    // --------------------------------------------------------------------
update_post_meta( $request_id, '_export_file_name', $archive_filename );
    }

    $archive_url = $exports_url . $archive_filename;

    if ( ! empty( $archive_pathname ) && file_exists( $archive_pathname ) ) {
        wp_delete_file( $archive_pathname );
    }

    $zip = new ZipArchive();
    if ( true === $zip->open( $archive_pathname, ZipArchive::CREATE ) ) {
        if ( ! $zip->addFile( $json_report_pathname, 'export.json' ) ) {
            $error = __( 'Unable to archive the personal data export file (JSON format).' );
        }

        if ( ! $zip->addFile( $html_report_pathname, 'index.html' ) ) {
            $error = __( 'Unable to archive the personal data export file (HTML format).' );
        }

        $zip->close();

        if ( ! $error ) {
            /** * Fires right after all personal data has been written to the export file. * * @since 4.9.6 * @since 5.4.0 Added the `$json_report_pathname` parameter. * * @param string $archive_pathname The full path to the export file on the filesystem. * @param string $archive_url The URL of the archive file. * @param string $html_report_pathname The full path to the HTML personal data report on the filesystem. * @param int $request_id The export request ID. * @param string $json_report_pathname The full path to the JSON personal data report on the filesystem. */
throw new DriverException('Could not compress file, PHP is compiled without zip support.');
    }

    // Selenium only accepts uploads that are compressed as a Zip archive.     $tempFilename = tempnam('', 'WebDriverZip');

    $archive = new \ZipArchive();
    $result = $archive->open($tempFilename, \ZipArchive::OVERWRITE);
    if (!$result) {
      throw new DriverException('Zip archive could not be created. Error ' . $result);
    }
    $result = $archive->addFile($pathbasename($path));
    if (!$result) {
      throw new DriverException('File could not be added to zip archive.');
    }
    $result = $archive->close();
    if (!$result) {
      throw new DriverException('Zip archive could not be closed.');
    }

    try {
      $remotePath = $this->getWebDriverSession()->file(['file' => base64_encode(file_get_contents($tempFilename))]);

      
foreach ($catalogue->getDomains() as $domain) {
                if (0 === \count($catalogue->all($domain))) {
                    continue;
                }

                $content = $this->xliffFileDumper->formatCatalogue($catalogue$domain['default_locale' => $this->defaultLocale]);

                $fileId = $this->getFileIdByDomain($fileList$domain);

                if ($catalogue->getLocale() === $this->defaultLocale) {
                    if (!$fileId) {
                        $file = $this->addFile($domain$content);
                    } else {
                        $file = $this->updateFile($fileId$domain$content);
                    }

                    if (!$file) {
                        continue;
                    }

                    $fileList[$file['name']] = $file['id'];
                } else {
                    if (!$fileId) {
                        
Home | Imprint | This part of the site doesn't use cookies.