Skip to content
Snippets Groups Projects
Commit 6a1b73f8 authored by Brian Tofte-Schumacher's avatar Brian Tofte-Schumacher Committed by Oleksandr Kuzava
Browse files

Issue #3324392 by briantschu: PHP 8.1.x. compaitibility

parent 414ee4b3
No related branches found
No related tags found
No related merge requests found
......@@ -81,7 +81,7 @@ class ContentFileGenerator implements ContentFileGeneratorInterface {
$zip_file = $this->generateEmptyZipFile($zip_name);
$zip_file_path = $this->fileSystem->realpath($zip_file->getFileUri());
$zip = $this->contentSyncHelper->createZipInstance($zip_file_path);
$zip = $this->contentSyncHelper->createZipInstance($zip_file_path, \ZipArchive::OVERWRITE);
// Add exported content to the zip file.
$content_file_path = $this->fileSystem->realpath($export_file->getFileUri());
......@@ -102,7 +102,7 @@ class ContentFileGenerator implements ContentFileGeneratorInterface {
$zip_file = $this->generateEmptyZipFile($zip_name);
$zip_file_path = $this->fileSystem->realpath($zip_file->getFileUri());
$zip = $this->contentSyncHelper->createZipInstance($zip_file_path);
$zip = $this->contentSyncHelper->createZipInstance($zip_file_path, \ZipArchive::OVERWRITE);
// Clean up storage with assets before we start exporting a content.
$this->privateTempStore->delete('export.assets');
......
......@@ -138,9 +138,10 @@ class ContentSyncHelper implements ContentSyncHelperInterface {
/**
* {@inheritdoc}
*/
public function createZipInstance(string $file_real_path): ArchiverInterface {
public function createZipInstance(string $file_real_path, int $flags = 0): ArchiverInterface {
return $this->archiverManager->getInstance([
'filepath' => $file_real_path,
'flags' => $flags,
]);
}
......
......@@ -51,11 +51,14 @@ interface ContentSyncHelperInterface {
*
* @param string $file_real_path
* The real path to the local file.
* @param int $flags
* The mode to open the archive with \ZipArchive::open().
* Depends on https://www.drupal.org/project/drupal/issues/2850794.
*
* @return \Drupal\Core\Archiver\ArchiverInterface
* The zip object.
*/
public function createZipInstance(string $file_real_path): ArchiverInterface;
public function createZipInstance(string $file_real_path, int $flags = 0): ArchiverInterface;
/**
* Generates a file name based on an entity.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment