mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-19 19:15:22 +00:00
OpenVPN export, move base filename into own method for easier reuse. https://github.com/opnsense/core/issues/2787
This commit is contained in:
parent
0a0e5ee747
commit
ceb54b9657
@ -66,7 +66,7 @@ class ArchiveOpenVPN extends PlainOpenVPN
|
||||
public function getContent()
|
||||
{
|
||||
$conf = $this->openvpnConfParts();
|
||||
$base_filename = "profile";
|
||||
$base_filename = $this->getBaseFilename();
|
||||
$tempdir = tempnam(sys_get_temp_dir(), '_ovpn') ;
|
||||
$content_dir = $tempdir . "/" . $base_filename;
|
||||
if (file_exists($tempdir)) {
|
||||
|
||||
@ -52,9 +52,9 @@ class PlainOpenVPN extends BaseExporter implements IExportProvider
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string filename
|
||||
* @return string base filename without extension
|
||||
*/
|
||||
public function getFilename()
|
||||
protected function getBaseFilename()
|
||||
{
|
||||
$result = array();
|
||||
if (!empty($this->config['description'])) {
|
||||
@ -65,7 +65,15 @@ class PlainOpenVPN extends BaseExporter implements IExportProvider
|
||||
if (!empty($this->config['client_cn'])) {
|
||||
$result[] = $this->config['client_cn'];
|
||||
}
|
||||
return implode("_", $result) . ".". $this->fileExtension;
|
||||
return implode("_", $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string filename
|
||||
*/
|
||||
public function getFilename()
|
||||
{
|
||||
return $this->getBaseFilename() . ".". $this->fileExtension;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user