[ Index ]

WordPress Cross Reference

title

Body

[close]

/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: 198 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 4 functions

  maybe_create_table()
  maybe_add_column()
  maybe_drop_column()
  check_column()

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 False on failure, true on success or doesn't exist.

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
criteria.

Column names returned from DESC table are case sensitive and are listed:
Field
Type
Null
Key
Default
Extra

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 Mar 25 01:41:18 2014 WordPress honlapkészítés: online1.hu