mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Coding Standards: Use strict comparison in wp-admin/includes/upgrade.php
.
Follow-up to [725], [1575], [1975], [2037], [2966], [3670], [4738], [11958], [12776], [14080], [14485], [32378]. Props faisalahammad, mujuonly, aristath, poena, afercia, SergeyBiryukov. Fixes #58041, #61607. Built from https://develop.svn.wordpress.org/trunk@58994 git-svn-id: http://core.svn.wordpress.org/trunk@58390 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3bf2de3ad2
commit
68ed51f937
@ -460,7 +460,7 @@ Commenter avatars come from <a href="%s">Gravatar</a>.'
|
||||
* Delete any caps that snuck into the previously active blog. (Hardcoded to blog 1 for now.)
|
||||
* TODO: Get previous_blog_id.
|
||||
*/
|
||||
if ( ! is_super_admin( $user_id ) && 1 != $user_id ) {
|
||||
if ( ! is_super_admin( $user_id ) && 1 !== $user_id ) {
|
||||
$wpdb->delete(
|
||||
$wpdb->usermeta,
|
||||
array(
|
||||
@ -639,16 +639,16 @@ if ( ! function_exists( 'wp_upgrade' ) ) :
|
||||
*
|
||||
* @since 2.1.0
|
||||
*
|
||||
* @global int $wp_current_db_version The old (current) database version.
|
||||
* @global int $wp_db_version The new database version.
|
||||
* @global int $wp_current_db_version The old (current) database version.
|
||||
* @global int $wp_db_version The new database version.
|
||||
*/
|
||||
function wp_upgrade() {
|
||||
global $wp_current_db_version, $wp_db_version;
|
||||
|
||||
$wp_current_db_version = __get_option( 'db_version' );
|
||||
$wp_current_db_version = (int) __get_option( 'db_version' );
|
||||
|
||||
// We are up to date. Nothing to do.
|
||||
if ( $wp_db_version == $wp_current_db_version ) {
|
||||
if ( $wp_db_version === $wp_current_db_version ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -700,10 +700,10 @@ endif;
|
||||
function upgrade_all() {
|
||||
global $wp_current_db_version, $wp_db_version;
|
||||
|
||||
$wp_current_db_version = __get_option( 'db_version' );
|
||||
$wp_current_db_version = (int) __get_option( 'db_version' );
|
||||
|
||||
// We are up to date. Nothing to do.
|
||||
if ( $wp_db_version == $wp_current_db_version ) {
|
||||
if ( $wp_db_version === $wp_current_db_version ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -926,7 +926,7 @@ function upgrade_100() {
|
||||
foreach ( $allposts as $post ) {
|
||||
// Check to see if it's already been imported.
|
||||
$cat = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->post2cat WHERE post_id = %d AND category_id = %d", $post->ID, $post->post_category ) );
|
||||
if ( ! $cat && 0 != $post->post_category ) { // If there's no result.
|
||||
if ( ! $cat && 0 !== (int) $post->post_category ) { // If there's no result.
|
||||
$wpdb->insert(
|
||||
$wpdb->post2cat,
|
||||
array(
|
||||
@ -1099,7 +1099,7 @@ function upgrade_130() {
|
||||
// Some versions have multiple duplicate option_name rows with the same values.
|
||||
$options = $wpdb->get_results( "SELECT option_name, COUNT(option_name) AS dupes FROM `$wpdb->options` GROUP BY option_name" );
|
||||
foreach ( $options as $option ) {
|
||||
if ( 1 != $option->dupes ) { // Could this be done in the query?
|
||||
if ( $option->dupes > 1 ) { // Could this be done in the query?
|
||||
$limit = $option->dupes - 1;
|
||||
$dupe_ids = $wpdb->get_col( $wpdb->prepare( "SELECT option_id FROM $wpdb->options WHERE option_name = %s LIMIT %d", $option->option_name, $limit ) );
|
||||
if ( $dupe_ids ) {
|
||||
@ -1449,7 +1449,7 @@ function upgrade_230() {
|
||||
$links = $wpdb->get_results( "SELECT link_id, link_category FROM $wpdb->links" );
|
||||
if ( ! empty( $links ) ) {
|
||||
foreach ( $links as $link ) {
|
||||
if ( 0 == $link->link_category ) {
|
||||
if ( 0 === (int) $link->link_category ) {
|
||||
continue;
|
||||
}
|
||||
if ( ! isset( $link_cat_id_map[ $link->link_category ] ) ) {
|
||||
@ -1674,7 +1674,7 @@ function upgrade_290() {
|
||||
* Previously, setting depth to 1 would redundantly disable threading,
|
||||
* but now 2 is the minimum depth to avoid confusion.
|
||||
*/
|
||||
if ( get_option( 'thread_comments_depth' ) == '1' ) {
|
||||
if ( 1 === (int) get_option( 'thread_comments_depth' ) ) {
|
||||
update_option( 'thread_comments_depth', 2 );
|
||||
update_option( 'thread_comments', 0 );
|
||||
}
|
||||
@ -2551,7 +2551,7 @@ function upgrade_network() {
|
||||
$upgrade = false;
|
||||
$indexes = $wpdb->get_results( "SHOW INDEXES FROM $wpdb->signups" );
|
||||
foreach ( $indexes as $index ) {
|
||||
if ( 'domain_path' === $index->Key_name && 'domain' === $index->Column_name && 140 != $index->Sub_part ) {
|
||||
if ( 'domain_path' === $index->Key_name && 'domain' === $index->Column_name && '140' !== $index->Sub_part ) {
|
||||
$upgrade = true;
|
||||
break;
|
||||
}
|
||||
@ -3121,7 +3121,7 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
|
||||
$fieldtype_base = strtok( $fieldtype_without_parentheses, ' ' );
|
||||
|
||||
// Is actual field type different from the field type in query?
|
||||
if ( $tablefield->Type != $fieldtype ) {
|
||||
if ( $tablefield->Type !== $fieldtype ) {
|
||||
$do_change = true;
|
||||
if ( in_array( $fieldtype_lowercased, $text_fields, true ) && in_array( $tablefield_type_lowercased, $text_fields, true ) ) {
|
||||
if ( array_search( $fieldtype_lowercased, $text_fields, true ) < array_search( $tablefield_type_lowercased, $text_fields, true ) ) {
|
||||
@ -3161,7 +3161,7 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
|
||||
// Get the default value from the array.
|
||||
if ( preg_match( "| DEFAULT '(.*?)'|i", $cfields[ $tablefield_field_lowercased ], $matches ) ) {
|
||||
$default_value = $matches[1];
|
||||
if ( $tablefield->Default != $default_value ) {
|
||||
if ( $tablefield->Default !== $default_value ) {
|
||||
// Add a query to change the column's default value
|
||||
$cqueries[] = "ALTER TABLE {$table} ALTER COLUMN `{$tablefield->Field}` SET DEFAULT '{$default_value}'";
|
||||
|
||||
@ -3200,7 +3200,7 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
|
||||
'fieldname' => $tableindex->Column_name,
|
||||
'subpart' => $tableindex->Sub_part,
|
||||
);
|
||||
$index_ary[ $keyname ]['unique'] = ( 0 == $tableindex->Non_unique ) ? true : false;
|
||||
$index_ary[ $keyname ]['unique'] = ( '0' === $tableindex->Non_unique ) ? true : false;
|
||||
$index_ary[ $keyname ]['index_type'] = $tableindex->Index_type;
|
||||
}
|
||||
|
||||
@ -3552,7 +3552,7 @@ function make_site_theme() {
|
||||
|
||||
// Make the new site theme active.
|
||||
$current_template = __get_option( 'template' );
|
||||
if ( WP_DEFAULT_THEME == $current_template ) {
|
||||
if ( WP_DEFAULT_THEME === $current_template ) {
|
||||
update_option( 'template', $template );
|
||||
update_option( 'stylesheet', $template );
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.7-alpha-58993';
|
||||
$wp_version = '6.7-alpha-58994';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user