QUIQQER issueshttps://dev.quiqqer.com/quiqqer/quiqqer/-/issues2019-06-11T13:42:38Zhttps://dev.quiqqer.com/quiqqer/quiqqer/-/issues/876Performance issue with default username when creating new users2019-06-11T13:42:38ZPatrick MüllerPerformance issue with default username when creating new usersThe following code turns out to be really slow if a lot of users without usernames are created:
`\QUI\Users\Manager->createChild()`
```php
<?php
// ...
$newUserLocale = QUI::getLocale()->get('quiqqer/quiqqer', 'user.create.new.username');
$newName = $newUserLocale;
$i = 0;
while ($this->usernameExists($newName)) {
$newName = $newUserLocale . ' (' . $i . ')';
$i++;
}
// ...
```
Depending on how many users with the fallback username (e.g. "New User (X)") already exist, the `while` loop will make the system slower and slower over time.
Suggestion by @mor : Use the current timestamp instead of an increasing number for the default username.The following code turns out to be really slow if a lot of users without usernames are created:
`\QUI\Users\Manager->createChild()`
```php
<?php
// ...
$newUserLocale = QUI::getLocale()->get('quiqqer/quiqqer', 'user.create.new.username');
$newName = $newUserLocale;
$i = 0;
while ($this->usernameExists($newName)) {
$newName = $newUserLocale . ' (' . $i . ')';
$i++;
}
// ...
```
Depending on how many users with the fallback username (e.g. "New User (X)") already exist, the `while` loop will make the system slower and slower over time.
Suggestion by @mor : Use the current timestamp instead of an increasing number for the default username.type: RefactoringHenning LeutzHenning Leutzhttps://dev.quiqqer.com/quiqqer/quiqqer/-/issues/824A JavaScript Callback can only be called once2020-04-23T11:33:28ZJan WennrichA JavaScript Callback can only be called onceSince the JavaScript callbacks can be called with parameters it's no longer possible to call a callback multiple times.
The reason is that previously the array stored only the names of the callbacks, thus allowing one callback to exist multiple times in the array.
After introducing parameters to the callbacks, the structure of the array changed. Now the callbacks' name is the key of the array's entry and it's parameters are the value.
If the same callback is added a second time, the previous entry is overwritten.
Therefore the structure of the array needs another rework.
Related source code:
~~https://dev.quiqqer.com/quiqqer/quiqqer/blob/dev/lib/QUI/Ajax.php#L380~~
Permalink: https://dev.quiqqer.com/quiqqer/quiqqer/blob/60d073c2f974671cab28a04c959bf2d75a3b43ed/lib/QUI/Ajax.php#L380Since the JavaScript callbacks can be called with parameters it's no longer possible to call a callback multiple times.
The reason is that previously the array stored only the names of the callbacks, thus allowing one callback to exist multiple times in the array.
After introducing parameters to the callbacks, the structure of the array changed. Now the callbacks' name is the key of the array's entry and it's parameters are the value.
If the same callback is added a second time, the previous entry is overwritten.
Therefore the structure of the array needs another rework.
Related source code:
~~https://dev.quiqqer.com/quiqqer/quiqqer/blob/dev/lib/QUI/Ajax.php#L380~~
Permalink: https://dev.quiqqer.com/quiqqer/quiqqer/blob/60d073c2f974671cab28a04c959bf2d75a3b43ed/lib/QUI/Ajax.php#L380type: Bugtype: RefactoringPatrick MüllerPatrick Müller