public function DeployLogger::setLastDeployTimeForEnvironment in Build Hooks 8.2
Same name and namespace in other branches
- 3.x src/DeployLogger.php \Drupal\build_hooks\DeployLogger::setLastDeployTimeForEnvironment()
Get the last deployed time for an environment.
Parameters
\Drupal\build_hooks\Entity\FrontendEnvironmentInterface $environment: The frontend environment config entity.
int|null $timestamp: Timestamp.
File
- src/
DeployLogger.php, line 135
Class
- DeployLogger
- Class DeployLogger.
Namespace
Drupal\build_hooksCode
public function setLastDeployTimeForEnvironment(FrontendEnvironmentInterface $environment, int $timestamp = NULL) {
/** @var \Drupal\build_hooks\DeploymentStorageHandlerInterface $deployment_storage */
$deployment_storage = $this->entityTypeManager
->getStorage('build_hooks_deployment');
$deployment = $deployment_storage
->getOrCreateNextDeploymentForEnvironment($environment);
$deployment->deployed = $timestamp ?: $this->time
->getCurrentTime();
$deployment->status = 1;
$deployment
->save();
}