Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/app/Contracts/Repository/DatabaseRepositoryInterface.php
10284 views
1
<?php
2
3
namespace Pterodactyl\Contracts\Repository;
4
5
use Illuminate\Support\Collection;
6
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
7
8
interface DatabaseRepositoryInterface extends RepositoryInterface
9
{
10
public const DEFAULT_CONNECTION_NAME = 'dynamic';
11
12
/**
13
* Set the connection name to execute statements against.
14
*/
15
public function setConnection(string $connection): self;
16
17
/**
18
* Return the connection to execute statements against.
19
*/
20
public function getConnection(): string;
21
22
/**
23
* Return all the databases belonging to a server.
24
*/
25
public function getDatabasesForServer(int $server): Collection;
26
27
/**
28
* Return all the databases for a given host with the server relationship loaded.
29
*/
30
public function getDatabasesForHost(int $host, int $count = 25): LengthAwarePaginator;
31
32
/**
33
* Create a new database on a given connection.
34
*/
35
public function createDatabase(string $database): bool;
36
37
/**
38
* Create a new database user on a given connection.
39
*/
40
public function createUser(string $username, string $remote, string $password, ?int $max_connections): bool;
41
42
/**
43
* Give a specific user access to a given database.
44
*/
45
public function assignUserToDatabase(string $database, string $username, string $remote): bool;
46
47
/**
48
* Flush the privileges for a given connection.
49
*/
50
public function flush(): bool;
51
52
/**
53
* Drop a given database on a specific connection.
54
*/
55
public function dropDatabase(string $database): bool;
56
57
/**
58
* Drop a given user on a specific connection.
59
*/
60
public function dropUser(string $username, string $remote): bool;
61
}
62
63