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
7d36f41f
Commit
7d36f41f
authored
2 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
enable shell plugins
parent
4011ff8d
No related branches found
No related tags found
1 merge request
!43
Shell plugins: Process viewer and load
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
config/config_defaults.php
+10
-0
10 additions, 0 deletions
config/config_defaults.php
public_html/deployment/classes/plugins.class.php
+55
-2
55 additions, 2 deletions
public_html/deployment/classes/plugins.class.php
public_html/deployment/index.php
+10
-6
10 additions, 6 deletions
public_html/deployment/index.php
with
75 additions
and
8 deletions
config/config_defaults.php
+
10
−
0
View file @
7d36f41f
...
...
@@ -130,6 +130,16 @@ return [
],
*/
],
// new WIP plugin class: a plugin must have key "enabled"
'shellcmd'
=>
[
'load'
=>
[
'enabled'
=>
1
,
],
'processes'
=>
[
'enabled'
=>
1
,
],
],
],
// ----------------------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
public_html/deployment/classes/plugins.class.php
+
55
−
2
View file @
7d36f41f
...
...
@@ -68,6 +68,12 @@ class ciplugins {
*/
protected
$_aConfig
=
[];
/**
* global plugins config
* see config/config_custom.php - key plugins
* @var array
*/
protected
$_aGlobals
=
[];
// ---------------------------------------------------------------
// CONSTRUCTOR
...
...
@@ -75,15 +81,29 @@ class ciplugins {
/**
* initialize plugins
*
* @param array $aGlobals global settings for plugins
* @return boolean
*/
public
function
__construct
()
{
public
function
__construct
(
$aGlobals
=
[]
)
{
$this
->
_sPlugindir
=
dirname
(
__DIR__
)
.
'/plugins'
;
$this
->
setGlobalCustoms
(
$aGlobals
);
return
true
;
}
/**
* global configs
* see config/config_custom.php - key plugins
*
* @param array $aGlobals global settings for plugins
* @return boolean
*/
public
function
setGlobalCustoms
(
$aGlobals
){
$this
->
_aGlobals
=
$aGlobals
;
return
true
;
}
// ---------------------------------------------------------------
// FOR LISTING :: GETTER
// ---------------------------------------------------------------
...
...
@@ -102,6 +122,8 @@ class ciplugins {
/**
* get an array of available plugins read from filesystem
*
* @param string $sType set a new type of plugin; default: use current type
* @return array
*/
public
function
getPlugins
(
$sType
=
false
){
...
...
@@ -117,9 +139,40 @@ class ciplugins {
return
$aReturn
;
}
/**
* get an array of enabled plugins
* config/config_custom.php - key "plugins" -> [type] -> [plugin] -> enabled
* and it must be physically available
*
* @param string $sType set a new type of plugin; default: use current type
* @return array
*/
public
function
getEnabledPlugins
(
$sType
=
false
){
$aReturn
=
[];
if
(
$sType
){
if
(
!
$this
->
setType
(
$sType
)){
return
$aReturn
;
}
}
if
(
isset
(
$this
->
_aGlobals
[
$this
->
_sType
])
&&
is_array
(
$this
->
_aGlobals
[
$this
->
_sType
])
){
foreach
(
$this
->
_aGlobals
[
$this
->
_sType
]
as
$sPluginName
=>
$aData
){
if
(
isset
(
$aData
[
'enabled'
])
&&
$aData
[
'enabled'
]
&&
is_dir
(
$this
->
_sPlugindir
.
'/'
.
$this
->
_sType
.
'/'
.
$sPluginName
)
){
$aReturn
[]
=
$sPluginName
;
}
}
}
return
$aReturn
;
}
// ---------------------------------------------------------------
//
// BELOW ARE METHODS FOR A
SET
SPECIFIC PLUGIN AND TYPE
// BELOW ARE METHODS FOR A SPECIFIC
LY SET
PLUGIN AND TYPE
//
// ---------------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
public_html/deployment/index.php
+
10
−
6
View file @
7d36f41f
...
...
@@ -79,14 +79,18 @@ $sHeader.="</style>\n";
$sShellOuptut
=
''
;
$sTopRight
=
''
;
$CI_plugins
=
new
plugin_renderer
();
$CI_plugins
=
new
plugin_renderer
(
isset
(
$aConfig
[
'plugins'
])
?
$aConfig
[
'plugins'
]
:
[]
);
$CI_plugins
->
setType
(
'shellcmd'
);
$aPluginsShellcmd
=
$CI_plugins
->
getPlugins
();
$sHeader
=
"
\n
<!-- shellcmd plugins :: js files -->
\n
"
;
$sHeader
.
=
'<script src="/deployment/js/ubd.class.js"></script>'
.
"
\n
"
.
'<script src="/deployment/js/addi.js"></script>'
.
"
\n
"
$aEnabledShellPlugins
=
$CI_plugins
->
getEnabledPlugins
(
'shellcmd'
);
$sHeader
.
=
count
(
$aEnabledShellPlugins
)
?
''
.
"
\n
<!-- shellcmd plugins :: js files -->
\n
"
.
'<script src="/deployment/js/ubd.class.js"></script>'
.
"
\n
"
.
'<script src="/deployment/js/addi.js"></script>'
.
"
\n
"
:
''
;
foreach
(
$
CI_plugins
->
getPlugins
(
'shellcmd'
)
as
$sPlugin
){
foreach
(
$
aEnabledShellPlugins
as
$sPlugin
){
if
(
$CI_plugins
->
testPlugin
(
$sPlugin
)){
$aPluginConfig
=
$CI_plugins
->
getPluginConfig
();
$sHeader
.
=
$CI_plugins
->
getHtmlLoadScript
(
'render.js'
);
...
...
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