Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
glpi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
GLPI
glpi
Commits
5042df42
Commit
5042df42
authored
Mar 27, 2019
by
Cédric Anne
Committed by
Johan Cwiklinski
Apr 01, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert plugin autoinit from commit
5b9affbc
; fixes #5637
parent
0e7d0f7d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
19 deletions
+19
-19
inc/console/application.class.php
inc/console/application.class.php
+2
-0
inc/includes.php
inc/includes.php
+1
-0
inc/plugin.class.php
inc/plugin.class.php
+16
-19
No files found.
inc/console/application.class.php
View file @
5042df42
...
...
@@ -383,6 +383,8 @@ class Application extends BaseApplication {
}
$plugin
=
new
Plugin
();
$plugin
->
init
();
$plugins_list
=
$plugin
->
getPlugins
();
if
(
count
(
$plugins_list
)
>
0
)
{
foreach
(
$plugins_list
as
$name
)
{
...
...
inc/includes.php
View file @
5042df42
...
...
@@ -96,6 +96,7 @@ if (!isset($PLUGINS_INCLUDED)) {
$PLUGINS_INCLUDED
=
1
;
$LOADED_PLUGINS
=
[];
$plugin
=
new
Plugin
();
$plugin
->
init
();
$plugins_list
=
$plugin
->
getPlugins
();
if
(
count
(
$plugins_list
))
{
...
...
inc/plugin.class.php
View file @
5042df42
...
...
@@ -98,18 +98,23 @@ class Plugin extends CommonDBTM {
function
init
()
{
global
$DB
,
$GLPI_CACHE
;
$GLPI_CACHE
->
set
(
'plugins'
,
[]);
if
(
!
isset
(
$DB
)
||
!
$DB
->
connected
)
{
// Cannot init plugins list if DB is not connected
$GLPI_CACHE
->
set
(
'plugins_init'
,
true
);
$GLPI_CACHE
->
set
(
'plugins'
,
[]);
return
;
}
$this
->
checkStates
();
$plugins
=
$this
->
find
([
'state'
=>
self
::
ACTIVATED
]);
foreach
(
$plugins
as
$ID
=>
$plug
)
{
$this
->
setLoaded
(
$ID
,
$plug
[
'directory'
]);
$GLPI_CACHE
->
set
(
'plugins_init'
,
true
);
$GLPI_CACHE
->
set
(
'plugins'
,
[]);
if
(
count
(
$plugins
))
{
foreach
(
$plugins
as
$ID
=>
$plug
)
{
$this
->
setLoaded
(
$ID
,
$plug
[
'directory'
]);
}
}
}
...
...
@@ -125,8 +130,7 @@ class Plugin extends CommonDBTM {
Toolbox
::
deprecated
();
global
$GLPI_CACHE
;
return
$GLPI_CACHE
->
has
(
'plugins'
);
return
$GLPI_CACHE
->
has
(
'plugins_init'
);
}
...
...
@@ -715,8 +719,9 @@ class Plugin extends CommonDBTM {
**/
function
isActivated
(
$plugin
)
{
$activePlugins
=
$this
->
getPlugins
();
return
in_array
(
$plugin
,
$activePlugins
);
if
(
$this
->
getFromDBbyDir
(
$plugin
))
{
return
(
$this
->
fields
[
'state'
]
==
self
::
ACTIVATED
);
}
}
...
...
@@ -727,11 +732,6 @@ class Plugin extends CommonDBTM {
**/
function
isInstalled
(
$plugin
)
{
if
(
$this
->
isActivated
(
$plugin
))
{
// Prevent call on DB if plugin is activated.
return
true
;
}
if
(
$this
->
getFromDBbyDir
(
$plugin
))
{
return
((
$this
->
fields
[
'state'
]
==
self
::
ACTIVATED
)
||
(
$this
->
fields
[
'state'
]
==
self
::
TOBECONFIGURED
)
...
...
@@ -1707,13 +1707,10 @@ class Plugin extends CommonDBTM {
*/
public
static
function
getPlugins
()
{
global
$GLPI_CACHE
;
if
(
!
$GLPI_CACHE
->
has
(
'plugins'
))
{
$self
=
new
self
();
$self
->
init
();
if
(
$GLPI_CACHE
&&
$GLPI_CACHE
->
has
(
'plugins'
))
{
return
$GLPI_CACHE
->
get
(
'plugins'
);
}
return
$GLPI_CACHE
->
get
(
'plugins'
);
return
[];
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment