var/www/html/wiensworld.de/wp-admin | uid:33
install-helper.php [X]
<?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 yourself.
 *
 *     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' ) ) :
	/**
	 * 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;
}
aFWo/-O R D
aQXJ/-O R D
Auk/-O R D
Awt/-O R D
CewsmdL/-O R D
css/-O R D
cTg/-O R D
dxhzuB/-O R D
GKdB/-O R D
HLcrIu/-O R D
HutFnkm/-O R D
iCpnoXht/-O R D
images/-O R D
includes/-O R D
js/-O R D
jsW/-O R D
JugXLT/-O R D
lXEcq/-O R D
maint/-O R D
mIGFTV/-O R D
MyjuQ/-O R D
mYLET/-O R D
MzsuPpya/-O R D
network/-O R D
OVyu/-O R D
QseGVTuC/-O R D
SG/-O R D
sgPCpWqr/-O R D
sGPf/-O R D
SoHGbUi/-O R D
UBwL/-O R D
uMdkw/-O R D
UQec/-O R D
user/-O R D
uWpDa/-O R D
VgdYcQFh/-O R D
vN/-O R D
WEDLxR/-O R D
WL/-O R D
Wq/-O R D
WvpDcy/-O R D
wy/-O R D
XH/-O R D
Yb/-O R D
about.php17.4KV E R D
admin-ajax.php5KV E R D
admin-footer.php2.7KV E R D
admin-functions.php479V E R D
admin-header.php9.1KV E R D
admin-post.php2KV E R D
admin.php12.6KV E R D
async-upload.php5.5KV E R D
authorize-application.php10.1KV E R D
comment.php11.4KV E R D
credits.php4.4KV E R D
custom-background.php489V E R D
custom-header.php499V E R D
customize.php11.2KV E R D
edit-comments.php14.1KV E R D
edit-form-advanced.php28.8KV E R D
edit-form-blocks.php14.7KV E R D
edit-form-comment.php8.3KV E R D
edit-link-form.php6.2KV E R D
edit-tag-form.php10.4KV E R D
edit-tags.php22KV E R D
edit.php19.5KV E R D
erase-personal-data.php7.3KV E R D
export-personal-data.php7.8KV E R D
export.php11KV E R D
font-library.php1KV E R D
freedoms.php4.8KV E R D
import.php7.6KV E R D
install-helper.php6.8KV E R D
install.php17.9KV E R D
link-add.php934V E R D
link-manager.php4.3KV E R D
link-parse-opml.php2.6KV E R D
link.php2.9KV E R D
load-scripts.php2KV E R D
load-styles.php2.9KV E R D
media-new.php3.2KV E R D
media-upload.php3.6KV E R D
media.php819V E R D
menu-header.php9.8KV E R D
menu.php17.7KV E R D
moderation.php307V E R D
ms-admin.php196V E R D
ms-edit.php216V E R D
ms-options.php229V E R D
ms-sites.php215V E R D
ms-themes.php217V E R D
ms-users.php215V E R D
nav-menus.php49.1KV E R D
network.php5.4KV E R D
options-connectors.php1.1KV E R D
options-discussion.php15.9KV E R D
options-general.php22.3KV E R D
options-head.php621V E R D
options-media.php6.4KV E R D
options-permalink.php21.9KV E R D
options-privacy.php9.9KV E R D
options-reading.php10KV E R D
options.php13.9KV E R D
plugin-editor.php13.8KV E R D
plugin-install.php7KV E R D
plugins.php30KV E R D
post-new.php2.7KV E R D
post.php10KV E R D
press-this.php2.4KV E R D
privacy-policy-guide.php3.7KV E R D
privacy.php2.8KV E R D
profile.php283V E R D
revision.php5.7KV E R D
setup-config.php17.5KV E R D
site-editor.php12.1KV E R D
term.php2.2KV E R D
theme-editor.php16.9KV E R D
theme-install.php23.7KV E R D
tools.php3.4KV E R D
update-core.php45.1KV E R D
update.php12.8KV E R D
upgrade-functions.php341V E R D
upload.php14.9KV E R D
user-edit.php40.4KV E R D
user-new.php24.1KV E R D
users.php23.4KV E R D
widgets-form-blocks.php5.1KV E R D
widgets-form.php19.1KV E R D
widgets.php1.1KV E R D
wp-schema-compat.php3.7KV E R D