1 | <?php |
||
20 | class Backup extends Model |
||
21 | { |
||
22 | |||
23 | /** |
||
24 | * Language model instance |
||
25 | * @var \gplcart\core\models\Language $language |
||
26 | */ |
||
27 | protected $language; |
||
28 | |||
29 | /** |
||
30 | * User model instance |
||
31 | * @var \gplcart\core\models\User $user |
||
32 | */ |
||
33 | protected $user; |
||
34 | |||
35 | /** |
||
36 | * @param UserModel $user |
||
37 | * @param LanguageModel $language |
||
38 | */ |
||
39 | public function __construct(UserModel $user, LanguageModel $language) |
||
46 | |||
47 | /** |
||
48 | * Returns an array of backups or counts them |
||
49 | * @param array $data |
||
50 | * @return array|integer |
||
51 | */ |
||
52 | public function getList(array $data = array()) |
||
110 | |||
111 | /** |
||
112 | * Adds a backup to the database |
||
113 | * @param array $data |
||
114 | * @return boolean|integer |
||
115 | */ |
||
116 | public function add(array $data) |
||
144 | |||
145 | /** |
||
146 | * Loads a backup from the database |
||
147 | * @param integer $id |
||
148 | * @return array |
||
149 | */ |
||
150 | public function get($id) |
||
155 | |||
156 | /** |
||
157 | * Deletes a backup from disk and database |
||
158 | * @param integer $id |
||
159 | * @return boolean |
||
160 | */ |
||
161 | public function delete($id) |
||
179 | |||
180 | /** |
||
181 | * Deletes a backup ZIP archive |
||
182 | * @param integer $backup_id |
||
183 | * @return boolean |
||
184 | */ |
||
185 | protected function deleteZip($backup_id) |
||
196 | |||
197 | /** |
||
198 | * Performs backup operation |
||
199 | * @param string $handler_id |
||
200 | * @param array $data |
||
201 | * @return boolean|string |
||
202 | */ |
||
203 | public function backup($handler_id, $data) |
||
208 | |||
209 | /** |
||
210 | * Performs restore operation |
||
211 | * @param string $handler_id |
||
212 | * @param array $data |
||
213 | * @return boolean|string |
||
214 | */ |
||
215 | public function restore($handler_id, $data) |
||
220 | |||
221 | /** |
||
222 | * Whether a backup already exists |
||
223 | * @param string $id |
||
224 | * @param null|string $version |
||
225 | * @return bool |
||
226 | */ |
||
227 | public function exists($id, $version = null) |
||
232 | |||
233 | /** |
||
234 | * Returns an array of backup handlers |
||
235 | * @return array |
||
236 | */ |
||
237 | public function getHandlers() |
||
249 | |||
250 | /** |
||
251 | * Returns a single handler |
||
252 | * @param string $handler_id |
||
253 | * @return array |
||
254 | */ |
||
255 | public function getHandler($handler_id) |
||
260 | |||
261 | /** |
||
262 | * Returns an array of default backup handlers |
||
263 | * @return array |
||
264 | */ |
||
265 | protected function getDefaultHandlers() |
||
277 | |||
278 | } |
||
279 |