I want to save deployment version in DB from where I can get the currently deployed version?
2 Answers
I found a way to get the current deployed version. Thanks @Black
<?php
namespace MyModule\MyVendor\Model;
use Magento\Framework\App\View\Deployment\Version\StorageInterface;
class DeploymentVersion
{
/**
* @var StorageInterface
*/
protected $storage;
/**
* @var int|boolean|null
*/
protected $deployedVersion;
/**
* constructor
* @param StorageInterface $storage
*/
public function __construct(
StorageInterface $storage
) {
$this->storage = $storage;
}
public function getDeploymentId()
{
if (!isset($this->deployedVersion)) {
$this->deployedVersion = $this->storage->load();
}
return $this->deployedVersion;
}
}
It is stored in pub/static/deployed_version.txt
-
-
1
-