Skip to content

Commit 01e1051

Browse files
Improve purge and reset button
1 parent bd3134b commit 01e1051

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

includes/admin/feedzy-rss-feeds-import.php

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -755,22 +755,24 @@ public function manage_feedzy_import_columns( $column, $post_id ) {
755755
* @access private
756756
*/
757757
private function get_last_run_details( $post_id ) {
758-
$msg = '';
759-
$last = get_post_meta( $post_id, 'last_run', true );
760-
$status = array(
758+
$msg = '';
759+
$import_errors = get_post_meta( $post_id, 'import_errors', true );
760+
$status = array(
761761
'total' => '-',
762762
'items' => '-',
763763
'duplicates' => '-',
764764
'cumulative' => '-',
765765
);
766-
if ( $last ) {
767-
$status = array(
766+
$import_info = false;
767+
if ( $import_errors ) {
768+
$import_info = get_post_meta( $post_id, 'import_info', true );
769+
$status = array(
768770
'total' => 0,
769771
'items' => 0,
770772
'duplicates' => 0,
771773
'cumulative' => 0,
772774
);
773-
$status = $this->get_complete_import_status( $post_id );
775+
$status = $this->get_complete_import_status( $post_id );
774776
}
775777

776778
// link to the posts listing for this job.
@@ -882,11 +884,11 @@ private function get_last_run_details( $post_id ) {
882884
__( 'Items that were imported across all runs', 'feedzy-rss-feeds' ),
883885
$status['cumulative'],
884886
// fifth cell
885-
empty( $last ) ? '' : ( ! empty( $errors ) ? 'feedzy-has-popup import-error' : 'import-success' ),
886-
empty( $last ) ? '-1' : ( ! empty( $errors ) ? 0 : 1 ),
887+
empty( $import_info ) ? '' : ( ! empty( $errors ) ? 'feedzy-has-popup import-error' : 'import-success' ),
888+
empty( $import_info ) ? '-1' : ( ! empty( $errors ) ? 0 : 1 ),
887889
$post_id,
888890
__( 'View the errors', 'feedzy-rss-feeds' ),
889-
empty( $last ) ? '-' : ( ! empty( $errors ) ? '<i class="dashicons dashicons-warning"></i>' : '<i class="dashicons dashicons-yes-alt"></i>' ),
891+
empty( $import_info ) ? '-' : ( ! empty( $errors ) ? '<i class="dashicons dashicons-warning"></i>' : '<i class="dashicons dashicons-yes-alt"></i>' ),
890892
// second row
891893
__( 'Found', 'feedzy-rss-feeds' ),
892894
__( 'Duplicates', 'feedzy-rss-feeds' ),
@@ -2700,13 +2702,13 @@ private function purge_data() {
27002702
wp_delete_post( $post_id, true );
27012703
}
27022704
}
2705+
delete_post_meta( $id, 'import_errors' );
2706+
delete_post_meta( $id, 'import_info' );
2707+
delete_post_meta( $id, 'imported_items' );
2708+
delete_post_meta( $id, 'imported_items_count' );
27032709
}
27042710

27052711
delete_post_meta( $id, 'imported_items_hash' );
2706-
delete_post_meta( $id, 'imported_items' );
2707-
delete_post_meta( $id, 'imported_items_count' );
2708-
delete_post_meta( $id, 'import_errors' );
2709-
delete_post_meta( $id, 'import_info' );
27102712
delete_post_meta( $id, 'last_run' );
27112713
wp_die();
27122714
}

0 commit comments

Comments
 (0)