1 | <?php |
||
15 | class Operator |
||
16 | { |
||
17 | use Debugger; |
||
18 | |||
19 | /** |
||
20 | * MySQL and MySQLDump login arguments. |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | private $credentials = ''; |
||
25 | |||
26 | /** |
||
27 | * Operator constructor. |
||
28 | * |
||
29 | * @param string $username |
||
30 | * The name of MySQL user. |
||
31 | * @param string $password |
||
32 | * Password from an account of MySQL user. |
||
33 | * @param string $host |
||
34 | * MySQL host address. |
||
35 | * @param string $port |
||
36 | * Port of the MySQL host. |
||
37 | */ |
||
38 | public function __construct($username, $password = '', $host = '', $port = '') |
||
56 | |||
57 | /** |
||
58 | * @param string $name |
||
59 | * Name of the database to check. |
||
60 | * |
||
61 | * @return bool |
||
62 | * Checking state. |
||
63 | */ |
||
64 | public function exist($name) |
||
68 | |||
69 | /** |
||
70 | * @param string $name |
||
71 | * Name of the database to create. |
||
72 | */ |
||
73 | public function create($name) |
||
79 | |||
80 | /** |
||
81 | * @param string $name |
||
82 | * Name of the database to drop. |
||
83 | */ |
||
84 | public function drop($name) |
||
90 | |||
91 | /** |
||
92 | * @param string $source |
||
93 | * Source DB name. |
||
94 | * @param string $destination |
||
95 | * Name of the new DB. |
||
96 | */ |
||
97 | public function copy($source, $destination) |
||
103 | |||
104 | /** |
||
105 | * @param string $name |
||
106 | * Name of the DB. |
||
107 | */ |
||
108 | public function clear($name) |
||
113 | |||
114 | /** |
||
115 | * Executes a shell command. |
||
116 | * |
||
117 | * @param string $command |
||
118 | * Command to execute. |
||
119 | * |
||
120 | * @return string |
||
121 | * Result of a shell command. |
||
122 | */ |
||
123 | private function exec($command) |
||
136 | } |
||
137 |