protected function tables() { if (!isset($_POST['settings']['type'])) { return array('error' => __('Missing type.', $this->plugin_translate)); } if (!isset($_POST['settings']['website_id'])) { return array('error' => __('Missing website id.', $this->plugin_translate)); } $type = $_POST['settings']['type']; $website_id = $_POST['settings']['website_id']; $this->wp_list_table_dependency(); $array = array(); switch ($type) { case 'logs': if (!is_dir(get_site_option('backwpup_cfg_logfolder'))) { return array('success' => 1, 'response' => $array); } update_user_option(get_current_user_id(), 'backwpuplogs_per_page', 99999999); $output = new BackWPup_Page_Logs(); $output->prepare_items(); break; case 'backups': update_user_option(get_current_user_id(), 'backwpupbackups_per_page', 99999999); $output = new BackWPup_Page_Backups(); $output->items = array(); $jobids = BackWPup_Option::get_job_ids(); if (!empty($jobids)) { foreach ($jobids as $jobid) { if (BackWPup_Option::get($jobid, 'backuptype') == 'sync') { continue; } $dests = BackWPup_Option::get($jobid, 'destinations'); foreach ($dests as $dest) { $dest_class = BackWPup::get_destination($dest); $items = $dest_class->file_get_list($jobid . '_' . $dest); if (!empty($items)) { foreach ($items as $item) { $temp_single_item = $item; $temp_single_item['dest'] = $jobid . '_' . $dest; $output->items[] = $temp_single_item; } } } } } break; case 'jobs': $output = new BackWPup_Page_Jobs(); $output->prepare_items(); break; } if (is_array($output->items)) { if ($type == 'jobs') { foreach ($output->items as $key => $val) { $temp_array = array(); $temp_array['id'] = $val; $temp_array['name'] = BackWPup_Option::get($val, 'name'); $temp_array['type'] = BackWPup_Option::get($val, 'type'); $temp_array['destinations'] = BackWPup_Option::get($val, 'destinations'); if ($this->is_backwpup_pro) { $temp_array['export'] = str_replace('&', '&', wp_nonce_url(network_admin_url('admin.php') . '?page=backwpupjobs&action=export&jobs[]=' . $val, 'bulk-jobs')); } if (BackWPup_Option::get($val, 'activetype') == 'wpcron') { if ($nextrun = wp_next_scheduled('backwpup_cron', array('id' => $val)) + get_option('gmt_offset') * 3600) { $temp_array['nextrun'] = sprintf(__('%1$s at %2$s by WP-Cron', 'backwpup'), date_i18n(get_option('date_format'), $nextrun, true), date_i18n(get_option('time_format'), $nextrun, true)); } else { $temp_array['nextrun'] = __('Not scheduled!', 'backwpup'); } } else { $temp_array['nextrun'] = __('Inactive', 'backwpup'); } if (BackWPup_Option::get($val, 'lastrun')) { $lastrun = BackWPup_Option::get($val, 'lastrun'); $temp_array['lastrun'] = sprintf(__('%1$s at %2$s', 'backwpup'), date_i18n(get_option('date_format'), $lastrun, true), date_i18n(get_option('time_format'), $lastrun, true)); if (BackWPup_Option::get($val, 'lastruntime')) { $temp_array['lastrun'] .= ' ' . sprintf(__('Runtime: %d seconds', 'backwpup'), BackWPup_Option::get($val, 'lastruntime')); } } else { $temp_array['lastrun'] = __('not yet', 'backwpup'); } $temp_array['website_id'] = $website_id; $array[] = $temp_array; } } else { if ($type == 'backups') { $without_dupes = array(); foreach ($output->items as $key) { $temp_array = $key; $temp_array['downloadurl'] = str_replace(array('&', network_admin_url('admin.php') . '?page=backwpupbackups&action='), array('&', admin_url('admin-ajax.php') . '?action=mainwp_backwpup_download_backup&type='), $temp_array['downloadurl'] . '&_wpnonce=' . $this->create_nonce_without_session('mainwp_download_backup')); $temp_array['website_id'] = $website_id; if (!isset($without_dupes[$temp_array['file']])) { $array[] = $temp_array; $without_dupes[$temp_array['file']] = 1; } } } else { foreach ($output->items as $key => $val) { $array[] = $val; } } } } return array('success' => 1, 'response' => $array); }