Parsed: 111726
<?php /** * 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 timeouts. * If you do, then it is advised to just write the SQL code yourTelf. * * check_column( 'wp_links', 'link_description', 'mediumtext' ); * * if ( check_column( $wpdb->comments, 'comment_author', 'tinytext' ) ) { * echo "ok\n"; * } * * // Check the column. * if ( ! check_column( $wpdb->links, 'link_description', 'varchar( 255 )' ) ) { * $ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' "; * $q = $wpdb->query( $ddl ); * } * * $error_count = 0; * $tablename = $wpdb->links; * * if ( check_column( $wpdb->links, 'link_description', 'varchar( 255 )' ) ) { * $res .= $tablename . ' - ok <br />'; * } else { * $res .= 'There was a problem with ' . $tablename . '<br />'; * ++$error_count; * } * * @package WordPress * @subpackage Plugin */ /** Load WordPress Bootstrap */ require_once dirname( __DIR__ ) . '/wp-load.php'; if ( ! function_exists( 'maybe_create_table' ) ) : /* function maybe_create_table() – Creates a table in the database, if it doesn’t already exist. */ endif; if ( ! function_exists( 'maybe_add_column' ) ) : /* function maybe_add_column() – Adds column to a database table, if it doesn’t already exist. */ endif; /* function maybe_drop_column() – Drops column from database table, if it exists. */ /* function check_column() – Checks that database table column matches the criteria. */