public function DeployLogger::setLastDeployTimeForEnvironment in Build Hooks 3.x
Same name and namespace in other branches
- 8.2 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
- Defines a class for logging items to be deployed.
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();
}