remove unnecessary startTransaction and commit calls
This commit is contained in:
parent
540155b7eb
commit
bb29bf1fb8
@ -346,8 +346,6 @@ class LoginController
|
|||||||
$user->setPlainPassword($this->request->post('password'));
|
$user->setPlainPassword($this->request->post('password'));
|
||||||
$user->setCreatedDate(new DateTime());
|
$user->setCreatedDate(new DateTime());
|
||||||
|
|
||||||
\Container::$dbConnection->startTransaction();
|
|
||||||
|
|
||||||
$this->pdm->saveToDb($user);
|
$this->pdm->saveToDb($user);
|
||||||
|
|
||||||
$token = bin2hex(random_bytes(16));
|
$token = bin2hex(random_bytes(16));
|
||||||
@ -359,8 +357,6 @@ class LoginController
|
|||||||
|
|
||||||
$this->pdm->saveToDb($confirmation);
|
$this->pdm->saveToDb($confirmation);
|
||||||
|
|
||||||
\Container::$dbConnection->commit();
|
|
||||||
|
|
||||||
$this->sendConfirmationEmail($user->getEmail(), $token, $user->getCreatedDate());
|
$this->sendConfirmationEmail($user->getEmail(), $token, $user->getCreatedDate());
|
||||||
|
|
||||||
$this->request->session()->delete('tmp_user_data');
|
$this->request->session()->delete('tmp_user_data');
|
||||||
@ -432,8 +428,6 @@ class LoginController
|
|||||||
return new HtmlContent('login/activate');
|
return new HtmlContent('login/activate');
|
||||||
}
|
}
|
||||||
|
|
||||||
\Container::$dbConnection->startTransaction();
|
|
||||||
|
|
||||||
$this->pdm->deleteFromDb($confirmation);
|
$this->pdm->deleteFromDb($confirmation);
|
||||||
|
|
||||||
$user = $this->userRepository->getById($confirmation->getUserId());
|
$user = $this->userRepository->getById($confirmation->getUserId());
|
||||||
@ -441,8 +435,6 @@ class LoginController
|
|||||||
|
|
||||||
$this->pdm->saveToDb($user);
|
$this->pdm->saveToDb($user);
|
||||||
|
|
||||||
\Container::$dbConnection->commit();
|
|
||||||
|
|
||||||
$this->request->setUser($user);
|
$this->request->setUser($user);
|
||||||
|
|
||||||
$this->deleteRedirectUrl();
|
$this->deleteRedirectUrl();
|
||||||
@ -462,8 +454,6 @@ class LoginController
|
|||||||
return new HtmlContent('login/cancel', ['success' => false]);
|
return new HtmlContent('login/cancel', ['success' => false]);
|
||||||
}
|
}
|
||||||
|
|
||||||
\Container::$dbConnection->startTransaction();
|
|
||||||
|
|
||||||
$this->pdm->deleteFromDb($confirmation);
|
$this->pdm->deleteFromDb($confirmation);
|
||||||
|
|
||||||
$user = $this->userRepository->getById($confirmation->getUserId());
|
$user = $this->userRepository->getById($confirmation->getUserId());
|
||||||
@ -474,8 +464,6 @@ class LoginController
|
|||||||
|
|
||||||
$this->pdm->deleteFromDb($user);
|
$this->pdm->deleteFromDb($user);
|
||||||
|
|
||||||
\Container::$dbConnection->commit();
|
|
||||||
|
|
||||||
return new HtmlContent('login/cancel', ['success' => true]);
|
return new HtmlContent('login/cancel', ['success' => true]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -541,16 +529,12 @@ class LoginController
|
|||||||
$passwordResetter->setToken($token);
|
$passwordResetter->setToken($token);
|
||||||
$passwordResetter->setExpiresDate($expires);
|
$passwordResetter->setExpiresDate($expires);
|
||||||
|
|
||||||
\Container::$dbConnection->startTransaction();
|
|
||||||
|
|
||||||
if ($existingResetter !== null) {
|
if ($existingResetter !== null) {
|
||||||
$this->pdm->deleteFromDb($existingResetter);
|
$this->pdm->deleteFromDb($existingResetter);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->pdm->saveToDb($passwordResetter);
|
$this->pdm->saveToDb($passwordResetter);
|
||||||
|
|
||||||
\Container::$dbConnection->commit();
|
|
||||||
|
|
||||||
$this->sendPasswordResetEmail($user->getEmail(), $token, $expires);
|
$this->sendPasswordResetEmail($user->getEmail(), $token, $expires);
|
||||||
|
|
||||||
return new JsonContent(['success' => true]);
|
return new JsonContent(['success' => true]);
|
||||||
@ -591,8 +575,6 @@ class LoginController
|
|||||||
return new JsonContent(['error' => ['errorText' => 'The given passwords do not match.']]);
|
return new JsonContent(['error' => ['errorText' => 'The given passwords do not match.']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
\Container::$dbConnection->startTransaction();
|
|
||||||
|
|
||||||
$this->pdm->deleteFromDb($resetter);
|
$this->pdm->deleteFromDb($resetter);
|
||||||
|
|
||||||
$user = $this->userRepository->getById($resetter->getUserId());
|
$user = $this->userRepository->getById($resetter->getUserId());
|
||||||
@ -600,8 +582,6 @@ class LoginController
|
|||||||
|
|
||||||
$this->pdm->saveToDb($user);
|
$this->pdm->saveToDb($user);
|
||||||
|
|
||||||
\Container::$dbConnection->commit();
|
|
||||||
|
|
||||||
$this->request->setUser($user);
|
$this->request->setUser($user);
|
||||||
|
|
||||||
$this->deleteRedirectUrl();
|
$this->deleteRedirectUrl();
|
||||||
|
@ -104,8 +104,6 @@ class MapAdminController implements IAuthenticationRequired, ISecured
|
|||||||
{
|
{
|
||||||
$mapId = (int) $this->request->query('mapId');
|
$mapId = (int) $this->request->query('mapId');
|
||||||
|
|
||||||
\Container::$dbConnection->startTransaction();
|
|
||||||
|
|
||||||
if ($mapId) {
|
if ($mapId) {
|
||||||
$map = $this->mapRepository->getById($mapId);
|
$map = $this->mapRepository->getById($mapId);
|
||||||
} else {
|
} else {
|
||||||
@ -186,8 +184,6 @@ class MapAdminController implements IAuthenticationRequired, ISecured
|
|||||||
|
|
||||||
$this->pdm->saveToDb($map);
|
$this->pdm->saveToDb($map);
|
||||||
|
|
||||||
\Container::$dbConnection->commit();
|
|
||||||
|
|
||||||
return new JsonContent(['mapId' => $map->getId(), 'added' => $addedIds]);
|
return new JsonContent(['mapId' => $map->getId(), 'added' => $addedIds]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,14 +193,10 @@ class MapAdminController implements IAuthenticationRequired, ISecured
|
|||||||
|
|
||||||
$map = $this->mapRepository->getById($mapId);
|
$map = $this->mapRepository->getById($mapId);
|
||||||
|
|
||||||
\Container::$dbConnection->startTransaction();
|
|
||||||
|
|
||||||
$this->deletePlaces($map);
|
$this->deletePlaces($map);
|
||||||
|
|
||||||
$this->pdm->deleteFromDb($map);
|
$this->pdm->deleteFromDb($map);
|
||||||
|
|
||||||
\Container::$dbConnection->commit();
|
|
||||||
|
|
||||||
return new JsonContent(['success' => true]);
|
return new JsonContent(['success' => true]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,8 +199,6 @@ class UserController implements IAuthenticationRequired
|
|||||||
return new JsonContent(['error' => ['errorText' => $error]]);
|
return new JsonContent(['error' => ['errorText' => $error]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
\Container::$dbConnection->startTransaction();
|
|
||||||
|
|
||||||
$userConfirmation = $this->userConfirmationRepository->getByUser($user);
|
$userConfirmation = $this->userConfirmationRepository->getByUser($user);
|
||||||
if ($userConfirmation !== null) {
|
if ($userConfirmation !== null) {
|
||||||
$this->pdm->deleteFromDb($userConfirmation);
|
$this->pdm->deleteFromDb($userConfirmation);
|
||||||
@ -225,8 +223,6 @@ class UserController implements IAuthenticationRequired
|
|||||||
|
|
||||||
$this->pdm->deleteFromDb($user);
|
$this->pdm->deleteFromDb($user);
|
||||||
|
|
||||||
\Container::$dbConnection->commit();
|
|
||||||
|
|
||||||
$this->request->session()->delete('authenticated_with_google_until');
|
$this->request->session()->delete('authenticated_with_google_until');
|
||||||
|
|
||||||
return new JsonContent(['success' => true]);
|
return new JsonContent(['success' => true]);
|
||||||
|
Loading…
Reference in New Issue
Block a user