From f6fa5e51d90f34c6c4a375e8eea9bf3fc7d336b7 Mon Sep 17 00:00:00 2001 From: wpmuguru Date: Fri, 7 May 2010 21:53:11 +0000 Subject: [PATCH] make end month in export inclusive, see #10317 git-svn-id: http://svn.automattic.com/wordpress/trunk@14509 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/export.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/wp-admin/export.php b/wp-admin/export.php index 725b759d3..c107497dd 100644 --- a/wp-admin/export.php +++ b/wp-admin/export.php @@ -42,12 +42,15 @@ if ( isset( $_GET['download'] ) ) { require_once ('admin-header.php'); -$dateoptions = array(); +$dateoptions = $edateoptions = ''; $types = "'" . implode("', '", get_post_types( array( 'public' => true, 'can_export' => true ), 'names' )) . "'"; $stati = "'" . implode("', '", get_post_stati( array( 'internal' => false ), 'names' )) . "'"; -if ( $monthyears = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month` FROM $wpdb->posts WHERE post_type IN ($types) AND post_status IN ($stati) ORDER BY post_date ASC ") ) { - foreach ( $monthyears as $monthyear ) { - $dateoptions[] = "\t\n"; +if ( $monthyears = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, YEAR(DATE_ADD(post_date, INTERVAL 1 MONTH)) AS `eyear`, MONTH(DATE_ADD(post_date, INTERVAL 1 MONTH)) AS `emonth` FROM $wpdb->posts WHERE post_type IN ($types) AND post_status IN ($stati) ORDER BY post_date ASC ") ) { + foreach ( $monthyears as $k => $monthyear ) + $monthyears[$k]->lmonth = $wp_locale->get_month( $monthyear->month, 2 ); + for( $s = 0, $e = count( $monthyears ) - 1; $e >= 0; $s++, $e-- ) { + $dateoptions .= "\t\n"; + $edateoptions .= "\t\n"; } } @@ -69,12 +72,12 @@ if ( $monthyears = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`