/
DBTool.php
executable file
·118 lines (107 loc) · 2.18 KB
/
DBTool.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php namespace ZN\Database;
/**
* ZN PHP Web Framework
*
* "Simplicity is the ultimate sophistication." ~ Da Vinci
*
* @package ZN
* @license MIT [http://opensource.org/licenses/MIT]
* @author Ozan UYKUN [ozan@znframework.com]
*/
#[\AllowDynamicProperties]
class DBTool extends Connection
{
/**
* Database Tool Driver
*
* @param object
*/
protected $tool;
/**
* Magic Constructor
*
* @param array $settings
*/
public function __construct($settings = [])
{
parent::__construct($settings);
$this->tool = $this->getDriver('Tool', $settings);
}
/**
* List Databases
*
* @return array
*/
public function listDatabases()
{
return $this->tool->listDatabases();
}
/**
* List Tables
*
* @return array
*/
public function listTables()
{
return $this->tool->listTables();
}
/**
* Status Tabkes
*
* @param mixed $table
*
* @return object
*/
public function statusTables($table = '*')
{
return $this->tool->statusTables($table);
}
/**
* Optimize Tabkes
*
* @param mixed $table
*
* @return string
*/
public function optimizeTables($table = '*')
{
return $this->tool->optimizeTables($table);
}
/**
* Repair Tables
*
* @param mixed $table
* @param string $query = 'REPAIR TABLE'
* @param string $message = 'repairTablesSuccess'
*
* @return string
*/
public function repairTables($table = '*')
{
return $this->tool->repairTables($table);
}
/**
* Backup Table
*
* @param mixed $tables
* @param string $fileName
* @param string $path
*
* @return string
*/
public function backup($tables = '*', string $fileName = NULL, string $path = STORAGE_DIR)
{
return $this->tool->backup($tables, $fileName, $path);
}
/**
* Import File
*
* @param string $file
*
* @return bool
*/
public function import(string $file)
{
return $this->tool->import($file);
}
}