N°2249 - Supportability - Updater module (Allow to run setup in case of failure)

This commit is contained in:
Eric
2020-01-16 10:49:49 +01:00
parent 8024aad43d
commit cc3e6d64e1
10 changed files with 51 additions and 10 deletions

View File

@@ -2030,15 +2030,22 @@ JS
/**
* Verify Setup authentication token (from the request parameter 'authent')
*
* @param bool $bRemoveToken
*
* @throws \SecurityException
*/
public final static function CheckSetupToken()
public final static function CheckSetupToken($bRemoveToken = false)
{
$sAuthent = utils::ReadParam('authent', '', false, 'raw_data');
if (!file_exists(APPROOT.'data/setup/authent') || $sAuthent !== file_get_contents(APPROOT.'data/setup/authent'))
$sTokenFile = APPROOT.'data/setup/authent';
if (!file_exists($sTokenFile) || $sAuthent !== file_get_contents($sTokenFile))
{
throw new SecurityException('Setup operations are not allowed outside of the setup');
}
if ($bRemoveToken)
{
@unlink($sTokenFile);
}
}
private final static function Log($sText)