| @@ -56,9 +56,9 @@ | ||
| 56 | 56 | * - 6: the Trash stopped registering a desktop icon. Removes the |
| 57 | 57 | * placement the shell had auto-placed for it and closes the hole that |
| 58 | 58 | * leaves in the icon column. |
| 59 | 59 | */ |
| 60 | -const OPENSTATION_MIGRATION_VERSION = 7; | |
| 60 | +const OPENSTATION_MIGRATION_VERSION = 8; | |
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * Option storing the highest migration version that has run. autoload=no. |
| 64 | 64 | * |
| @@ -160,8 +160,12 @@ | ||
| 160 | 160 | |
| 161 | 161 | if ( $from < 7 ) { |
| 162 | 162 | openstation_migrate_seed_agent_faces(); |
| 163 | 163 | } |
| 164 | + | |
| 165 | + if ( $from < 8 ) { | |
| 166 | + openstation_migrate_remove_comments_ai(); | |
| 167 | + } | |
| 164 | 168 | } |
| 165 | 169 | |
| 166 | 170 | /** |
| 167 | 171 | * Migration 7 — give the agents that predate faces a seed to grow one |
| @@ -353,9 +357,9 @@ | ||
| 353 | 357 | array_merge( |
| 354 | 358 | get_users( |
| 355 | 359 | array( |
| 356 | 360 | 'fields' => 'ID', |
| 357 | - 'meta_key' => 'desktop_mode_mode', // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key -- runs once per install; the key is indexed in usermeta and both callers are guarded to a single pass. | |
| 361 | + 'meta_key' => 'desktop_mode_mode', // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key -- the key is indexed in usermeta; the migration callers run once per install, and the deactivation feedback route once per admin submission. | |
| 358 | 362 | 'meta_compare' => 'EXISTS', |
| 359 | 363 | ) |
| 360 | 364 | ), |
| 361 | 365 | get_users( |
| @@ -614,8 +618,33 @@ | ||
| 614 | 618 | wp_unschedule_hook( 'desktop_mode_ai_analyze_term' ); |
| 615 | 619 | } |
| 616 | 620 | |
| 617 | 621 | /** |
| 622 | + * Migration 8 — retire the "Score new comments with AI" feature. | |
| 623 | + * | |
| 624 | + * Automatic AI scoring of incoming comments was removed: nothing | |
| 625 | + * schedules `desktop_mode_ai_analyze_comment` any more, and the | |
| 626 | + * `desktop_mode_comments_ai_moderation` option no longer gates | |
| 627 | + * anything. Queued single-events would simply no-op, but we clear | |
| 628 | + * them so the cron array stays tidy and `wp cron event list` doesn't | |
| 629 | + * show an orphaned hook. | |
| 630 | + * | |
| 631 | + * The option row is dropped too — unlike a frozen identifier that | |
| 632 | + * still has a reader, this one has none left, so leaving it would | |
| 633 | + * only strand a value no code consults. | |
| 634 | + * | |
| 635 | + * Existing `_desktop_mode_ai_analysis` comment meta is left in place | |
| 636 | + * (hidden, harmless, and still what the on-demand | |
| 637 | + * `desktop-mode/analyze-comment` ability writes). | |
| 638 | + * | |
| 639 | + * @return void | |
| 640 | + */ | |
| 641 | +function openstation_migrate_remove_comments_ai() { | |
| 642 | + wp_unschedule_hook( 'desktop_mode_ai_analyze_comment' ); | |
| 643 | + delete_option( 'desktop_mode_comments_ai_moderation' ); | |
| 644 | +} | |
| 645 | + | |
| 646 | +/** | |
| 618 | 647 | * Migration 3 — delete self-managed AI credentials. |
| 619 | 648 | * |
| 620 | 649 | * WordPress 7.0 owns provider credentials (Settings → Connectors), so the |
| 621 | 650 | * copilot no longer stores keys of its own. Remove the platform key option and |
| @@ -661,4 +690,7 @@ | ||
| 661 | 690 | |
| 662 | 691 | openstation_save_os_settings( (int) $user_id, $raw ); |
| 663 | 692 | } |
| 664 | 693 | } |
| 694 | + | |
| 695 | +// Presence owns a verified checkpoint so failures never advance unrelated migrations. | |
| 696 | +add_action( 'admin_init', 'openstation_presence_migration_tick', 20 ); | |