Activator
Handles plugin activation and creation of the Top 10 database tables.
Namespace: WebberZone\Top_Ten\Admin
Since: 3.3.0
Source: includes/admin/class-activator.php line 23
Methods
__construct()
Constructor class.
Since: 3.3.0
Line: 62
public function __construct( );
activation_hook() static
Fired when the plugin is Network Activated.
Since: 1.9.10.1
Line: 77
static public function activation_hook( $network_wide );
| Type | Name | Description |
|---|---|---|
boolean |
$network_wide |
True if WPMU superadmin uses |
single_activate() static
Fired for each blog when the plugin is activated.
Since: 2.0.0
Line: 107
static public function single_activate( );
is_table_installed() static
Check if the Top Ten table is installed.
Since: 4.1.0
Line: 158
static public function is_table_installed( $table_name ): bool;
| Type | Name | Description |
|---|---|---|
string |
$table_name |
Table name. |
Returns: bool — True if the table exists, false otherwise.
maybe_create_table() static
Create table if not exists.
Since: 4.1.0
Line: 170
static public function maybe_create_table( $table_name, $sql );
| Type | Name | Description |
|---|---|---|
string |
$table_name |
Table name. |
string |
$sql |
SQL to create the table. |
create_tables() static
Create tables.
Since: 4.1.0
Line: 187
static public function create_tables( );
create_full_table_sql() static
Create full table sql.
Since: 4.1.0
Line: 209
static public function create_full_table_sql( ): string;
Returns: string — SQL to create the full table.
create_daily_table_sql() static
Create full daily table sql.
Since: 4.1.0
Line: 220
static public function create_daily_table_sql( ): string;
Returns: string — SQL to create the daily table.
recreate_table() static
Recreate a table.
This method recreates a table by creating a backup, dropping the original table, and then creating a new table with the original name and inserting the data from the backup.
Since: 4.1.0
Line: 240
static public function recreate_table( $table_name, $create_table_sql, $backup = ..., $fields = ..., $group_by_fields = ... ): bool|\WP_Error;
| Type | Name | Description |
|---|---|---|
string |
$table_name |
The name of the table to recreate. |
string |
$create_table_sql |
The SQL statement to create the new table. |
bool |
$backup |
Whether to backup the table or not. |
array |
$fields |
The fields to include in the temporary table and on duplicate key code. |
array |
$group_by_fields |
The fields to group by in the temporary table. |
Returns: bool|\WP_Error — True if recreated, error message if failed.
recreate_overall_table() static
Recreate overall table.
Since: 4.1.0
Line: 259
static public function recreate_overall_table( $backup = ... ): bool|\WP_Error;
| Type | Name | Description |
|---|---|---|
bool |
$backup |
Whether to backup the table or not. |
Returns: bool|\WP_Error — True if recreated, error message if failed.
recreate_daily_table() static
Recreate daily table.
Since: 4.1.0
Line: 272
static public function recreate_daily_table( $backup = ... ): bool|\WP_Error;
| Type | Name | Description |
|---|---|---|
bool |
$backup |
Whether to backup the table or not. |
Returns: bool|\WP_Error — True if recreated, error message if failed.
activate_new_site() static
Fired when a new site is activated with a WPMU environment.
Since: 2.0.0
Line: 283
static public function activate_new_site( $blog );
| Type | Name | Description |
|---|---|---|
int|\WP_Site |
$blog |
WordPress 5.1 passes a WP_Site object. |
deactivation_hook() static
Fired when the plugin is deactivated.
Since: 4.3.0
Line: 306
static public function deactivation_hook( $network_wide );
| Type | Name | Description |
|---|---|---|
bool |
$network_wide |
True if WPMU superadmin uses “Network Deactivate” action, false otherwise. |
single_deactivate() static
Fired for each blog when the plugin is deactivated.
Since: 4.3.0
Line: 331
static public function single_deactivate( );
update_db_check() static
Check and update database version.
Since: 3.3.0
Line: 344
static public function update_db_check( );
is_all_tables_installed() static
Check if all required tables are installed.
Since: 4.1.0
Line: 359
static public function is_all_tables_installed( ): bool;
Returns: bool — True if all tables are installed, false if any are missing.