Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
Imldeployment
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
Imldeployment
Commits
14e6a99c
Commit
14e6a99c
authored
9 months ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
config-replacements: fix parser problems
parent
fc97cf97
No related branches found
No related tags found
1 merge request
!66
php8 only; added variable types; short array syntax; remove glyphicons
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
public_html/deployment/classes/config-replacement.class.php
+18
-15
18 additions, 15 deletions
public_html/deployment/classes/config-replacement.class.php
with
18 additions
and
15 deletions
public_html/deployment/classes/config-replacement.class.php
+
18
−
15
View file @
14e6a99c
...
@@ -10,12 +10,14 @@ require_once 'project.class.php';
...
@@ -10,12 +10,14 @@ require_once 'project.class.php';
* reads templatefiles and scans its placeholders for replacements
* reads templatefiles and scans its placeholders for replacements
*
*
* @author hahn
* @author hahn
*
* 2024-08-23 v1.1 Axel Hahn fix php parser problems
*/
*/
class
configreplacement
{
class
configreplacement
{
/**
/**
* project class
* project class
* @var
type
* @var
object
*/
*/
protected
$_oProject
=
false
;
protected
$_oProject
=
false
;
protected
$_sPhase
=
false
;
protected
$_sPhase
=
false
;
...
@@ -23,15 +25,13 @@ class configreplacement {
...
@@ -23,15 +25,13 @@ class configreplacement {
/**
/**
*
init
*
Constructor
* @param string $sProject optional: project id; you can use setProject() too
* @param string $sProject optional: project id; you can use setProject() too
* @return boolean
*/
*/
public
function
__construct
(
$sProject
=
false
)
{
public
function
__construct
(
$sProject
=
''
)
{
if
(
$sProject
){
if
(
$sProject
){
$this
->
setProject
(
$sProject
);
$this
->
setProject
(
$sProject
);
}
}
return
true
;
}
}
...
@@ -61,13 +61,13 @@ class configreplacement {
...
@@ -61,13 +61,13 @@ class configreplacement {
/**
/**
* get an array with all template files (basename) and its replacement fields
* get an array with all template files (basename) and its replacement fields
* @return array
* @return
bool|
array
*/
*/
public
function
getReplacements
(){
public
function
getReplacements
(){
if
(
!
$this
->
_sPhase
){
if
(
!
$this
->
_sPhase
){
return
false
;
return
false
;
}
}
$aFiles
=
$this
->
getTemplatefiles
(
$this
->
_sPhase
);
$aFiles
=
$this
->
getTemplatefiles
();
if
(
!
$aFiles
){
if
(
!
$aFiles
){
return
false
;
return
false
;
}
}
...
@@ -96,8 +96,8 @@ class configreplacement {
...
@@ -96,8 +96,8 @@ class configreplacement {
/**
/**
* get replacement definitions from foreman
* get replacement definitions from foreman
* @global
type
$aConfig
* @global
array
$aConfig
* @return bool
ean
* @return bool
|array
*/
*/
protected
function
_getForemanReplacement
(){
protected
function
_getForemanReplacement
(){
global
$aConfig
;
global
$aConfig
;
...
@@ -259,9 +259,10 @@ class configreplacement {
...
@@ -259,9 +259,10 @@ class configreplacement {
}
}
/**
/**
* get html code for links to edit each host of the current phase in foreman
* Get html code for links to edit each host of the current phase in foreman
* It returns false if foreman is not activated or there is no phase.
*
*
* @return bool
ean
* @return bool
|string
*/
*/
public
function
getForemanlink2Host
(){
public
function
getForemanlink2Host
(){
$sForemanurl
=
$this
->
_getForemanBaseUrl
();
$sForemanurl
=
$this
->
_getForemanBaseUrl
();
...
@@ -288,9 +289,10 @@ class configreplacement {
...
@@ -288,9 +289,10 @@ class configreplacement {
}
}
/**
/**
* get html code for a link to edit hostgroup in foreman
* Get html code for a link to edit hostgroup in foreman
* It returns false if foreman is not activated or there is no hostgroup in the project phase
*
*
* @return bool
ean
* @return bool
|string
*/
*/
public
function
getForemanlink2Hostgroup
(){
public
function
getForemanlink2Hostgroup
(){
$iEffectiveHostgroup
=
$this
->
getForemanHostgroup
();
$iEffectiveHostgroup
=
$this
->
getForemanHostgroup
();
...
@@ -315,7 +317,7 @@ class configreplacement {
...
@@ -315,7 +317,7 @@ class configreplacement {
/**
/**
* get replacements in foreman
* get replacements in foreman
* @return
type
* @return
bool|array
*/
*/
public
function
getForemanReplacements
(){
public
function
getForemanReplacements
(){
return
$this
->
_getForemanReplacement
();
return
$this
->
_getForemanReplacement
();
...
@@ -323,7 +325,8 @@ class configreplacement {
...
@@ -323,7 +325,8 @@ class configreplacement {
/**
/**
* switch to a project
* switch to a project
* @param type $sProject
* @param string $sProject project id
* @param string $sPhase optional: a phase; one of preview|stage|live
*/
*/
public
function
setProject
(
$sProject
,
$sPhase
=
false
){
public
function
setProject
(
$sProject
,
$sPhase
=
false
){
$this
->
_oProject
=
new
project
(
$sProject
);
$this
->
_oProject
=
new
project
(
$sProject
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment