Docs: Fix typo and improve DocBlock formatting in `wp-admin/install-helper.php`.
Follow-up to [236], [265], [8645], [30542]. See #56792. Built from https://develop.svn.wordpress.org/trunk@54859 git-svn-id: http://core.svn.wordpress.org/trunk@54411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f299e3c83a
commit
f3b087164d
|
@ -1,28 +1,30 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Plugins may load this file to gain access to special helper functions for
|
* Plugins may load this file to gain access to special helper functions
|
||||||
* plugin installation. This file is not included by WordPress and it is
|
* for plugin installation. This file is not included by WordPress and it is
|
||||||
* recommended, to prevent fatal errors, that this file is included using
|
* recommended, to prevent fatal errors, that this file is included using
|
||||||
* require_once.
|
* require_once.
|
||||||
*
|
*
|
||||||
* These functions are not optimized for speed, but they should only be used
|
* 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
|
* 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
|
* needing to use these functions a lot, you might experience timeouts.
|
||||||
* do, then it is advised to just write the SQL code yourself.
|
* If you do, then it is advised to just write the SQL code yourself.
|
||||||
*
|
*
|
||||||
* check_column( 'wp_links', 'link_description', 'mediumtext' );
|
* check_column( 'wp_links', 'link_description', 'mediumtext' );
|
||||||
|
*
|
||||||
* if ( check_column( $wpdb->comments, 'comment_author', 'tinytext' ) ) {
|
* if ( check_column( $wpdb->comments, 'comment_author', 'tinytext' ) ) {
|
||||||
* echo "ok\n";
|
* echo "ok\n";
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* $error_count = 0;
|
|
||||||
* $tablename = $wpdb->links;
|
|
||||||
* // Check the column.
|
* // Check the column.
|
||||||
* if ( ! check_column( $wpdb->links, 'link_description', 'varchar( 255 )' ) ) {
|
* if ( ! check_column( $wpdb->links, 'link_description', 'varchar( 255 )' ) ) {
|
||||||
* $ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
|
* $ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
|
||||||
* $q = $wpdb->query( $ddl );
|
* $q = $wpdb->query( $ddl );
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
|
* $error_count = 0;
|
||||||
|
* $tablename = $wpdb->links;
|
||||||
|
*
|
||||||
* if ( check_column( $wpdb->links, 'link_description', 'varchar( 255 )' ) ) {
|
* if ( check_column( $wpdb->links, 'link_description', 'varchar( 255 )' ) ) {
|
||||||
* $res .= $tablename . ' - ok <br />';
|
* $res .= $tablename . ' - ok <br />';
|
||||||
* } else {
|
* } else {
|
||||||
|
@ -62,7 +64,7 @@ if ( ! function_exists( 'maybe_create_table' ) ) :
|
||||||
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
|
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
|
||||||
$wpdb->query( $create_ddl );
|
$wpdb->query( $create_ddl );
|
||||||
|
|
||||||
// We cannot directly tell that whether this succeeded!
|
// We cannot directly tell whether this succeeded!
|
||||||
foreach ( $wpdb->get_col( 'SHOW TABLES', 0 ) as $table ) {
|
foreach ( $wpdb->get_col( 'SHOW TABLES', 0 ) as $table ) {
|
||||||
if ( $table === $table_name ) {
|
if ( $table === $table_name ) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -100,7 +102,7 @@ if ( ! function_exists( 'maybe_add_column' ) ) :
|
||||||
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
|
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
|
||||||
$wpdb->query( $create_ddl );
|
$wpdb->query( $create_ddl );
|
||||||
|
|
||||||
// We cannot directly tell that whether this succeeded!
|
// We cannot directly tell whether this succeeded!
|
||||||
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
|
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
|
||||||
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
|
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
|
||||||
if ( $column === $column_name ) {
|
if ( $column === $column_name ) {
|
||||||
|
@ -135,7 +137,7 @@ function maybe_drop_column( $table_name, $column_name, $drop_ddl ) {
|
||||||
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
|
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
|
||||||
$wpdb->query( $drop_ddl );
|
$wpdb->query( $drop_ddl );
|
||||||
|
|
||||||
// We cannot directly tell that whether this succeeded!
|
// We cannot directly tell whether this succeeded!
|
||||||
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
|
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
|
||||||
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
|
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
|
||||||
if ( $column === $column_name ) {
|
if ( $column === $column_name ) {
|
||||||
|
@ -154,16 +156,16 @@ function maybe_drop_column( $table_name, $column_name, $drop_ddl ) {
|
||||||
*
|
*
|
||||||
* Uses the SQL DESC for retrieving the table info for the column. It will help
|
* 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
|
* 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
|
* is returned by the SQL statement. Pass in null to skip checking that criteria.
|
||||||
* criteria.
|
|
||||||
*
|
*
|
||||||
* Column names returned from DESC table are case sensitive and are listed:
|
* Column names returned from DESC table are case sensitive and are as listed:
|
||||||
* Field
|
*
|
||||||
* Type
|
* - Field
|
||||||
* Null
|
* - Type
|
||||||
* Key
|
* - Null
|
||||||
* Default
|
* - Key
|
||||||
* Extra
|
* - Default
|
||||||
|
* - Extra
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*
|
*
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.2-alpha-54858';
|
$wp_version = '6.2-alpha-54859';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue