function column_interval($item) { global $wpmudev_snapshot; if ((!isset($item['interval'])) || ($item['interval'] == "immediate") || (empty($item['interval']))) { _e('Manual', SNAPSHOT_I18N_DOMAIN); $snapshot_locker = new SnapshotLocker($wpmudev_snapshot->snapshot_get_setting('backupLockFolderFull'), $item['timestamp']); if (!$snapshot_locker->is_locked()) { $locker_info = $snapshot_locker->get_locker_info(); if ($locker_info['item_key'] == $item['timestamp']) { $file_progress = ''; if ((isset($locker_info['file_offset'])) && ($locker_info['file_size'])) { $file_progress = sprintf("%0d%% ", ($locker_info['file_offset']/$locker_info['file_size'])*100); } //echo "locker_info<pre>"; print_r($locker_info); echo "</pre>"; $snapshot_process_action = $locker_info['doing'] .' '. $file_progress .'(<a class="snapshot-abort-item" href="pid='.$locker_info['pid'] . '&item='. $item['timestamp'] .'">'. __('abort', SNAPSHOT_I18N_DOMAIN) .'</a>)<br /><a class="snapshot-thickbox" href="'. admin_url() .'admin-ajax.php?action=snapshot_view_log_ajax&&snapshot-item=' . $item['timestamp'] .'&snapshot-data-item='. $locker_info['data_item_key'] .'&live=1">'. __('Now', SNAPSHOT_I18N_DOMAIN) .'</a>'; $running_timestamp = $locker_info['time_start']; ?><br /><?php echo $snapshot_process_action; ?>: <?php echo snapshot_utility_show_date_time( $running_timestamp ); } } unset($snapshot_locker); } else if ((isset($item['interval'])) && (strlen($item['interval']))) { $interval_text = snapshot_utility_get_sched_display($item['interval']); if ($interval_text) echo $interval_text; $snapshot_locker = new SnapshotLocker($wpmudev_snapshot->snapshot_get_setting('backupLockFolderFull'), $item['timestamp']); if (!$snapshot_locker->is_locked()) { $locker_info = $snapshot_locker->get_locker_info(); //echo "locker_info<pre>"; print_r($locker_info); echo "</pre>"; if ($locker_info['item_key'] == $item['timestamp']) { $snapshot_process_action = '<br /><a class="snapshot-thickbox" href="'. admin_url() .'admin-ajax.php?action=snapshot_view_log_ajax&snapshot-item='. $item['timestamp']. '&snapshot-data-item='. $locker_info['data_item_key'] . '&live=1">'. __('Now', SNAPSHOT_I18N_DOMAIN) .'</a>: '; $snapshot_process_action .= $locker_info['doing']; $file_progress = ''; if ((isset($locker_info['file_offset'])) && (intval($locker_info['file_offset'])) && (isset($locker_info['file_size'])) && (intval($locker_info['file_size'])) ) { $file_progress = sprintf(" %0d%% ", (intval($locker_info['file_offset'])/intval($locker_info['file_size']))*100); $snapshot_process_action .= $file_progress; } else if ((isset($locker_info['files_count'])) && (intval($locker_info['files_count'])) && (isset($locker_info['files_total'])) && (intval($locker_info['files_total'])) ) { $file_progress = sprintf(" %0d%% ", (intval($locker_info['files_count'])/intval($locker_info['files_total']))*100); $snapshot_process_action .= $file_progress; } else { $snapshot_process_action .= " "; } $snapshot_process_action .= '(<a class="snapshot-abort-item" href="pid='.$locker_info['pid'] . '&item='. $item['timestamp'] .'">'. __('abort', SNAPSHOT_I18N_DOMAIN) .'</a>)'; echo $snapshot_process_action; } } else { //$snapshot_process_action = __('Next', SNAPSHOT_I18N_DOMAIN) .": "; $running_timestamp = wp_next_scheduled( 'snapshot_backup_cron', array(intval($item['timestamp'])) ); echo "<br />". __('Next', SNAPSHOT_I18N_DOMAIN) .": ". snapshot_utility_show_date_time( $running_timestamp ); } unset($snapshot_locker); } if ((isset($item['data'])) && (count($item['data']))) { $data_item = snapshot_utility_latest_data_item($item['data']); if (isset($data_item)) { if (isset($data_item['timestamp'])) { ?><br /><?php _e('Last', SNAPSHOT_I18N_DOMAIN); ?>: <?php echo snapshot_utility_show_date_time($data_item['timestamp']); } } } }
function snapshot_ajax_item_abort_proc() { $error_array = array(); $error_array['errorStatus'] = false; $error_array['errorText'] = ""; $error_array['responseText'] = ""; $item_info = array(); if (isset($_POST['snapshot_item_info'])) { $post_info = explode('&', $_POST['snapshot_item_info']); foreach ($post_info as $post_info_item) { $_parts = explode('=', $post_info_item); if (isset($_parts[0]) && !empty($_parts[0]) && isset($_parts[1]) && !empty($_parts[1])) { $item_info[$_parts[0]] = $_parts[1]; } } } if (isset($item_info['pid']) && !empty($item_info['pid']) && isset($item_info['item']) && !empty($item_info['item']) && current_user_can('manage_snapshots_items')) { $snapshot_locker = new SnapshotLocker($this->_settings['backupLockFolderFull'], $item_info['item']); if (!$snapshot_locker->is_locked()) { $locker_info = $snapshot_locker->get_locker_info(); if (intval($locker_info['pid']) === intval($item_info['pid'])) { posix_kill(intval($item_info['pid']), 9); $error_array['responseText'] = " Aborted Item. Page will reload."; $snapshot_logger = new SnapshotLogger($this->_settings['backupLogFolderFull'], $locker_info['item_key'], $locker_info['data_item_key']); $current_user = wp_get_current_user(); //echo "display_name=[". $current_user->display_name ."]<br />"; //echo "current_user<pre>"; print_r($current_user); echo "</pre>"; $snapshot_logger->log_message('Process [' . $item_info['pid'] . '] ABORT by user: ' . $current_user->display_name); } } } else { } echo json_encode($error_array); die; }