wp = $wp; $this->batch_size = max( 1, (int) $batch_size ); } /** * {@inheritdoc} */ public function urls() { $before_key = 0; $last_year = null; do { $rows = $this->wp->month_rows( $before_key, $this->batch_size ); $full_batch = count( $rows ) === $this->batch_size; foreach ( $rows as $row ) { $before_key = $row['year'] * 100 + $row['month']; if ( $last_year !== $row['year'] ) { $last_year = $row['year']; yield new DiscoveredUrl( $this->wp->year_link( $row['year'] ), 'archive' ); } yield new DiscoveredUrl( $this->wp->month_link( $row['year'], $row['month'] ), 'archive' ); } } while ( $full_batch ); } }