Repository navigation
feat(contracts): add AbstractJob and the platform-extensibility abstracts #85
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
Open
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
0378e5f
feat(contracts): add AbstractJob for Action Scheduler-backed backgrou…
Adi-ty 3b3b87c
feat(contracts): add the platform-extensibility abstracts
Adi-ty bf7cdfe
docs: document the job and platform abstracts; sync AI instruction files
Adi-ty 7dfba06
fix(contracts): split job priorities into hook and queue seams; forw…
Adi-ty e623bdc
fix(tests): gate Action Scheduler fakes behind AS_FAKES_ACTIVE and lo…
Adi-ty 3a7460c
fix(contracts): expose AS decline signal from schedule methods
Adi-ty 1a88140
fix: harden ActionScheduler integration and align docs with non-Regis…
Adi-ty f295519
docs: explain deliberate self:: usage in is_available()
Adi-ty 7444923
fix(contracts): use null sentinel in get_writable_paths() to distingu…
Adi-ty 14fd7b7
Merge branch 'main' into feat/job-and-platform-abstracts
Adi-ty 49bcd6b
chore: rename wp-framework to wp-primitives in job and platform abstr…
Adi-ty File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| <?php | ||
| /** | ||
| * Analysis-only declarations for Action Scheduler (https://actionscheduler.org/). | ||
| * | ||
| * Not a dependency of this package — see {@see \rtCamp\WPPrimitives\Contracts\Abstracts\AbstractJob}, | ||
| * which guards every call behind `is_available()`. Referenced via PHPStan's | ||
| * `scanFiles` so those calls resolve regardless of whether a consumer has the | ||
| * library installed. Never autoloaded or executed. | ||
| * | ||
| * @package rtCamp\WPPrimitives | ||
| */ | ||
|
|
||
| declare( strict_types = 1 ); | ||
|
|
||
| class ActionScheduler_Versions { | ||
| public static function instance(): ActionScheduler_Versions {} | ||
|
|
||
| /** | ||
| * @return string|false The highest registered version, or false when none is. | ||
| */ | ||
| public function latest_version() {} | ||
| } | ||
|
|
||
| class ActionScheduler { | ||
| /** | ||
| * @param string|null $function_name Calling function name, for the developer notice. | ||
| */ | ||
| public static function is_initialized( ?string $function_name = null ): bool {} | ||
| } | ||
|
|
||
| /** | ||
| * @param string $hook The hook to trigger. | ||
| * @param array<mixed> $args Arguments to pass when the hook triggers. | ||
| * @param string $group The group to assign this job to. | ||
| * @param bool $unique Whether the action should be unique. | ||
| * @param int $priority Lower values take precedence. | ||
| * | ||
| * @return int The action ID. Zero on error. | ||
| */ | ||
| function as_enqueue_async_action( string $hook, array $args = [], string $group = '', bool $unique = false, int $priority = 10 ): int {} | ||
|
|
||
| /** | ||
| * @param int $timestamp When the job will run. | ||
| * @param string $hook The hook to trigger. | ||
| * @param array<mixed> $args Arguments to pass when the hook triggers. | ||
| * @param string $group The group to assign this job to. | ||
| * @param bool $unique Whether the action should be unique. | ||
| * @param int $priority Lower values take precedence. | ||
| * | ||
| * @return int The action ID. Zero on error. | ||
| */ | ||
| function as_schedule_single_action( int $timestamp, string $hook, array $args = [], string $group = '', bool $unique = false, int $priority = 10 ): int {} | ||
|
|
||
| /** | ||
| * @param int $timestamp When the first instance will run. | ||
| * @param int $interval_in_seconds How long to wait between runs. | ||
| * @param string $hook The hook to trigger. | ||
| * @param array<mixed> $args Arguments to pass when the hook triggers. | ||
| * @param string $group The group to assign this job to. | ||
| * @param bool $unique Whether the action should be unique. | ||
| * @param int $priority Lower values take precedence. | ||
| * | ||
| * @return int The action ID. Zero on error. | ||
| */ | ||
| function as_schedule_recurring_action( int $timestamp, int $interval_in_seconds, string $hook, array $args = [], string $group = '', bool $unique = false, int $priority = 10 ): int {} | ||
|
|
||
| /** | ||
| * @param string $hook Name of the hook to search for. | ||
| * @param array<mixed>|null $args Arguments to match. | ||
| * @param string $group Group of the action to match. | ||
| */ | ||
| function as_has_scheduled_action( string $hook, ?array $args = null, string $group = '' ): bool {} | ||
|
|
||
| /** | ||
| * @param string $hook The hook that the job will trigger. | ||
| * @param array<mixed> $args Args that would have been passed to the job. | ||
| * @param string $group The group the job is assigned to. | ||
| * | ||
| * @return int|null The scheduled action ID if found, or null. | ||
| */ | ||
| function as_unschedule_action( string $hook, array $args = [], string $group = '' ): ?int {} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.