mirror of
https://gh.llkk.cc/https://github.com/CaptainCore/captaincore-manager.git
synced 2026-07-28 21:31:22 +08:00
54 lines
1.2 KiB
PHP
Executable file
54 lines
1.2 KiB
PHP
Executable file
<?php
|
|
|
|
/**
|
|
* Fired during plugin activation
|
|
*
|
|
* @link https://captaincore.io
|
|
* @since 0.1.0
|
|
*
|
|
* @package Captaincore
|
|
* @subpackage Captaincore/includes
|
|
*/
|
|
|
|
/**
|
|
* Fired during plugin activation.
|
|
*
|
|
* This class defines all code necessary to run during the plugin's activation.
|
|
*
|
|
* @since 0.1.0
|
|
* @package Captaincore
|
|
* @subpackage Captaincore/includes
|
|
* @author Austin Ginder
|
|
*/
|
|
class Captaincore_Activator {
|
|
|
|
/**
|
|
* Short Description. (use period)
|
|
*
|
|
* Long Description.
|
|
*
|
|
* @since 0.1.0
|
|
*/
|
|
public static function activate() {
|
|
// NOTE: Renewal/billing processing has been moved to a real system crontab
|
|
// (see captaincore_cron_run() below) to give it a single deterministic trigger
|
|
// and avoid traffic-dependent WP-Cron timing + concurrent-run races. Do NOT
|
|
// re-add wp_schedule_event( ..., 'captaincore_cron' ) here.
|
|
CaptainCore\DB::upgrade();
|
|
// Add the rewrite rules first
|
|
( new CaptainCore\Router() )->add_rewrite_rules();
|
|
|
|
// Then flush them
|
|
flush_rewrite_rules();
|
|
function captaincore_activation_redirect() {
|
|
if( ! defined( 'WP_CLI' ) ) {
|
|
wp_safe_redirect( '/account' );
|
|
exit;
|
|
}
|
|
}
|
|
add_action( 'activated_plugin', 'captaincore_activation_redirect' );
|
|
}
|
|
|
|
|
|
|
|
}
|