mirror of
https://gh.wpcy.net/https://github.com/CaptainCore/captaincore-manager.git
synced 2026-04-22 09:22:16 +08:00
51 lines
1 KiB
PHP
Executable file
51 lines
1 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() {
|
|
wp_schedule_event( time(), 'hourly', 'captaincore_cron' );
|
|
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' );
|
|
}
|
|
|
|
|
|
|
|
}
|