| @@ -1,5 +1,15 @@ | ||
| 1 | -<?php | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Plugin activation handler. | |
| 4 | + * | |
| 5 | + * Defines Mlsimport_Activator, whose static activate() runs on plugin activation | |
| 6 | + * (registered via register_activation_hook in mlsimport.php). It clears the cached | |
| 7 | + * plugin data schema transient and creates the plugin's activity tracking table. | |
| 8 | + * | |
| 9 | + * @package MLSImport | |
| 10 | + */ | |
| 11 | +// Abort if the file is accessed directly outside of WordPress. | |
| 2 | 12 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | 13 | exit; // Exit if accessed directly |
| 4 | 14 | } |
| 5 | 15 | |
| @@ -31,10 +41,17 @@ | ||
| 31 | 41 | * Short Description. (use period) |
| 32 | 42 | * |
| 33 | 43 | * Long Description. |
| 34 | 44 | * |
| 45 | + * Runs once on plugin activation: clears the cached plugin-data schema transient | |
| 46 | + * and ensures the activity tracking table exists. | |
| 47 | + * | |
| 35 | 48 | * @since 1.0.0 |
| 49 | + * @return void | |
| 36 | 50 | */ |
| 37 | 51 | public static function activate() { |
| 52 | + // Drop any stale cached schema so it is rebuilt fresh. | |
| 38 | 53 | delete_transient( 'mlsimport_plugin_data_schema' ); |
| 54 | + // Create (or update) the activity tracking table. | |
| 55 | + mlsimport_create_activity_table(); | |
| 39 | 56 | } |
| 40 | 57 | } |