1 | <?php |
||
21 | class Database extends BaseObject |
||
22 | { |
||
23 | const CACHE_ACCESS_HOSTS = 'access_hosts'; |
||
24 | |||
25 | /** @var User */ |
||
26 | private $owner; |
||
27 | |||
28 | /** @var string */ |
||
29 | private $databaseName; |
||
30 | |||
31 | /** |
||
32 | * Database constructor. |
||
33 | * |
||
34 | * @param string $name Name of the database |
||
35 | * @param User $owner Database owner |
||
36 | * @param UserContext $context Context within which the object is valid |
||
37 | */ |
||
38 | public function __construct($name, User $owner, UserContext $context) |
||
44 | |||
45 | /** |
||
46 | * Creates a new database under the specified user. |
||
47 | * |
||
48 | * @param User $user Owner of the database |
||
49 | * @param string $name Database name, without <user>_ prefix |
||
50 | * @param string $username Username to access the database with, without <user>_ prefix |
||
51 | * @param string|null $password Password, or null if database user already exists |
||
52 | * @return Database Newly created database |
||
53 | */ |
||
54 | public static function create(User $user, $name, $username, $password) |
||
68 | |||
69 | /** |
||
70 | * Deletes this database from the user. |
||
71 | */ |
||
72 | public function delete() |
||
80 | |||
81 | /** |
||
82 | * @return Database\AccessHost[] |
||
83 | */ |
||
84 | public function getAccessHosts() |
||
97 | |||
98 | /** |
||
99 | * @param string $name |
||
100 | * @return Database\AccessHost |
||
101 | */ |
||
102 | public function createAccessHost($name) |
||
108 | |||
109 | /** |
||
110 | * @return string Name of the database |
||
111 | */ |
||
112 | public function getDatabaseName() |
||
116 | |||
117 | /** |
||
118 | * @return User |
||
119 | */ |
||
120 | public function getOwner() |
||
124 | } |
||
125 |