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) |
||
135 | |||
136 | /** |
||
137 | * Loads a backup from the database |
||
138 | * @param integer $id |
||
139 | * @return array |
||
140 | */ |
||
141 | public function get($id) |
||
146 | |||
147 | /** |
||
148 | * Deletes a backup from disk and database |
||
149 | * @param integer $id |
||
150 | * @return boolean |
||
151 | */ |
||
152 | public function delete($id) |
||
170 | |||
171 | /** |
||
172 | * Deletes a backup ZIP archive |
||
173 | * @param integer $backup_id |
||
174 | * @return boolean |
||
175 | */ |
||
176 | protected function deleteZip($backup_id) |
||
186 | |||
187 | /** |
||
188 | * Performs backup operation |
||
189 | * @param string $handler_id |
||
190 | * @param array $data |
||
191 | * @return boolean|string |
||
192 | */ |
||
193 | public function backup($handler_id, $data) |
||
198 | |||
199 | /** |
||
200 | * Performs restore operation |
||
201 | * @param string $handler_id |
||
202 | * @param array $data |
||
203 | * @return boolean|string |
||
204 | */ |
||
205 | public function restore($handler_id, $data) |
||
210 | |||
211 | /** |
||
212 | * Whether a backup already exists |
||
213 | * @param string $id |
||
214 | * @param null|string $version |
||
215 | * @return bool |
||
216 | */ |
||
217 | public function exists($id, $version = null) |
||
222 | |||
223 | /** |
||
224 | * Returns an array of backup handlers |
||
225 | * @return array |
||
226 | */ |
||
227 | public function getHandlers() |
||
239 | |||
240 | /** |
||
241 | * Returns a single handler |
||
242 | * @param string $handler_id |
||
243 | * @return array |
||
244 | */ |
||
245 | public function getHandler($handler_id) |
||
250 | |||
251 | /** |
||
252 | * Returns an array of default backup handlers |
||
253 | * @return array |
||
254 | */ |
||
255 | protected function getDefaultHandlers() |
||
267 | |||
268 | } |
||
269 |