PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backups, Restore, Migration & Clone / 4.11.0
WP STAGING – WordPress Backups, Restore, Migration & Clone v4.11.0
4.11.0 4.10.0 4.9.5 4.9.4 4.9.3 4.9.2 4.9.1 4.9.0 4.8.1 trunk 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.10.0 3.2.0 3.3.1 3.3.2 3.3.3 3.4.1 3.4.3 3.5.0 3.6.0 3.7.1 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 4.0.0 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.7.2 4.7.3 4.8.0
wp-staging / Framework / Database / TableDto.php
wp-staging / Framework / Database Last commit date
Exporter 1 day ago QueryBuilder 1 day ago CustomTable.php 1 day ago DbInfo.php 1 day ago ExcludedTables.php 1 day ago ExternalDatabaseConfiguration.php 1 day ago OptionPreservationHandler.php 1 day ago SearchReplace.php 1 day ago SelectedTables.php 1 day ago TableDto.php 1 day ago TableService.php 1 day ago TablesRenamer.php 1 day ago WpDbInfo.php 1 day ago WpOptionsInfo.php 1 day ago iDbInfo.php 2 years ago
TableDto.php
188 lines
1 <?php
2
3
4
5
6 namespace WPStaging\Framework\Database;
7
8 use DateTime;
9 use WPStaging\Framework\Interfaces\HydrateableInterface;
10 use WPStaging\Core\WPStaging;
11
12 class TableDto implements HydrateableInterface
13 {
14
15 private $name;
16
17
18 private $rows;
19
20
21 private $size;
22
23
24 private $autoIncrement;
25
26
27 private $createdAt;
28
29
30 private $updatedAt;
31
32
33 private $isView = false;
34
35 public function hydrate(array $data = [])
36 {
37 $this->setName($data['Name']);
38
39 $this->setRows(isset($data['Rows']) ? (int) $data['Rows'] : 0);
40 $this->setAutoIncrement(isset($data['Auto_increment']) ? $data['Auto_increment'] : null);
41
42 $this->setCreatedAt(new DateTime(isset($data['Create_time']) ? $data['Create_time'] : ''));
43 if (isset($data['Update_time']) && $data['Update_time']) {
44
45 $this->setUpdatedAt(new DateTime($data['Update_time']));
46 }
47
48 if (isset($data['Data_length'], $data['Index_length'])) {
49 $size = (int) $data['Data_length'] + (int) $data['Index_length'];
50 $this->setSize($size);
51 }
52
53 if (isset($data['Comment']) && $data['Comment'] === 'VIEW') {
54 $this->setIsView(true);
55 }
56
57 return $this;
58 }
59
60
61
62
63 public function getName()
64 {
65 return $this->name;
66 }
67
68
69
70
71 public function setName($name)
72 {
73 $this->name = $name;
74 }
75
76
77
78
79 public function getRows()
80 {
81 return $this->rows;
82 }
83
84
85
86
87 public function setRows($rows)
88 {
89 $this->rows = $rows;
90 }
91
92
93
94
95 public function getSize()
96 {
97 return $this->size;
98 }
99
100
101
102
103 public function setSize($size)
104 {
105 $this->size = $size;
106 }
107
108
109
110
111 public function getAutoIncrement()
112 {
113 return $this->autoIncrement;
114 }
115
116
117
118
119 public function setAutoIncrement($autoIncrement)
120 {
121 $this->autoIncrement = $autoIncrement;
122 }
123
124
125
126
127 public function getCreatedAt()
128 {
129 return $this->createdAt;
130 }
131
132
133
134
135 public function setCreatedAt($createdAt)
136 {
137 $this->createdAt = $createdAt;
138 }
139
140
141
142
143 public function getUpdatedAt()
144 {
145 return $this->updatedAt;
146 }
147
148
149
150
151 public function setUpdatedAt($updatedAt)
152 {
153 $this->updatedAt = $updatedAt;
154 }
155
156
157
158
159 public function getIsView(): bool
160 {
161 return $this->isView;
162 }
163
164
165
166
167
168 public function setIsView(bool $isView)
169 {
170 $this->isView = $isView;
171 }
172
173
174
175
176 public function getHumanReadableSize()
177 {
178
179
180
181 if (WPStaging::isOnWordPressPlayground()) {
182 return '';
183 }
184
185 return size_format($this->size);
186 }
187 }
188