You are here

public function CertManager::copyPEM in Lockr 4.x

Copies all .pem files from one directory to another.

Parameters

string $src: The source directory.

string $dst: The destination directory.

Return value

bool Returns FALSE if the copy failed.

1 call to CertManager::copyPEM()
CertManager::backupCert in src/CertManager.php
Backs up the current cert into the private directory.

File

src/CertManager.php, line 104

Class

CertManager
Helper class for managing Lockr certificates.

Namespace

Drupal\lockr

Code

public function copyPEM($src, $dst) {
  $paths = glob("{$src}/*.pem", GLOB_MARK | GLOB_NOSORT);
  if ($paths === FALSE) {
    return FALSE;
  }
  foreach ($paths as $src_path) {
    if (substr($src_path, -1) === '/') {
      continue;
    }
    $dst_path = $dst . '/' . basename($src_path);
    if (!copy($src_path, $dst_path)) {
      return FALSE;
    }
  }
  return TRUE;
}