Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate code for generating sitemaps from CLI and cron #70

Open
nickdaugherty opened this issue Nov 12, 2014 · 0 comments

Comments

Projects
None yet
1 participant
@nickdaugherty
Copy link
Member

commented Nov 12, 2014

CLI and cron duplicate code used to generate the sitemap for a given day:

$date_stamp = Metro_Sitemap::get_date_stamp( $year, $month, $day );
if ( Metro_Sitemap::date_range_has_posts( $date_stamp, $date_stamp ) ) {
    Metro_Sitemap::generate_sitemap_for_date( $date_stamp ); // TODO: simplify; this function should accept the year, month, day and translate accordingly
}

This should be refactored into a method that includes the date_range_has_posts check, as we need to attempt to delete the sitemap if it doesn't have any posts, and there is no need to maintain that code in multiple places.

Needed for #63

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.