redirect-redirection
Last commit date
analyst
1 year ago
assets
1 year ago
includes
1 year ago
modules
1 year ago
activation.php
1 year ago
deactivation.php
1 year ago
index.html
1 year ago
readme.txt
1 year ago
redirect-redirection.php
1 year ago
uninstall.php
1 year ago
activation.php
44 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This file is loaded only on plugin's activation |
| 5 | */ |
| 6 | if (!defined("ABSPATH")) { |
| 7 | exit(); |
| 8 | } |
| 9 | |
| 10 | /** |
| 11 | * Load contants and database manager |
| 12 | */ |
| 13 | include_once "includes/irrp-constants.php"; |
| 14 | include_once "includes/irrp-db-manager.php"; |
| 15 | |
| 16 | /** |
| 17 | * Make new database manager and try to create DB tables if does not exist |
| 18 | */ |
| 19 | $iRdbManager = new IRRPDBManager(); |
| 20 | $iRdbManager->createTables(is_multisite()); |
| 21 | |
| 22 | /** |
| 23 | * Mark activation option |
| 24 | */ |
| 25 | update_option('irrp_activation_redirect', true); |
| 26 | if (!defined('IRRP_ACTIVATION_REQUEST')) { |
| 27 | define('IRRP_ACTIVATION_REQUEST', true); |
| 28 | } |
| 29 | |
| 30 | //add_filter("cron_schedules", "irrpSetIntervals"); |
| 31 | |
| 32 | function irrpSetIntervals($schedules) { |
| 33 | $schedules[IRRP_CRON_DELETE_LOGS_RECURRENCE_KEY] = [ |
| 34 | "interval" => IRRP_CRON_DELETE_LOGS_RECURRENCE, |
| 35 | "display" => esc_html__("Every 15 minutes", "redirect-redirection") |
| 36 | ]; |
| 37 | return $schedules; |
| 38 | } |
| 39 | |
| 40 | if (!wp_next_scheduled(IRRP_CRON_DELETE_LOGS)) { |
| 41 | //wp_schedule_event(current_time("timestamp", 1), IRRP_CRON_DELETE_LOGS_RECURRENCE_KEY, IRRP_CRON_DELETE_LOGS); |
| 42 | wp_schedule_event(current_time("timestamp", 1), "twicedaily", IRRP_CRON_DELETE_LOGS); |
| 43 | } |
| 44 |