mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-09-23 09:57:58 +02:00
parent
9adb516515
commit
2aed948896
@ -205,9 +205,9 @@ class ConfigController extends Controller
|
|||||||
$this->createApplicationTabs()->activate('tls');
|
$this->createApplicationTabs()->activate('tls');
|
||||||
|
|
||||||
$rootCaCollections = array();
|
$rootCaCollections = array();
|
||||||
foreach (new LocalFileStorage(Icinga::app()->getStorageDir('framework/tls/rootcacollections')) as $ca) {
|
foreach (LocalFileStorage::common('tls/rootcacollections') as $rootCaCollection) {
|
||||||
$matches = array();
|
$matches = array();
|
||||||
if (preg_match('~\A([0-9a-f]{2}+)\.pem\z~i', $ca, $matches)) {
|
if (preg_match('~\A([0-9a-f]{2}+)\.pem\z~i', $rootCaCollection, $matches)) {
|
||||||
$rootCaCollections[hex2bin($matches[1])] = null;
|
$rootCaCollections[hex2bin($matches[1])] = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -216,9 +216,9 @@ class ConfigController extends Controller
|
|||||||
$this->view->rootCaCollections = array_keys($rootCaCollections);
|
$this->view->rootCaCollections = array_keys($rootCaCollections);
|
||||||
|
|
||||||
$clientIdentities = array();
|
$clientIdentities = array();
|
||||||
foreach (new LocalFileStorage(Icinga::app()->getStorageDir('framework/tls/clientidentities')) as $client) {
|
foreach (LocalFileStorage::common('tls/clientidentities') as $clientIdentity) {
|
||||||
$matches = array();
|
$matches = array();
|
||||||
if (preg_match('~\A([0-9a-f]{2}+)\.pem\z~i', $client, $matches)) {
|
if (preg_match('~\A([0-9a-f]{2}+)\.pem\z~i', $clientIdentity, $matches)) {
|
||||||
$clientIdentities[hex2bin($matches[1])] = null;
|
$clientIdentities[hex2bin($matches[1])] = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
namespace Icinga\File\Storage;
|
namespace Icinga\File\Storage;
|
||||||
|
|
||||||
use ErrorException;
|
use ErrorException;
|
||||||
|
use Icinga\Application\Icinga;
|
||||||
use Icinga\Exception\AlreadyExistsException;
|
use Icinga\Exception\AlreadyExistsException;
|
||||||
use Icinga\Exception\NotFoundError;
|
use Icinga\Exception\NotFoundError;
|
||||||
use Icinga\Exception\NotReadableError;
|
use Icinga\Exception\NotReadableError;
|
||||||
@ -25,6 +26,21 @@ class LocalFileStorage implements StorageInterface
|
|||||||
*/
|
*/
|
||||||
protected $baseDir;
|
protected $baseDir;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Factory for the common storage directory with optional subdirectory
|
||||||
|
*
|
||||||
|
* @param string $subDir
|
||||||
|
*
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public static function common($subDir = null)
|
||||||
|
{
|
||||||
|
$baseDir = Icinga::app()->getStorageDir($subDir);
|
||||||
|
static::ensureDir($baseDir);
|
||||||
|
|
||||||
|
return new static($baseDir);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -135,10 +151,10 @@ class LocalFileStorage implements StorageInterface
|
|||||||
*
|
*
|
||||||
* @throws NotWritableError
|
* @throws NotWritableError
|
||||||
*/
|
*/
|
||||||
protected function ensureDir($dir)
|
protected static function ensureDir($dir)
|
||||||
{
|
{
|
||||||
if (! is_dir($dir)) {
|
if (! is_dir($dir)) {
|
||||||
$this->ensureDir(dirname($dir));
|
static::ensureDir(dirname($dir));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mkdir($dir, 02770);
|
mkdir($dir, 02770);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user