[CodeFactor] Apply fixes

This commit is contained in:
codefactor-io 2020-03-27 14:11:21 +00:00
parent d3e1c2580d
commit a8efd7d94b
23 changed files with 755 additions and 789 deletions

View file

@ -201,11 +201,9 @@ class MainWP_Child_Back_Up_Buddy {
if ( ! empty($finish_time) ) {
do_action( 'mainwp_reports_backupbuddy_backup', $message, $backupType, $finish_time);
}
}
}
}
}
}
} catch ( Exception $e ) {
@ -992,7 +990,6 @@ class MainWP_Child_Back_Up_Buddy {
continue;
}
} else {
// This is just like file within the root
@ -1000,7 +997,6 @@ class MainWP_Child_Back_Up_Buddy {
$files[ $key ][0] = $unrooted_file;
}
}
return array(
@ -1342,7 +1338,6 @@ class MainWP_Child_Back_Up_Buddy {
if ( file_exists( $sumLogFile ) ) {
$integrity .= '<div class="row-actions"><a title="' . __( 'View Backup Log', 'mainwp-child' ) . '" href="#" serial="' . $serial . '" class="mainwp_bb_view_log_lnk thickbox">' . __( 'View Log', 'mainwp-child' ) . '</a></div>';
}
} // end if is_array( $backup_options ).
// No integrity check for themes or plugins types.
@ -1361,7 +1356,6 @@ class MainWP_Child_Back_Up_Buddy {
$backup_sort_dates[ basename( $file) ] = $modified_time;
} // End foreach().
} // End if.
// Sort backup by date.
@ -1862,7 +1856,6 @@ class MainWP_Child_Back_Up_Buddy {
if ( $htaccess_creation_status === false ) {
die( 'Error #344894545. Security Warning! Unable to create security file (.htaccess) in backups archive directory. This file prevents unauthorized downloading of backups should someone be able to guess the backup location and filenames. This is unlikely but for best security should be in place. Please verify permissions on the backups directory.' );
}
} else {
header( 'Location: ' . $download_url );
}
@ -2080,7 +2073,6 @@ class MainWP_Child_Back_Up_Buddy {
$success_output = true;
}
}
} // end if Stash.
pb_backupbuddy::status( 'details', 'Scheduling cron to send to this remote destination...' );
@ -2260,7 +2252,6 @@ class MainWP_Child_Back_Up_Buddy {
$scan = $scan['body'];
set_transient( 'pb_backupbuddy_malwarescan', $scan, 60 * 60 * 1 ); // 1 hour cache.
}
}
$continue_2 = true;
@ -2276,7 +2267,6 @@ class MainWP_Child_Back_Up_Buddy {
// print_r( $scan );
// echo '</pre>';
}
}
pb_backupbuddy::$ui->end_metabox();
@ -2609,9 +2599,7 @@ class MainWP_Child_Back_Up_Buddy {
update_option( '_transient_doing_cron', 0 ); // Prevent cron-blocking for next item.
spawn_cron( time() + 150 ); // Adds > 60 seconds to get around once per minute cron running limit.
}
}
} // end if user and pass set.
if ( 0 == count( $errors ) ) {
@ -2710,14 +2698,12 @@ class MainWP_Child_Back_Up_Buddy {
} else {
$message = 'Log file cleared.';
}
} elseif ( 'create_snapshot' == $action ) { // < 100% backed up _OR_ ( we are on a step other than daily_init and the last_activity is more recent than the php runtime )
if ( true === backupbuddy_api::runLiveSnapshot() ) {
// pb_backupbuddy::alert( '<h3>' . __( 'Verifying everything is up to date before Snapshot', 'it-l10n-backupbuddy' ) . '</h3><p class="description" style="max-width: 700px; display: inline-block;">' . __( 'Please wait while we verify your backup is completely up to date before we create the Snapshot. This may take a few minutes...', 'it-l10n-backupbuddy' ) . '</p>', false, '', 'backupbuddy_live_snapshot_verify_uptodate' );
$message = '<h3>' . __( 'Verifying everything is up to date before Snapshot', 'it-l10n-backupbuddy' ) . '</h3><p class="description" style="max-width: 700px; display: inline-block;">' . __( 'Please wait while we verify your backup is completely up to date before we create the Snapshot. This may take a few minutes...', 'it-l10n-backupbuddy' ) . '</p>';
require pb_backupbuddy::plugin_path() . '/destinations/live/_manual_snapshot.php';
}
} elseif ( 'pause_periodic' == $action ) {
backupbuddy_api::setLiveStatus( $pause_continuous = '', $pause_periodic = true );
$destination = pb_backupbuddy::$options['remote_destinations'][ $destination_id ]; // Update local var.
@ -2831,7 +2817,6 @@ class MainWP_Child_Back_Up_Buddy {
backupbuddy_core::pretty_backup_type( $backup_type ),
);
}
}
krsort( $backup_list_temp );
@ -2952,10 +2937,8 @@ class MainWP_Child_Back_Up_Buddy {
spawn_cron( time() + 150 ); // Adds > 60 seconds to get around once per minute cron running limit.
}
}
}
}
}
return array( 'result' => json_encode( $stats ) );
@ -2988,7 +2971,6 @@ class MainWP_Child_Back_Up_Buddy {
$packages_name[ $path ] = Ithemes_Updater_Functions::get_package_name( $data['package'] );
}
}
}
return array(
'ok' => 1,
@ -3066,7 +3048,6 @@ class MainWP_Child_Back_Up_Buddy {
}
$return['soft_errors'] = $soft_errors;
}
}
return $return;
}
@ -3134,7 +3115,6 @@ class MainWP_Child_Back_Up_Buddy {
$return['errors'] = $errors;
}
}
return $return;
}

View file

@ -284,7 +284,6 @@ class MainWP_Child_Back_Up_Wordpress {
if ( file_exists( $status->get_status_filepath() ) ) {
unlink( $status->get_status_filepath() );
}
}
HM\BackUpWordPress\Path::get_instance()->cleanup();
@ -688,7 +687,6 @@ class MainWP_Child_Back_Up_Wordpress {
if ( function_exists('HM\BackUpWordPress\list_directory_by_total_filesize') ) {
$files = HM\BackUpWordPress\list_directory_by_total_filesize( $directory, $excludes );
}
} else {
$files = $schedule->list_directory_by_total_filesize( $directory );
$exclude_string = $schedule->backup->exclude_string( 'regex' );

View file

@ -231,7 +231,6 @@ class MainWP_Child_iThemes_Security {
$settings['log_location'] = ITSEC_Modules::get_setting( $module, 'log_location' ); // no change
}
}
} elseif ( $module == 'backup' ) {
if ( ! isset($settings['location']) || empty($settings['location']) ) {
$settings['location'] = ITSEC_Modules::get_setting( $module, 'location' );

View file

@ -641,7 +641,6 @@ class MainWP_Child_Timecapsule {
$display_rows[ $key ] = $html;
}
}
return $display_rows;
}
@ -755,7 +754,6 @@ class MainWP_Child_Timecapsule {
}
}
}
} catch ( Exception $e ) {
}

View file

@ -650,7 +650,6 @@ class MainWP_Child_Updraft_Plus_Backups {
$opts['settings'][ $settings_key ]['url'] = $this->replace_tokens( $settings[ $key ]['url'] );
UpdraftPlus_Options::update_updraft_option( 'updraft_webdav', $opts );
}
} elseif ( 'updraft_backblaze' === $key ) {
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_backblaze' );
if ( ! is_array($opts) ) {
@ -2756,7 +2755,6 @@ class MainWP_Child_Updraft_Plus_Backups {
if ( $updraftplus->mod_rewrite_unavailable(false) ) {
$warn[] = sprintf(__('You are using the %1$s webserver, but do not seem to have the %2$s module loaded.', 'updraftplus'), 'Apache', 'mod_rewrite') . ' ' . sprintf(__('You should enable %1$s to make any pretty permalinks (e.g. %2$s) work', 'updraftplus'), 'mod_rewrite', 'http://example.com/my-page/');
}
} else {
// For exactly same URL site restoration
$info['same_url'] = true;
@ -2830,7 +2828,6 @@ class MainWP_Child_Updraft_Plus_Backups {
} elseif ( preg_match('/^\# Skipped tables: (.*)$/', $buffer, $matches) ) {
$skipped_tables = explode(',', $matches[1]);
}
} elseif ( preg_match('/^\s*create table \`?([^\`\(]*)\`?\s*\(/i', $buffer, $matches) ) {
$table = $matches[1];
$tables_found[] = $table;

View file

@ -99,11 +99,9 @@ class MainWP_Child_Vulnerability_Checker {
$plug_vuln_filter[ $slug ]['detected_version'] = $plugin_version;
$plug_vuln_filter[ $slug ]['plugin_slug'] = $plug;
}
} else {
unset($plug_vuln_filter[ $slug ]);
}
}
if ( count($plug_vuln_filter) == 0 ) {

View file

@ -1316,7 +1316,6 @@ SQL
$result['error'] = 'Your options have been saved, but you left your license key blank, so we tried to get you a free license key from the Wordfence servers. There was a problem fetching the free key: ' . wp_kses( $e->getMessage(), array() );
return $result;
}
} elseif ( ! empty( $apiKey ) && $existingAPIKey != $apiKey ) {
$api = new wfAPI( $apiKey, wfUtils::getWPVersion() );
try {
@ -1400,7 +1399,6 @@ SQL
$result['paidKeyMsg'] = true;
}
}
} catch ( Exception $e ) {
$result['error'] = 'Your options have been saved. However we tried to verify your license key with the Wordfence servers and received an error: ' . wp_kses($e->getMessage(), array());
return $result;

View file

@ -41,7 +41,6 @@ class MainWP_Child_WPvivid_BackupRestore {
$information['syncWPvividScheduleData'] = $data['schedule'];
$information['syncWPvividSetting'] = $data;
}
} catch ( Exception $e ) {
}

View file

@ -77,7 +77,6 @@ class MainWP_Wordpress_SEO {
if ( file_exists( $temporary_file ) ) {
unlink( $temporary_file );
}
} elseif ( isset( $_POST['settings'] ) ) {
try {
$settings = base64_decode( $_POST['settings'] );