mirror of
https://github.com/mainwp/mainwp-child.git
synced 2025-09-01 03:58:07 +08:00
Merge pull request #150 from mainwp/bogdan01-cf-autofix
Apply fixes from CodeFactor
This commit is contained in:
commit
aa6ebc7421
7 changed files with 23 additions and 23 deletions
|
@ -203,7 +203,7 @@ class MainWP_Backup {
|
|||
if ( $zipRes ) {
|
||||
$nodes = glob( ABSPATH . '*' );
|
||||
if ( ! $includeCoreFiles ) {
|
||||
$this->include_core_files( $nodes );
|
||||
$this->include_core_files( $nodes );
|
||||
}
|
||||
|
||||
$db_files = $this->create_backup_db( dirname( $filepath ) . DIRECTORY_SEPARATOR . 'dbBackup' );
|
||||
|
|
|
@ -631,7 +631,7 @@ class MainWP_Child_Back_Up_WordPress {
|
|||
}
|
||||
|
||||
private function render_table_files( $files, $schedule, $directory, $root_dir, $new_version, $site_size, $is_size_calculated ) {
|
||||
?>
|
||||
?>
|
||||
<table class="widefat">
|
||||
<thead>
|
||||
<?php
|
||||
|
@ -644,7 +644,7 @@ class MainWP_Child_Back_Up_WordPress {
|
|||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
|
||||
private function render_table_header_files( $root_dir, $directory, $schedule, $new_version, $site_size, $is_size_calculated ) {
|
||||
|
|
|
@ -554,7 +554,7 @@ class MainWP_Child_Updates {
|
|||
add_filter( 'pre_transient_update_core', $this->filterFunction, 99 );
|
||||
}
|
||||
$this->do_upgrade_wp( $information );
|
||||
|
||||
|
||||
if ( null !== $this->filterFunction ) {
|
||||
remove_filter( 'pre_site_transient_update_core', $this->filterFunction, 99 );
|
||||
}
|
||||
|
@ -564,8 +564,8 @@ class MainWP_Child_Updates {
|
|||
|
||||
mainwp_child_helper()->write( $information );
|
||||
}
|
||||
|
||||
private function do_upgrade_wp( &$information ){
|
||||
|
||||
private function do_upgrade_wp( &$information ) {
|
||||
// Check for new versions.
|
||||
wp_version_check();
|
||||
|
||||
|
|
|
@ -301,14 +301,14 @@ class MainWP_Connect {
|
|||
if ( ! isset( $_POST['mainwpsignature'] ) || empty( $_POST['mainwpsignature'] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$file = $this->get_file_request();
|
||||
|
||||
|
||||
$auth = $this->auth( isset( $_POST['mainwpsignature'] ) ? rawurldecode( $_POST['mainwpsignature'] ) : '', isset( $_POST['function'] ) ? $_POST['function'] : rawurldecode( ( isset( $_REQUEST['where'] ) ? $_REQUEST['where'] : $file ) ), isset( $_POST['nonce'] ) ? $_POST['nonce'] : '', isset( $_POST['nossl'] ) ? $_POST['nossl'] : 0 );
|
||||
if ( ! $auth ) {
|
||||
MainWP_Helper::error( __( 'Authentication failed! Please deactivate and re-activate the MainWP Child plugin on this site.', 'mainwp-child' ) );
|
||||
}
|
||||
$auth_user = false;
|
||||
$auth_user = false;
|
||||
if ( $auth ) {
|
||||
// disable duo auth for mainwp.
|
||||
remove_action( 'init', 'duo_verify_auth', 10 );
|
||||
|
@ -353,7 +353,7 @@ class MainWP_Connect {
|
|||
}
|
||||
}
|
||||
|
||||
private function get_file_request(){
|
||||
private function get_file_request() {
|
||||
$file = '';
|
||||
if ( isset( $_REQUEST['f'] ) ) {
|
||||
$file = $_REQUEST['f'];
|
||||
|
@ -364,7 +364,7 @@ class MainWP_Connect {
|
|||
}
|
||||
return $file;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Check to support login by alternative admin.
|
||||
|
|
|
@ -567,7 +567,7 @@ class MainWP_Helper {
|
|||
add_option( $option_name, $option_value, '', $autoload );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function update_lasttime_backup( $by, $time ) {
|
||||
$backup_by = array( 'backupbuddy', 'backupwordpress', 'backwpup', 'updraftplus', 'wptimecapsule' );
|
||||
if ( ! in_array( $by, $backup_by ) ) {
|
||||
|
@ -626,7 +626,7 @@ class MainWP_Helper {
|
|||
|
||||
return get_option( 'mainwp_lasttime_backup_' . $by, 0 );
|
||||
}
|
||||
|
||||
|
||||
public function create_nonce_without_session( $action = - 1 ) {
|
||||
$user = wp_get_current_user();
|
||||
$uid = (int) $user->ID;
|
||||
|
@ -665,7 +665,7 @@ class MainWP_Helper {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static function get_revisions( $max_revisions ) {
|
||||
global $wpdb;
|
||||
return $wpdb->get_results( $wpdb->prepare( " SELECT `post_parent`, COUNT(*) cnt FROM $wpdb->posts WHERE `post_type` = 'revision' GROUP BY `post_parent` HAVING COUNT(*) > %d ", $max_revisions ) );
|
||||
|
|
|
@ -45,7 +45,7 @@ class MainWP_Utility {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method execute_snippet()
|
||||
*
|
||||
|
@ -71,7 +71,7 @@ class MainWP_Utility {
|
|||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
public static function fix_for_custom_themes() {
|
||||
if ( file_exists( ABSPATH . '/wp-admin/includes/screen.php' ) ) {
|
||||
include_once ABSPATH . '/wp-admin/includes/screen.php';
|
||||
|
@ -384,7 +384,7 @@ class MainWP_Utility {
|
|||
}
|
||||
return $wpdb->get_results( $wpdb->prepare( "SELECT ID,guid FROM $wpdb->posts WHERE post_type = 'attachment' AND guid LIKE %s", '%/' . $wpdb->esc_like( $filename ) ) );
|
||||
}
|
||||
|
||||
|
||||
public static function fetch_url( $url, $postdata ) {
|
||||
try {
|
||||
$tmpUrl = $url;
|
||||
|
@ -438,5 +438,5 @@ class MainWP_Utility {
|
|||
}
|
||||
// phpcs:enable
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -146,7 +146,7 @@ class Tar_Archiver {
|
|||
if ( $this->archive ) {
|
||||
$nodes = glob( ABSPATH . '*' );
|
||||
if ( ! $includeCoreFiles ) {
|
||||
$this->include_core_files( &$nodes );
|
||||
$this->include_core_files( &$nodes );
|
||||
}
|
||||
|
||||
$db_files = $this->backup->create_backup_db( dirname( $filepath ) . DIRECTORY_SEPARATOR . 'dbBackup', false, $this );
|
||||
|
@ -176,7 +176,7 @@ class Tar_Archiver {
|
|||
}
|
||||
|
||||
if ( $addConfig ) {
|
||||
$string = $this->add_config();
|
||||
$string = $this->add_config();
|
||||
$this->add_empty_directory( 'clone', 0, 0, 0, time() );
|
||||
$this->add_file_from_string( 'clone/config.txt', $string );
|
||||
}
|
||||
|
@ -234,8 +234,8 @@ class Tar_Archiver {
|
|||
}
|
||||
unset( $coreFiles );
|
||||
}
|
||||
|
||||
private function add_config() {
|
||||
|
||||
private function add_config() {
|
||||
global $wpdb;
|
||||
$plugins = array();
|
||||
$dir = WP_CONTENT_DIR . '/plugins/';
|
||||
|
@ -294,7 +294,7 @@ class Tar_Archiver {
|
|||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
|
||||
public function add_dir( $path, $excludes ) {
|
||||
if ( ( '.' == basename( $path ) ) || ( '..' == basename( $path ) ) ) {
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue