mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-08 00:04:27 +02:00
Change repository naming to avoid naming conflicts
This commit is contained in:
parent
febcdd72c7
commit
02fb800d12
13 changed files with 186 additions and 177 deletions
54
src/Database/Repository/UserdTableRepository.php
Normal file
54
src/Database/Repository/UserdTableRepository.php
Normal file
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
// Copyright (C) 2010-2024, the Friendica project
|
||||
// SPDX-FileCopyrightText: 2010-2024 the Friendica project
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Friendica\Database\Repository;
|
||||
|
||||
use Exception;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Database\DatabaseException;
|
||||
use Friendica\Repository\DeletedUserRepository;
|
||||
|
||||
/**
|
||||
* Repository for userd table
|
||||
*/
|
||||
final class UserdTableRepository implements DeletedUserRepository
|
||||
{
|
||||
private Database $database;
|
||||
|
||||
public function __construct(Database $database)
|
||||
{
|
||||
$this->database = $database;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a deleted user by username.
|
||||
*
|
||||
* @throws DatabaseException If the username could not be inserted
|
||||
*/
|
||||
public function insertByUsername(string $username): void
|
||||
{
|
||||
$throw = $this->database->throwExceptionsOnErrors(true);
|
||||
|
||||
try {
|
||||
$this->database->insert('userd', ['username' => $username]);
|
||||
} finally {
|
||||
$this->database->throwExceptionsOnErrors($throw);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a deleted username exists.
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function existsByUsername(string $username): bool
|
||||
{
|
||||
return $this->database->exists('userd', ['username' => $username]);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue