Commit 16b4ab9f authored by Stefan Bublies's avatar Stefan Bublies
Browse files

Anpassungen am Query Builder

parent e522164b
......@@ -29,6 +29,8 @@ namespace DTInternet\DtiHiorg\Controller;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Utility\DebugUtility;
/**
* HiOrgServerLoginController
......@@ -78,28 +80,29 @@ class HiOrgServerLoginController extends \TYPO3\CMS\Extbase\Mvc\Controller\Actio
$sUsername = 'hiorg_'.$sKuerzel.'_'.$aHiorgUser['username'];
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('fe_users');
$rVorhanden = $queryBuilder
->select('uid')
->from('fe_users')
->where(
$queryBuilder->expr()->eq('username', $queryBuilder->createNamedParameter($sUsername)),
$queryBuilder->expr()->eq('deleted', $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)),
$queryBuilder->expr()->eq('disable', $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT))
);
if ($rVorhanden->num_rows==0) {
$connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
$databaseConnectionForPages = $connectionPool->getConnectionForTable('fe_users');
$databaseConnectionForPages->insert(
'fe_users',
[
->select('uid')
->from('fe_users')
->where(
$queryBuilder->expr()->eq('username', $queryBuilder->createNamedParameter($sUsername)),
$queryBuilder->expr()->eq('deleted', 0),
$queryBuilder->expr()->eq('disable', 0)
)
->execute();
$row = $rVorhanden->fetch();
if ($row==0) {
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('fe_users');
$affectedRows = $queryBuilder
->insert('fe_users')
->values([
'username' => $sUsername,
'usergroup' => $iFEGroup,
'pid' => $iUserStorage,
'crdate' => time(),
]
);
])
->execute();
}
$sPasswort = rand(0,1000000).time();
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('fe_users');
......
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