mirror of
https://github.com/mainwp/mainwp-child.git
synced 2025-09-06 09:20:28 +08:00
Fixed:CodeFactor issues
This commit is contained in:
parent
22ded195ad
commit
975b8405ab
8 changed files with 16 additions and 18 deletions
|
@ -667,7 +667,7 @@ class MainWP_Backup {
|
||||||
$this->zipArchiveFileCount ++;
|
$this->zipArchiveFileCount ++;
|
||||||
|
|
||||||
$this->testContent = file_get_contents( $path );
|
$this->testContent = file_get_contents( $path );
|
||||||
if ( $this->testContent === false ) {
|
if ( false === $this->testContent ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$added = $this->zip->addFromString( $zipEntryName, $this->testContent );
|
$added = $this->zip->addFromString( $zipEntryName, $this->testContent );
|
||||||
|
@ -747,7 +747,7 @@ class MainWP_Backup {
|
||||||
// @codingStandardsIgnoreEnd
|
// @codingStandardsIgnoreEnd
|
||||||
$query = $table_insert;
|
$query = $table_insert;
|
||||||
foreach ( $row as $value ) {
|
foreach ( $row as $value ) {
|
||||||
if ( $value === null ) {
|
if ( null === $value ) {
|
||||||
$query .= 'NULL, ';
|
$query .= 'NULL, ';
|
||||||
} else {
|
} else {
|
||||||
$query .= '"' . MainWP_Child_DB::real_escape_string( $value ) . '", ';
|
$query .= '"' . MainWP_Child_DB::real_escape_string( $value ) . '", ';
|
||||||
|
|
|
@ -2200,7 +2200,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
}
|
}
|
||||||
pb_backupbuddy::$ui->end_metabox();
|
pb_backupbuddy::$ui->end_metabox();
|
||||||
|
|
||||||
if ( $continue_2 === true ) {
|
if ( true === $continue_2 ) {
|
||||||
function lined_array( $array ) {
|
function lined_array( $array ) {
|
||||||
if ( is_array( $array ) ) {
|
if ( is_array( $array ) ) {
|
||||||
foreach ( $array as $array_key => $array_item ) {
|
foreach ( $array as $array_key => $array_item ) {
|
||||||
|
|
|
@ -1340,7 +1340,7 @@ class MainWP_Child_Back_WP_Up {
|
||||||
foreach ( $to_include as $key => $value ) {
|
foreach ( $to_include as $key => $value ) {
|
||||||
$normalized = trailingslashit( wp_normalize_path( trim( $value ) ) );
|
$normalized = trailingslashit( wp_normalize_path( trim( $value ) ) );
|
||||||
$normalized && $normalized = filter_var( $normalized, FILTER_SANITIZE_URL );
|
$normalized && $normalized = filter_var( $normalized, FILTER_SANITIZE_URL );
|
||||||
$realpath = $normalized && $normalized !== '/' ? realpath( $normalized ) : false;
|
$realpath = $normalized && '/' !== $normalized ? realpath( $normalized ) : false;
|
||||||
$realpath && $to_include_parsed[ $key ] = $realpath;
|
$realpath && $to_include_parsed[ $key ] = $realpath;
|
||||||
}
|
}
|
||||||
sort( $to_include_parsed );
|
sort( $to_include_parsed );
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class MainWP_Child_DB {
|
class MainWP_Child_DB {
|
||||||
// Support old & new versions of WordPress (3.9+)
|
// Support old & new versions of WordPress (3.9+).
|
||||||
public static function use_mysqli() {
|
public static function use_mysqli() {
|
||||||
/** @var $wpdb wpdb */
|
/** @var $wpdb wpdb */
|
||||||
if ( ! function_exists( 'mysqli_connect' ) ) {
|
if ( ! function_exists( 'mysqli_connect' ) ) {
|
||||||
|
|
|
@ -550,7 +550,6 @@ class MainWP_Child_Timecapsule {
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$limit = WPTC_Factory::get( 'config' )->get_option( 'activity_log_lazy_load_limit' );
|
$limit = WPTC_Factory::get( 'config' )->get_option( 'activity_log_lazy_load_limit' );
|
||||||
// Get the columns registered in the get_columns and get_sortable_columns methods.
|
// Get the columns registered in the get_columns and get_sortable_columns methods.
|
||||||
// $columns = $this->get_columns();
|
|
||||||
$timezone = WPTC_Factory::get( 'config' )->get_option( 'wptc_timezone' );
|
$timezone = WPTC_Factory::get( 'config' )->get_option( 'wptc_timezone' );
|
||||||
if ( count( $records ) > 0 ) {
|
if ( count( $records ) > 0 ) {
|
||||||
|
|
||||||
|
|
|
@ -1821,8 +1821,7 @@ class MainWP_Child {
|
||||||
}
|
}
|
||||||
// If this does not work - add code from /wp-admin/includes/class-wp-upgrader.php in the newer versions
|
// If this does not work - add code from /wp-admin/includes/class-wp-upgrader.php in the newer versions
|
||||||
// So users can upgrade older versions too.
|
// So users can upgrade older versions too.
|
||||||
// 3rd option: 'wp_update_core'
|
// 3rd option: 'wp_update_core'.
|
||||||
|
|
||||||
if ( ! is_wp_error( $upgrade ) ) {
|
if ( ! is_wp_error( $upgrade ) ) {
|
||||||
$information['upgrade'] = 'SUCCESS';
|
$information['upgrade'] = 'SUCCESS';
|
||||||
} else {
|
} else {
|
||||||
|
@ -1881,7 +1880,8 @@ class MainWP_Child {
|
||||||
|
|
||||||
$result = count( $language_updates ) == 0 ? false : $upgrader->bulk_upgrade( $language_updates );
|
$result = count( $language_updates ) == 0 ? false : $upgrader->bulk_upgrade( $language_updates );
|
||||||
if ( ! empty( $result ) ) {
|
if ( ! empty( $result ) ) {
|
||||||
for ( $i = 0; $i < count( $result ); $i++ ) {
|
$count_result = count( $result );
|
||||||
|
for ( $i = 0; $i < $count_result; $i++ ) {
|
||||||
if ( empty( $result[ $i ] ) || is_wp_error( $result[ $i ] ) ) {
|
if ( empty( $result[ $i ] ) || is_wp_error( $result[ $i ] ) ) {
|
||||||
$information['upgrades'][ $language_updates[ $i ]->slug ] = false;
|
$information['upgrades'][ $language_updates[ $i ]->slug ] = false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -3861,7 +3861,7 @@ class MainWP_Child {
|
||||||
try {
|
try {
|
||||||
$information = apply_filters( 'mainwp-site-sync-others-data', $information, $othersData );
|
$information = apply_filters( 'mainwp-site-sync-others-data', $information, $othersData );
|
||||||
} catch ( Exception $e ) {
|
} catch ( Exception $e ) {
|
||||||
// do not exit!
|
// ok!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4741,7 +4741,6 @@ class MainWP_Child {
|
||||||
if ( is_array( $roles ) ) {
|
if ( is_array( $roles ) ) {
|
||||||
foreach ( $roles as $role ) {
|
foreach ( $roles as $role ) {
|
||||||
$new_users = get_users( 'role=' . $role );
|
$new_users = get_users( 'role=' . $role );
|
||||||
// $allusers[$role] = array();
|
|
||||||
foreach ( $new_users as $new_user ) {
|
foreach ( $new_users as $new_user ) {
|
||||||
$usr = array();
|
$usr = array();
|
||||||
$usr['id'] = $new_user->ID;
|
$usr['id'] = $new_user->ID;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue