feat: clean up own data on deactivation and uninstall
Deactivation now clears the endpoint-check transient and the cached rewrite rules (forcing WordPress to regenerate them without this plugin's routes on the next request) and activation asks mcp-oauth to re-flush its own rules. uninstall.php removes all own options/transient/cron/table across every site of a network, delegating to the new self-contained LIT\MCP\Uninstaller class so it works without the plugin's autoloader and is unit-testable on its own. mcp-oauth's data (JWT secret, rewrite marker, refresh-token meta, application passwords) is left untouched, as is every post/attachment/revision. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
@@ -16,20 +16,23 @@ final class LifecycleTest extends TestCase
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public function testActivateInstallsTheTableAndSchedulesTheCleanup(): void
|
||||
public function testActivateInstallsTableSchedulesCleanupAndRequestsOauthRewriteFlush(): void
|
||||
{
|
||||
$GLOBALS['wpdb'] = Mockery::mock(\wpdb::class)->makePartial();
|
||||
Functions\expect('dbDelta')->once();
|
||||
Functions\expect('update_option')->once()->with('lit_mcp_db_version', '1');
|
||||
Functions\when('wp_next_scheduled')->justReturn(false);
|
||||
Functions\expect('wp_schedule_event')->once();
|
||||
Functions\expect('delete_option')->once()->with('wpmedia_mcp_oauth_rewrite_version');
|
||||
|
||||
Lifecycle::activate();
|
||||
}
|
||||
|
||||
public function testDeactivateUnschedulesTheCleanup(): void
|
||||
public function testDeactivateRemovesCronTransientAndStoredRewriteRules(): void
|
||||
{
|
||||
Functions\expect('wp_clear_scheduled_hook')->once()->with('lit_mcp_log_cleanup');
|
||||
Functions\expect('delete_transient')->once()->with('lit_mcp_endpoint_check');
|
||||
Functions\expect('delete_option')->once()->with('rewrite_rules');
|
||||
|
||||
Lifecycle::deactivate();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user