Skip to content

Commit

Permalink
Activate debug mode only when update is actually done
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-anne authored and trasher committed Nov 3, 2022
1 parent 15d23e2 commit b811b98
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 4 additions & 0 deletions install/update.php
Expand Up @@ -122,6 +122,10 @@ function doUpdateDb()
{
global $migration, $update;

// Init debug variable
// Only show errors
Toolbox::setDebugMode(Session::DEBUG_MODE, 0, 0, 1);

$currents = $update->getCurrents();
$current_version = $currents['version'];
$current_db_version = $currents['dbversion'];
Expand Down
4 changes: 0 additions & 4 deletions src/Update.php
Expand Up @@ -84,10 +84,6 @@ public function initSession()
$_SESSION = ['glpilanguage' => (isset($this->args['lang']) ? $this->args['lang'] : 'en_GB')];
$_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s");
}

// Init debug variable
// Only show errors
Toolbox::setDebugMode(Session::DEBUG_MODE, 0, 0, 1);
}

/**
Expand Down
4 changes: 1 addition & 3 deletions tests/functionnal/Update.php
Expand Up @@ -66,14 +66,12 @@ public function testInitSession()
$this->array($_SESSION)->hasKeys([
'glpilanguage',
'glpi_currenttime',
'glpi_use_mode'
])->notHasKeys([
'glpi_use_mode',
'debug_sql',
'debug_vars',
'use_log_in_files'
]);
$this->variable($_SESSION['glpi_use_mode'])->isIdenticalTo(\Session::DEBUG_MODE);
$this->variable(error_reporting())->isIdenticalTo(E_ALL | E_STRICT);
}

public function testSetMigration()
Expand Down

0 comments on commit b811b98

Please sign in to comment.