Skip to content

fix(events): persist refreshed recurrence intervals - #524

Open
sjinks wants to merge 1 commit into
mainfrom
pltfrm-2761-persist-refreshed-wordpress-cron-schedule-intervals
Open

fix(events): persist refreshed recurrence intervals#524
sjinks wants to merge 1 commit into
mainfrom
pltfrm-2761-persist-refreshed-wordpress-cron-schedule-intervals

Conversation

@sjinks

@sjinks sjinks commented Aug 27, 2026

Copy link
Copy Markdown
Member

Summary

  • persist the refreshed WordPress cron schedule interval during event rescheduling
  • verify the saved event stores the refreshed interval and schedules its next run with it

Testing

  • php -l includes/class-event.php
  • php -l __tests__/unit-tests/test-event.php
  • ./vendor/bin/phpcs --standard=phpcs.xml includes/class-event.php __tests__/unit-tests/test-event.php
  • git diff --check
  • ./vendor/bin/phpunit __tests__/unit-tests/test-event.php (blocked locally: WordPress test bootstrap at /tmp/wordpress-tests-lib and its MariaDB database are unavailable)

Fixes PLTFRM-2761.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 27, 2026 21:05
@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes recurring event rescheduling so that when the WordPress cron schedule interval has been refreshed/changed, the updated interval is persisted on the saved event and used to compute the next run time.

Changes:

  • Persist the refreshed schedule interval during Event::reschedule() when the interval has changed.
  • Add a unit test covering interval refresh persistence and next-run scheduling based on the refreshed interval.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
includes/class-event.php Updates reschedule logic to save the refreshed recurrence interval.
tests/unit-tests/test-event.php Adds a unit test to verify refreshed intervals are persisted and used for scheduling.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +90 to +99
add_filter( 'cron_schedules', $filter );

$result = $event->reschedule();

remove_filter( 'cron_schedules', $filter );
$reloaded_event = Event::get( $event->get_id() );
$this->assertTrue( $result, 'event was successfully rescheduled' );
$this->assertInstanceOf( Event::class, $reloaded_event );
$this->assertEquals( 2 * HOUR_IN_SECONDS, $reloaded_event->get_interval(), 'the refreshed interval was saved' );
$this->assertEqualsWithDelta( time() + ( 2 * HOUR_IN_SECONDS ), $reloaded_event->get_timestamp(), 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants