Skip to content
Permalink
Browse files

Merge pull request #136 from Automattic/kraftbj-patch-1

CLI: Use cal_days_in_month when available
  • Loading branch information...
kraftbj committed May 3, 2018
2 parents 4b4935c + 6e05b3e commit f0d233c42d60860bfb8161367eb53cd9bf6f13d9
Showing with 5 additions and 1 deletion.
  1. +5 −1 includes/wp-cli.php
@@ -100,7 +100,11 @@ function generate_sitemap_for_year_month( $args, $assoc_args ) {
WP_CLI::line( sprintf( 'Generating sitemap for %s-%s', $year, $month ) );
// Calculate actual number of days in the month since we don't have cal_days_in_month available
$max_days = 31;
if ( ! function_exists( 'cal_days_in_month' ) ) {
$max_days = 31;
} else {
$max_days = cal_days_in_month( CAL_GREGORIAN, (int) $month, (int) $year );
}
if ( date( 'Y' ) == $year && date( 'n' ) == $month ) {
$max_days = date( 'j' );

0 comments on commit f0d233c

Please sign in to comment.
You can’t perform that action at this time.