misc_pterodactyl-panel/app/Contracts/Repository/DatabaseRepositoryInterface.php

69 lines
1.8 KiB
PHP
Raw Normal View History

2017-07-15 16:52:34 +00:00
<?php
namespace Pterodactyl\Contracts\Repository;
use Pterodactyl\Models\Database;
use Illuminate\Support\Collection;
2018-03-03 23:52:35 +00:00
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
2017-07-15 16:52:34 +00:00
interface DatabaseRepositoryInterface extends RepositoryInterface
{
2021-01-23 20:33:34 +00:00
public const DEFAULT_CONNECTION_NAME = 'dynamic';
/**
* Set the connection name to execute statements against.
*
* @return $this
*/
public function setConnection(string $connection);
/**
2018-05-13 14:50:56 +00:00
* Return the connection to execute statements against.
*/
public function getConnection(): string;
/**
* Return all of the databases belonging to a server.
*/
public function getDatabasesForServer(int $server): Collection;
2018-03-03 23:52:35 +00:00
/**
* Return all of the databases for a given host with the server relationship loaded.
*/
public function getDatabasesForHost(int $host, int $count = 25): LengthAwarePaginator;
2017-07-15 16:52:34 +00:00
/**
* Create a new database on a given connection.
*/
public function createDatabase(string $database): bool;
2017-07-15 16:52:34 +00:00
/**
* Create a new database user on a given connection.
*
* @param $max_connections
2017-07-15 16:52:34 +00:00
*/
public function createUser(string $username, string $remote, string $password, string $max_connections): bool;
2017-07-15 16:52:34 +00:00
/**
* Give a specific user access to a given database.
*/
public function assignUserToDatabase(string $database, string $username, string $remote): bool;
2017-07-15 16:52:34 +00:00
/**
* Flush the privileges for a given connection.
*/
public function flush(): bool;
2017-07-15 16:52:34 +00:00
/**
* Drop a given database on a specific connection.
*/
public function dropDatabase(string $database): bool;
2017-07-15 16:52:34 +00:00
/**
* Drop a given user on a specific connection.
*
* @return mixed
*/
public function dropUser(string $username, string $remote): bool;
2017-07-15 16:52:34 +00:00
}