LdapDataCollector.php 904 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. declare(strict_types = 1);
  3. /**
  4. * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\User_LDAP\DataCollector;
  8. use OC\AppFramework\Http\Request;
  9. use OCP\AppFramework\Http\Response;
  10. use OCP\DataCollector\AbstractDataCollector;
  11. class LdapDataCollector extends AbstractDataCollector {
  12. public function startLdapRequest(string $query, array $args, array $backtrace): void {
  13. $this->data[] = [
  14. 'start' => microtime(true),
  15. 'query' => $query,
  16. 'args' => $args,
  17. 'end' => microtime(true),
  18. 'backtrace' => $backtrace,
  19. ];
  20. }
  21. public function stopLastLdapRequest(): void {
  22. $this->data[count($this->data) - 1]['end'] = microtime(true);
  23. }
  24. public function getName(): string {
  25. return 'ldap';
  26. }
  27. public function collect(Request $request, Response $response, ?\Throwable $exception = null): void {
  28. }
  29. }