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
5e0c0e88
Commit
5e0c0e88
authored
Jan 07, 2021
by
Cédric Anne
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '9.5/bugfixes'
parents
8970eacf
c3b757df
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
56 additions
and
9 deletions
+56
-9
inc/auth.class.php
inc/auth.class.php
+3
-2
inc/console/abstractcommand.class.php
inc/console/abstractcommand.class.php
+13
-1
inc/console/application.class.php
inc/console/application.class.php
+17
-0
inc/console/command/glpicommandinterface.class.php
inc/console/command/glpicommandinterface.class.php
+8
-1
inc/console/database/abstractconfigurecommand.class.php
inc/console/database/abstractconfigurecommand.class.php
+2
-0
inc/console/database/updatecommand.class.php
inc/console/database/updatecommand.class.php
+2
-0
inc/console/maintenance/disablemaintenancemodecommand.class.php
...nsole/maintenance/disablemaintenancemodecommand.class.php
+2
-0
inc/console/maintenance/enablemaintenancemodecommand.class.php
...onsole/maintenance/enablemaintenancemodecommand.class.php
+2
-0
inc/console/system/clearcachecommand.class.php
inc/console/system/clearcachecommand.class.php
+2
-0
inc/mailcollector.class.php
inc/mailcollector.class.php
+5
-5
No files found.
inc/auth.class.php
View file @
5e0c0e88
...
...
@@ -855,8 +855,9 @@ class Auth extends CommonGLPI {
if
(
!
empty
(
$login_auth
))
{
$search_params
[
'auths_id'
]
=
$this
->
user
->
fields
[
"auths_id"
];
}
$this
->
user
->
getFromDBByCrit
(
$search_params
);
$user_deleted_ldap
=
true
;
if
(
$this
->
user
->
getFromDBByCrit
(
$search_params
))
{
$user_deleted_ldap
=
true
;
};
}
}
}
...
...
inc/console/abstractcommand.class.php
View file @
5e0c0e88
...
...
@@ -63,12 +63,19 @@ abstract class AbstractCommand extends Command implements GlpiCommandInterface {
protected
$output
;
/**
* Flag to indicate if command requires a
BD
connection.
* Flag to indicate if command requires a
DB
connection.
*
* @var boolean
*/
protected
$requires_db
=
true
;
/**
* Flag to indicate if command requires an up-to-date DB.
*
* @var boolean
*/
protected
$requires_db_up_to_date
=
true
;
protected
function
initialize
(
InputInterface
$input
,
OutputInterface
$output
)
{
$this
->
input
=
$input
;
...
...
@@ -198,4 +205,9 @@ abstract class AbstractCommand extends Command implements GlpiCommandInterface {
return
true
;
}
public
function
requiresUpToDateDb
():
bool
{
return
$this
->
requires_db
&&
$this
->
requires_db_up_to_date
;
}
}
inc/console/application.class.php
View file @
5e0c0e88
...
...
@@ -66,6 +66,13 @@ class Application extends BaseApplication {
*/
const
ERROR_MISSING_REQUIREMENTS
=
128
;
// start application codes at 128 be sure to be different from commands codes
/**
* Error code returned when DB is not up-to-date.
*
* @var integer
*/
const
ERROR_DB_OUTDATED
=
129
;
/**
* Pointer to $CFG_GLPI.
* @var array
...
...
@@ -222,6 +229,16 @@ class Application extends BaseApplication {
$begin_time
=
microtime
(
true
);
if
(
$command
instanceof
GlpiCommandInterface
&&
$command
->
requiresUpToDateDb
()
&&
(
!
array_key_exists
(
'dbversion'
,
$this
->
config
)
||
(
trim
(
$this
->
config
[
'dbversion'
])
!=
GLPI_SCHEMA_VERSION
)))
{
$output
->
writeln
(
'<error>'
.
__
(
'The version of the database is not compatible with the version of the installed files. An update is necessary.'
)
.
'</error>'
);
return
self
::
ERROR_DB_OUTDATED
;
}
if
(
$command
instanceof
GlpiCommandInterface
&&
$command
->
mustCheckMandatoryRequirements
()
&&
!
$this
->
checkCoreMandatoryRequirements
())
{
return
self
::
ERROR_MISSING_REQUIREMENTS
;
...
...
inc/console/command/glpicommandinterface.class.php
View file @
5e0c0e88
...
...
@@ -39,9 +39,16 @@ if (!defined('GLPI_ROOT')) {
interface
GlpiCommandInterface
{
/**
* Defines whether or mandatory requirements must be checked before running command.
* Defines whether or
not
mandatory requirements must be checked before running command.
*
* @return boolean
*/
public
function
mustCheckMandatoryRequirements
():
bool
;
/**
* Defines whether or not command requires an up-to-date database to be executed.
*
* @return boolean
*/
public
function
requiresUpToDateDb
():
bool
;
}
inc/console/database/abstractconfigurecommand.class.php
View file @
5e0c0e88
...
...
@@ -92,6 +92,8 @@ abstract class AbstractConfigureCommand extends AbstractCommand implements Force
*/
const
ERROR_DB_CONFIG_FILE_NOT_SAVED
=
4
;
protected
$requires_db_up_to_date
=
false
;
protected
function
configure
()
{
parent
::
configure
();
...
...
inc/console/database/updatecommand.class.php
View file @
5e0c0e88
...
...
@@ -63,6 +63,8 @@ class UpdateCommand extends AbstractCommand implements ForceNoPluginsOptionComma
*/
const
ERROR_MISSING_SECURITY_KEY_FILE
=
2
;
protected
$requires_db_up_to_date
=
false
;
protected
function
configure
()
{
parent
::
configure
();
...
...
inc/console/maintenance/disablemaintenancemodecommand.class.php
View file @
5e0c0e88
...
...
@@ -43,6 +43,8 @@ use Symfony\Component\Console\Output\OutputInterface;
class
DisableMaintenanceModeCommand
extends
AbstractCommand
{
protected
$requires_db_up_to_date
=
false
;
protected
function
configure
()
{
parent
::
configure
();
...
...
inc/console/maintenance/enablemaintenancemodecommand.class.php
View file @
5e0c0e88
...
...
@@ -44,6 +44,8 @@ use Symfony\Component\Console\Output\OutputInterface;
class
EnableMaintenanceModeCommand
extends
AbstractCommand
{
protected
$requires_db_up_to_date
=
false
;
protected
function
configure
()
{
parent
::
configure
();
...
...
inc/console/system/clearcachecommand.class.php
View file @
5e0c0e88
...
...
@@ -42,6 +42,8 @@ use Symfony\Component\Console\Output\OutputInterface;
class
ClearCacheCommand
extends
Command
{
protected
$requires_db_up_to_date
=
false
;
protected
function
configure
()
{
parent
::
configure
();
...
...
inc/mailcollector.class.php
View file @
5e0c0e88
...
...
@@ -2061,18 +2061,18 @@ class MailCollector extends CommonDBTM {
if
(
!
$part
->
getHeaders
()
->
has
(
'content-type'
)
||
!
((
$content_type
=
$part
->
getHeader
(
'content-type'
))
instanceof
ContentType
)
|
preg_match
(
'/^text\//'
,
$content_type
->
getType
())
!==
1
)
{
|
|
preg_match
(
'/^text\//'
,
$content_type
->
getType
())
!==
1
)
{
return
$contents
;
// No charset conversion content type header is not set or content is not text/*
}
$charset
=
$content_type
->
getParameter
(
'charset'
);
if
(
strtoupper
(
$charset
)
!=
'UTF-8'
)
{
if
(
in_array
(
$charset
,
array_map
(
'strtoupper'
,
mb_list_encodings
())))
{
if
(
$charset
!==
null
&&
strtoupper
(
$charset
)
!=
'UTF-8'
)
{
if
(
in_array
(
strtoupper
(
$charset
)
,
array_map
(
'strtoupper'
,
mb_list_encodings
())))
{
$contents
=
mb_convert_encoding
(
$contents
,
'UTF-8'
,
$charset
);
}
else
{
// Convert Windows charsets names
if
(
preg_match
(
'/^WINDOWS-\d{4}$/'
,
$charset
))
{
$charset
=
preg_replace
(
'/^WINDOWS-(\d{4})$/'
,
'CP$1'
,
$charset
);
if
(
preg_match
(
'/^WINDOWS-\d{4}$/
i
'
,
$charset
))
{
$charset
=
preg_replace
(
'/^WINDOWS-(\d{4})$/
i
'
,
'CP$1'
,
$charset
);
}
if
(
$converted
=
iconv
(
$charset
,
'UTF-8//TRANSLIT'
,
$contents
))
{
...
...
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