Skip to content

Commit

Permalink
Merge pull request #1942 from ThemeFuse/issue#23906
Browse files Browse the repository at this point in the history
Fix: bagrinsergiu/blox-editor#23906 - changing the way of versioning …
  • Loading branch information
alecszaharia authored Oct 9, 2023
2 parents 908716d + b0d4b57 commit 056206b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion editor/zip/archiver-interface.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public function createZip( $posts, $fileName );

public function createFromZip( $zipPath );

public function getEditorVersion();
public function getSyncVersion();

public function isVersionSupported($version);

Expand Down
18 changes: 9 additions & 9 deletions editor/zip/archiver.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ class Brizy_Editor_Zip_Archiver implements Brizy_Editor_Zip_ArchiverInterface
/**
* @var string
*/
protected $editorVersion;
protected $syncVersion;

public function __construct(
Brizy_Editor_Project $project,
Brizy_Admin_Fonts_Manager $fontManager,
$editorVersion
$syncVersion
)
{
$this->project = $project;
$this->fontManager = $fontManager;
$this->editorVersion = $editorVersion;
$this->syncVersion = $syncVersion;

if (!class_exists('ZipArchive')) {
throw new InvalidArgumentException(__('Please install/enable php zip extension. Contact your hosting company for more info and help.'));
Expand Down Expand Up @@ -87,7 +87,7 @@ public function addEntityToZip(ZipArchive $z, Brizy_Editor_Zip_ArchiveItem $item
'meta' => $block->getMeta(),
'media' => $block->getMedia(),
'data' => $block->get_editor_data(),
'editorVersion' => $block->get_editor_version(),
'editorVersion' => $this->syncVersion,
'files' => [
'images' => [],
'uploads' => [],
Expand Down Expand Up @@ -221,15 +221,15 @@ private function createSingleFromZipPath(ZipArchive $z, $dir)
return $block;
}

public function getEditorVersion()
{
return $this->editorVersion;
public function getSyncVersion() {
return $this->syncVersion;
}

public function isVersionSupported($version)
{
$version = preg_replace("/-wp/i", "", $version);
return version_compare($this->getEditorVersion(), $version, '>=');
$version = preg_replace("/-wp/i", "", $version);
$version = preg_replace("/-cloud/i", "", $version);
return version_compare($this->getSyncVersion(), $version, '>=');
}

protected function prepareArchiveFilepath($fileName)
Expand Down

0 comments on commit 056206b

Please sign in to comment.