Server: appserver-7f0f8755-nginx-15961cad18524ec5a9db05f2a6a7e440
Current directory: /code/wp-admin
Software: nginx/1.27.5
Shell Command
Create a new file
Upload file
File: install-helper.php
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
'; * } else { * $res .= 'There was a problem with ' . $tablename . '
'; * ++$error_count; * } * * @package WordPress * @subpackage Plugin */ /** Load WordPress Bootstrap */ require_once dirname( __DIR__ ) . '/wp-load.php'; if ( ! function_exists( 'maybe_create_table' ) ) : /** * Creates a table in the database if it doesn't already exist. * * @since 1.0.0 * * @global wpdb $wpdb WordPress database abstraction object. * * @param string $table_name Database table name. * @param string $create_ddl SQL statement to create table. * @return bool True on success or if the table already exists. False on failure. */ function maybe_create_table( $table_name, $create_ddl ) { global $wpdb; foreach ( $wpdb->get_col( 'SHOW TABLES', 0 ) as $table ) { if ( $table === $table_name ) { return true; } } // Didn't find it, so try to create it. // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query. $wpdb->query( $create_ddl ); // We cannot directly tell whether this succeeded! foreach ( $wpdb->get_col( 'SHOW TABLES', 0 ) as $table ) { if ( $table === $table_name ) { return true; } } return false; } endif; if ( ! function_exists( 'maybe_add_column' ) ) : /** * Adds column to database table, if it doesn't already exist. * * @since 1.0.0 * * @global wpdb $wpdb WordPress database abstraction object. * * @param string $table_name Database table name. * @param string $column_name Table column name. * @param string $create_ddl SQL statement to add column. * @return bool True on success or if the column already exists. False on failure. */ function maybe_add_column( $table_name, $column_name, $create_ddl ) { global $wpdb; // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names. foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) { if ( $column === $column_name ) { return true; } } // Didn't find it, so try to create it. // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query. $wpdb->query( $create_ddl ); // We cannot directly tell whether this succeeded! // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names. foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) { if ( $column === $column_name ) { return true; } } return false; } endif; /** * Drops column from database table, if it exists. * * @since 1.0.0 * * @global wpdb $wpdb WordPress database abstraction object. * * @param string $table_name Database table name. * @param string $column_name Table 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. */ function maybe_drop_column( $table_name, $column_name, $drop_ddl ) { global $wpdb; // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names. foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) { if ( $column === $column_name ) { // Found it, so try to drop it. // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query. $wpdb->query( $drop_ddl ); // We cannot directly tell whether this succeeded! // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names. foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) { if ( $column === $column_name ) { return false; } } } } // Else didn't find it. return true; } /** * Checks that database table column matches the 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 as listed: * * - Field * - Type * - Null * - Key * - Default * - Extra * * @since 1.0.0 * * @global wpdb $wpdb WordPress database abstraction object. * * @param string $table_name Database table name. * @param string $col_name Table column name. * @param string $col_type Table column type. * @param bool $is_null Optional. Check is null. * @param mixed $key Optional. Key info. * @param mixed $default_value Optional. Default value. * @param mixed $extra Optional. Extra value. * @return bool True, if matches. False, if not matching. */ function check_column( $table_name, $col_name, $col_type, $is_null = null, $key = null, $default_value = null, $extra = null ) { global $wpdb; $diffs = 0; // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names. $results = $wpdb->get_results( "DESC $table_name" ); foreach ( $results as $row ) { if ( $row->Field === $col_name ) { // Got our column, check the params. if ( ( null !== $col_type ) && ( $row->Type !== $col_type ) ) { ++$diffs; } if ( ( null !== $is_null ) && ( $row->Null !== $is_null ) ) { ++$diffs; } if ( ( null !== $key ) && ( $row->Key !== $key ) ) { ++$diffs; } if ( ( null !== $default_value ) && ( $row->Default !== $default_value ) ) { ++$diffs; } if ( ( null !== $extra ) && ( $row->Extra !== $extra ) ) { ++$diffs; } if ( $diffs > 0 ) { return false; } return true; } // End if found our column. } return false; }
.
100 Items
Change directory
Remove directory
Rename directory
..
27 Items
Change directory
Remove directory
Rename directory
about.php
16.64 KB
Edit
Delete
Copy
Move
Remame
admin-ajax.php
5.03 KB
Edit
Delete
Copy
Move
Remame
admin-footer.php
2.76 KB
Edit
Delete
Copy
Move
Remame
admin-functions.php
0.4 KB
Edit
Delete
Copy
Move
Remame
admin-header.php
8.87 KB
Edit
Delete
Copy
Move
Remame
admin-post.php
2.02 KB
Edit
Delete
Copy
Move
Remame
admin.php
12.26 KB
Edit
Delete
Copy
Move
Remame
async-upload.php
4.71 KB
Edit
Delete
Copy
Move
Remame
authorize-application.php
10.09 KB
Edit
Delete
Copy
Move
Remame
comment.php
11.35 KB
Edit
Delete
Copy
Move
Remame
contribute.php
5.59 KB
Edit
Delete
Copy
Move
Remame
credits.php
3.75 KB
Edit
Delete
Copy
Move
Remame
css
101 Items
Change directory
Remove directory
Rename directory
custom-background.php
0.41 KB
Edit
Delete
Copy
Move
Remame
custom-header.php
0.42 KB
Edit
Delete
Copy
Move
Remame
customize.php
10.87 KB
Edit
Delete
Copy
Move
Remame
edit-comments.php
14.38 KB
Edit
Delete
Copy
Move
Remame
edit-form-advanced.php
28.73 KB
Edit
Delete
Copy
Move
Remame
edit-form-blocks.php
12.05 KB
Edit
Delete
Copy
Move
Remame
edit-form-comment.php
8.34 KB
Edit
Delete
Copy
Move
Remame
edit-link-form.php
6.21 KB
Edit
Delete
Copy
Move
Remame
edit-tag-form.php
10.43 KB
Edit
Delete
Copy
Move
Remame
edit-tags.php
21.93 KB
Edit
Delete
Copy
Move
Remame
edit.php
19.48 KB
Edit
Delete
Copy
Move
Remame
erase-personal-data.php
7.33 KB
Edit
Delete
Copy
Move
Remame
export-personal-data.php
7.75 KB
Edit
Delete
Copy
Move
Remame
export.php
11.02 KB
Edit
Delete
Copy
Move
Remame
freedoms.php
4.5 KB
Edit
Delete
Copy
Move
Remame
images
78 Items
Change directory
Remove directory
Rename directory
import.php
7.48 KB
Edit
Delete
Copy
Move
Remame
includes
106 Items
Change directory
Remove directory
Rename directory
index.php
7.68 KB
Edit
Delete
Copy
Move
Remame
install-helper.php
6.8 KB
Edit
Delete
Copy
Move
Remame
install.php
17.08 KB
Edit
Delete
Copy
Move
Remame
js
98 Items
Change directory
Remove directory
Rename directory
link-add.php
0.92 KB
Edit
Delete
Copy
Move
Remame
link-manager.php
4.26 KB
Edit
Delete
Copy
Move
Remame
link-parse-opml.php
2.63 KB
Edit
Delete
Copy
Move
Remame
link.php
2.89 KB
Edit
Delete
Copy
Move
Remame
load-scripts.php
2.22 KB
Edit
Delete
Copy
Move
Remame
load-styles.php
3.12 KB
Edit
Delete
Copy
Move
Remame
maint
1 Items
Change directory
Remove directory
Rename directory
media-new.php
3.18 KB
Edit
Delete
Copy
Move
Remame
media-upload.php
3.49 KB
Edit
Delete
Copy
Move
Remame
media.php
0.8 KB
Edit
Delete
Copy
Move
Remame
menu-header.php
9.83 KB
Edit
Delete
Copy
Move
Remame
menu.php
16.67 KB
Edit
Delete
Copy
Move
Remame
moderation.php
0.3 KB
Edit
Delete
Copy
Move
Remame
ms-admin.php
0.19 KB
Edit
Delete
Copy
Move
Remame
ms-delete-site.php
4.19 KB
Edit
Delete
Copy
Move
Remame
ms-edit.php
0.21 KB
Edit
Delete
Copy
Move
Remame
ms-options.php
0.22 KB
Edit
Delete
Copy
Move
Remame
ms-sites.php
0.21 KB
Edit
Delete
Copy
Move
Remame
ms-themes.php
0.21 KB
Edit
Delete
Copy
Move
Remame
ms-upgrade-network.php
0.21 KB
Edit
Delete
Copy
Move
Remame
ms-users.php
0.21 KB
Edit
Delete
Copy
Move
Remame
my-sites.php
4.74 KB
Edit
Delete
Copy
Move
Remame
nav-menus.php
48.01 KB
Edit
Delete
Copy
Move
Remame
network
30 Items
Change directory
Remove directory
Rename directory
network.php
5.39 KB
Edit
Delete
Copy
Move
Remame
options-discussion.php
15.58 KB
Edit
Delete
Copy
Move
Remame
options-general.php
20.74 KB
Edit
Delete
Copy
Move
Remame
options-head.php
0.54 KB
Edit
Delete
Copy
Move
Remame
options-media.php
6.35 KB
Edit
Delete
Copy
Move
Remame
options-permalink.php
21.21 KB
Edit
Delete
Copy
Move
Remame
options-privacy.php
9.95 KB
Edit
Delete
Copy
Move
Remame
options-reading.php
10.03 KB
Edit
Delete
Copy
Move
Remame
options-writing.php
9.1 KB
Edit
Delete
Copy
Move
Remame
options.php
13.54 KB
Edit
Delete
Copy
Move
Remame
plugin-editor.php
13.42 KB
Edit
Delete
Copy
Move
Remame
plugin-install.php
6.96 KB
Edit
Delete
Copy
Move
Remame
plugins.php
29.13 KB
Edit
Delete
Copy
Move
Remame
post-new.php
2.7 KB
Edit
Delete
Copy
Move
Remame
post.php
9.97 KB
Edit
Delete
Copy
Move
Remame
press-this.php
2.34 KB
Edit
Delete
Copy
Move
Remame
privacy-policy-guide.php
3.67 KB
Edit
Delete
Copy
Move
Remame
privacy.php
2.48 KB
Edit
Delete
Copy
Move
Remame
profile.php
0.28 KB
Edit
Delete
Copy
Move
Remame
revision.php
5.71 KB
Edit
Delete
Copy
Move
Remame
setup-config.php
17.46 KB
Edit
Delete
Copy
Move
Remame
site-editor.php
6.26 KB
Edit
Delete
Copy
Move
Remame
site-health-info.php
3.99 KB
Edit
Delete
Copy
Move
Remame
site-health.php
10.2 KB
Edit
Delete
Copy
Move
Remame
term.php
2.2 KB
Edit
Delete
Copy
Move
Remame
theme-editor.php
15.42 KB
Edit
Delete
Copy
Move
Remame
theme-install.php
23.34 KB
Edit
Delete
Copy
Move
Remame
themes.php
46.96 KB
Edit
Delete
Copy
Move
Remame
tools.php
3.43 KB
Edit
Delete
Copy
Move
Remame
update-core.php
45.42 KB
Edit
Delete
Copy
Move
Remame
update.php
12.79 KB
Edit
Delete
Copy
Move
Remame
upgrade-functions.php
0.33 KB
Edit
Delete
Copy
Move
Remame
upgrade.php
5.55 KB
Edit
Delete
Copy
Move
Remame
upload.php
14.85 KB
Edit
Delete
Copy
Move
Remame
user
10 Items
Change directory
Remove directory
Rename directory
user-edit.php
39.27 KB
Edit
Delete
Copy
Move
Remame
user-new.php
23.98 KB
Edit
Delete
Copy
Move
Remame
users.php
23.29 KB
Edit
Delete
Copy
Move
Remame
widgets-form-blocks.php
4.39 KB
Edit
Delete
Copy
Move
Remame
widgets-form.php
19.17 KB
Edit
Delete
Copy
Move
Remame
widgets.php
1.09 KB
Edit
Delete
Copy
Move
Remame