/** * @param bool $full * @param string $zip_path * @param array $filesystem_args {}|{hostname: '', username: '', password: '', connection_type: ''} */ public function do_restore($full = false, $zip_path, $filesystem_args = array()) { $full = (bool) $full; $tmp_dir = self::backups()->get_tmp_dir(); $dirs = $this->get_dirs($full); $id_prefix = 'restore:'; $collection = new FW_Ext_Backups_Task_Collection('restore'); $collection->add_task(new FW_Ext_Backups_Task($id_prefix . 'tmp-dir-clean:before', 'dir-clean', array('dir' => $tmp_dir))); $collection->add_task(new FW_Ext_Backups_Task($id_prefix . 'unzip', 'unzip', array('zip' => $zip_path, 'dir' => $tmp_dir))); $collection->add_task(new FW_Ext_Backups_Task($id_prefix . 'files-restore', 'files-restore', array('source_dir' => $tmp_dir . '/f', 'destinations' => $dirs, 'filesystem_args' => $filesystem_args))); $collection->add_task(new FW_Ext_Backups_Task($id_prefix . 'db-restore', 'db-restore', array('dir' => $tmp_dir, 'full' => $full))); if (!$full) { $collection->add_task(new FW_Ext_Backups_Task($id_prefix . 'image-sizes-restore', 'image-sizes-restore', array())); } $collection->add_task(new FW_Ext_Backups_Task($id_prefix . 'tmp-dir-clean:after', 'dir-clean', array('dir' => $tmp_dir))); $this->execute_task_collection($collection); }
/** * @param bool $full * @param string $zip_path * @param array $filesystem_args {}|{hostname: '', username: '', password: '', connection_type: ''} */ public function do_restore($full = false, $zip_path, $filesystem_args = array()) { $tmp_dir = self::backups()->get_tmp_dir(); $id_prefix = 'restore:'; $collection = new FW_Ext_Backups_Task_Collection(($full ? 'full' : 'content') . '-restore'); $collection->add_task(new FW_Ext_Backups_Task($id_prefix . 'tmp-dir-clean:before', 'dir-clean', array('dir' => $tmp_dir))); $this->execute_task_collection($this->add_restore_tasks($collection, $full, $zip_path, $filesystem_args)); }