Signed-off-by: dartcafe <github@dartcafe.de>
This commit is contained in:
dartcafe 2021-04-09 02:14:58 +02:00
Родитель 07dcc552d5
Коммит 2e000492ce
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: CCE73CEF3035D3C8
2 изменённых файлов: 55 добавлений и 1 удалений

54
lib/Helper/Trace.php Normal file
Просмотреть файл

@ -0,0 +1,54 @@
<?php
/**
* @copyright Copyright (c) 2021 René Gieling <github@dartcafe.de>
*
* @author René Gieling <github@dartcafe.de>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Polls\Model;
class Trace implements \JsonSerializable {
/** @var Array */
protected $result = [];
/** @var string */
protected $method;
public function __construct(
string $method,
string $payload = ''
) {
$this->method = $method;
$this->log('Initialization', $payload);
}
public function log($operation, $payload = '') {
$this->result[] = [
'method' => $this->method,
'time' => time(),
'operation' => $operation,
'payload' => $payload
];
}
public function jsonSerialize(): array {
return $this->result;
}
}

Просмотреть файл

@ -141,7 +141,7 @@ class SystemService {
}
// get all users
foreach (User::search() as $user) {
foreach (User::search($userName) as $user) {
if ($userName === strtolower(trim($user->getId()))
|| $userName === strtolower(trim($user->getDisplayName()))) {
throw new InvalidUsernameException;