コード例 #1
0
 private function do_backup_demo_install()
 {
     try {
         $storage = 'backup-storage-local';
         $this->backup()->get_storage($storage)->ping(new FW_Backup_Feedback_Void());
         $post_id = $this->backup()->post_type()->insert(array('post_title' => __('Demo Install', 'fw'), 'post_status' => 'trash'));
         $theme = explode('/', get_template());
         $theme = $theme[0];
         $theme = preg_replace('/[- ]+/', ' ', $theme);
         $theme = ucwords($theme);
         $backup_info = new FW_Backup_Info();
         $backup_info->set_theme($theme);
         $backup_info->set_storage($storage);
         $backup_info->set_queued_at(time());
         $this->backup()->update_backup_info($post_id, $backup_info);
         // Without it Feedback page won't be opened
         $feedback = new FW_Backup_Feedback();
         $feedback->set_task(__('Waiting for start...', 'fw'));
         $this->backup()->update_feedback($post_id, $feedback);
         $this->backup()->cron()->schedule_backup_demo_install($post_id);
         wp_redirect($this->url_feedback($post_id));
     } catch (FW_Backup_Exception $exception) {
         FW_Flash_Messages::add('backup-demo-install', $exception->getMessage(), 'error');
         wp_redirect($this->backup()->post_type()->get_url());
     }
     exit;
 }