Commit 1cee991c authored by Carsten  Rose's avatar Carsten Rose

Refs #9959. Disable QFQ error handler when QFQ calls T3 code.

parent 798421bb
Pipeline #3206 failed with stages
in 1 minute and 53 seconds
......@@ -26,7 +26,14 @@ class T3Handler {
* Call logoff of current FE User
*/
public static function feLogOff() {
// Restore T3 ErrorHandler. T3 throws exceptions - those should be handled by T3!
restore_error_handler();
$GLOBALS['TSFE']->fe_user->logoff();
// Activate QFQ ErrorHandler again.
Support::setQfqErrorHandler();
}
......@@ -39,6 +46,9 @@ class T3Handler {
*/
public static function getHash($newPassword) {
// Restore T3 ErrorHandler. T3 throws exceptions - those should be handled by T3!
restore_error_handler();
$saltedPassword = md5($newPassword); // Use md5 as fallback
self::t3AutoloadIfNotRunning();
if (\TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility::isUsageEnabled('FE')) {
......@@ -47,6 +57,10 @@ class T3Handler {
$saltedPassword = $objSalt->getHashedPassword($newPassword);
}
}
// Activate QFQ ErrorHandler again.
Support::setQfqErrorHandler();
return $saltedPassword;
}
......@@ -60,6 +74,9 @@ class T3Handler {
*/
public static function checkPassword($saltedPassword, $password) {
// Restore T3 ErrorHandler. T3 throws exceptions - those should be handled by T3!
restore_error_handler();
self::t3AutoloadIfNotRunning();
$success = FALSE;
if (\TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility::isUsageEnabled('FE')) {
......@@ -68,6 +85,10 @@ class T3Handler {
$success = $objSalt2->checkPassword($password, $saltedPassword);
}
}
// Activate QFQ ErrorHandler again.
Support::setQfqErrorHandler();
return $success;
}
......@@ -92,28 +113,35 @@ class T3Handler {
}
}
public static function getT3QfqConfig() {
/**
* Update a single key/value pair in `typo3conf/LocalConfiguration.php` QFQ config.
*
* @param $key
* @param $value
*/
public static function updateT3QfqConfig($key, $value) {
// Restore T3 ErrorHandler. T3 throws exceptions - those should be handled by T3!
restore_error_handler();
// if(!isset(self::$objectManager)) {
// self::$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
// }
//
// // https://blog.slavlee.de/67-wissen/quick-tips/85-klassen-in-extbase-instanziieren-ueberall.html
// $configurationUtility = self::$objectManager->get('TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility');
// $extensionConfiguration = $configurationUtility->getCurrentConfiguration('qfq');
self::t3AutoloadIfNotRunning();
$configurationManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager');
// Same as $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['qfq']
$configT3 = $configurationManager->getLocalConfiguration();
$configQfq = unserialize($configT3['EXT']['extConf']['qfq']);
$configAll = $configurationManager->getLocalConfiguration();
$configQfq = unserialize($configAll['EXT']['extConf']['qfq']);
$configQfq['flagProduction'] = 'yes';
$configAll['EXT']['extConf']['qfq'] = serialize($configQfq);
$configurationManager->writeLocalConfiguration($configAll);
// Set new value
$configQfq[$key] = $value;
Support::setQfqErrorHandler();
// Prepare
$configT3['EXT']['extConf']['qfq'] = serialize($configQfq);
// Write new config to typo3conf/LocalConfiguration.php
$configurationManager->writeLocalConfiguration($configT3);
// Activate QFQ ErrorHandler again.
Support::setQfqErrorHandler();
}
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment