PR Vision v0.1.1: rename from peptide-geo-monitor + P2 fixes
- Exhaustive rename: PGM_ -> PRV_, pgm_ -> prv_, text domain and slug peptide-geo-monitor -> pr-vision, admin menu GEO Monitor -> PR Vision, main file peptide-geo-monitor.php -> pr-vision.php, DB table pgm_ai_visibility -> prv_ai_visibility. - P2-A: replace ltrim($host,'www.') character-mask with str_starts_with/substr prefix strip in PRV_Citation_Detector. Adds test coverage for wikipedia.org, webmd.com survival. - P2-B: drop continue-on-error: true from PHPCS CI step; WordPress Coding Standards now gates the build. - P2-C: remove dead in-run cache from PRV_Probe_Runner::run(); each (peptide, intent, model) triplet is visited once per run, cache hit is structurally impossible. - Version bump 0.1.0 -> 0.1.1 + CHANGELOG [0.1.1] entry. Agent-Session: pr-vision rename v0.1.1
This commit is contained in:
82
includes/core/class-prv-cron.php
Normal file
82
includes/core/class-prv-cron.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* WP-Cron management for the weekly AI-visibility probe.
|
||||
*
|
||||
* Registers the prv_weekly_probe hook, schedules/clears the event, and
|
||||
* dispatches to PRV_Probe_Runner on each tick.
|
||||
*
|
||||
* Who triggers: PRV_Plugin::init() (hook registration), PRV_Activator
|
||||
* (schedule), PRV_Deactivator (clear).
|
||||
* Dependencies: PRV_Probe_Runner.
|
||||
*
|
||||
* @see class-prv-probe-runner.php — Runner invoked on each cron tick.
|
||||
* @see class-prv-activator.php — Calls schedule_weekly() on activation.
|
||||
* @package PrVision
|
||||
*/
|
||||
class PRV_Cron {
|
||||
|
||||
/**
|
||||
* Register WordPress action hooks.
|
||||
*
|
||||
* Side effects: Adds action for PRV_CRON_HOOK.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks(): void {
|
||||
add_action( PRV_CRON_HOOK, array( $this, 'handle_cron_tick' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback fired by WP-Cron on the weekly schedule.
|
||||
*
|
||||
* Side effects: Instantiates and runs PRV_Probe_Runner.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle_cron_tick(): void {
|
||||
$runner = new PRV_Probe_Runner();
|
||||
$runner->run();
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedule the weekly cron event if not already scheduled.
|
||||
*
|
||||
* Safe to call on re-activation — no-op when already scheduled.
|
||||
*
|
||||
* Side effects: Adds a WP-Cron event.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function schedule_weekly(): void {
|
||||
if ( ! wp_next_scheduled( PRV_CRON_HOOK ) ) {
|
||||
wp_schedule_event( time(), 'weekly', PRV_CRON_HOOK );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the weekly cron schedule.
|
||||
*
|
||||
* Called on deactivation. Does not purge data.
|
||||
*
|
||||
* Side effects: Removes the WP-Cron event.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function clear_schedule(): void {
|
||||
$timestamp = wp_next_scheduled( PRV_CRON_HOOK );
|
||||
if ( false !== $timestamp ) {
|
||||
wp_unschedule_event( $timestamp, PRV_CRON_HOOK );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the weekly event is currently scheduled.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function is_scheduled(): bool {
|
||||
return false !== wp_next_scheduled( PRV_CRON_HOOK );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user