public function CertManager::backupCert in Lockr 4.x
Backs up the current cert into the private directory.
Return value
bool Returns FALSE if the backup failed.
File
- src/
CertManager.php, line 82
Class
- CertManager
- Helper class for managing Lockr certificates.
Namespace
Drupal\lockrCode
public function backupCert() {
$cert_path = $this
->certPath();
$cert_dir = dirname($cert_path);
$backup_name = basename($cert_dir) . '_backup_' . (new DateTime())
->format('YmdHis');
$backup_dir = $this
->certDir($backup_name);
if (!@mkdir($backup_dir, 0750, TRUE)) {
return FALSE;
}
return $this
->copyPEM($cert_dir, $backup_dir);
}