[ Index ]

WordPress 5.4.1

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    




/wp-admin/ -> install-helper.php (summary)

Plugins may load this file to gain access to special helper functions for plugin installation. This file is not included by WordPress and it is recommended, to prevent fatal errors, that this file is included using require_once. These functions are not optimized for speed, but they should only be used once in a while, so speed shouldn't be a concern. If it is and you are needing to use these functions a lot, you might experience time outs. If you do, then it is advised to just write the SQL code yourself.

File Size: 200 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 4 functions


Functions that are not part of a class:

maybe_create_table( $table_name, $create_ddl )   X-Ref
Create database table, if it doesn't already exist.

param: string $table_name Database table name.
param: string $create_ddl Create database table SQL.
return: bool False on error, true if already exists or success.

maybe_add_column( $table_name, $column_name, $create_ddl )   X-Ref
Add column to database table, if column doesn't already exist in table.

param: string $table_name Database table name
param: string $column_name Table column name
param: string $create_ddl SQL to add column to table.
return: bool False on failure. True, if already exists or was successful.

maybe_drop_column( $table_name, $column_name, $drop_ddl )   X-Ref
Drop column from database table, if it exists.

param: string $table_name Table name
param: string $column_name Column name
param: string $drop_ddl SQL statement to drop column.
return: bool True on success or if the column doesn't exist, false on failure.

check_column( $table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null )   X-Ref
Check column matches criteria.

Uses the SQL DESC for retrieving the table info for the column. It will help
understand the parameters, if you do more research on what column information
is returned by the SQL statement. Pass in null to skip checking that

Column names returned from DESC table are case sensitive and are listed:

param: string $table_name Table name
param: string $col_name   Column name
param: string $col_type   Column type
param: bool   $is_null    Optional. Check is null.
param: mixed  $key        Optional. Key info.
param: mixed  $default    Optional. Default value.
param: mixed  $extra      Optional. Extra value.
return: bool True, if matches. False, if not matching.

Generated: Tue May 19 15:51:04 2020 Cross-referenced by PHPXref 0.7.1