Edit File by line
/home/zeestwma/richards.../wp-conte.../mu-plugi...
File: hostinger-auto-updates.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Plugin Name: Hostinger Smart Auto Updates
[2] Fix | Delete
* Plugin URI: https://www.hostinger.com
[3] Fix | Delete
* Description: Faster and more secure updates for your themes, plugins, and core files. Managed entirely by Hostinger.
[4] Fix | Delete
* Version: 1.0.7
[5] Fix | Delete
* Author: Hostinger
[6] Fix | Delete
* Author URI: https://www.hostinger.com
[7] Fix | Delete
* License: GPL-2.0-or-later
[8] Fix | Delete
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
[9] Fix | Delete
* Text Domain: hostinger-auto-updates
[10] Fix | Delete
* Domain Path: /languages
[11] Fix | Delete
* Requires at least: 5.0
[12] Fix | Delete
* Requires PHP: 7.4
[13] Fix | Delete
* Network: true
[14] Fix | Delete
*/
[15] Fix | Delete
[16] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[17] Fix | Delete
exit; // Exit if accessed directly
[18] Fix | Delete
}
[19] Fix | Delete
[20] Fix | Delete
/**
[21] Fix | Delete
* Disable automatic updates
[22] Fix | Delete
*/
[23] Fix | Delete
add_filter( 'automatic_updater_disabled', '__return_true' ); // Core updates
[24] Fix | Delete
add_filter( 'auto_update_theme', '__return_false' ); // Theme updates
[25] Fix | Delete
add_filter( 'auto_update_plugin', '__return_false' ); // Plugin updates
[26] Fix | Delete
[27] Fix | Delete
/**
[28] Fix | Delete
* Use Hostinger's proxy services for WordPress.org API and download requests.
[29] Fix | Delete
*
[30] Fix | Delete
* @param mixed $response_override Response to replace with.
[31] Fix | Delete
* @param array $args HTTP request arguments.
[32] Fix | Delete
* @param string $url Request URL.
[33] Fix | Delete
* @return mixed
[34] Fix | Delete
*/
[35] Fix | Delete
if ( ! function_exists( 'hostinger_use_proxy_services' ) ) {
[36] Fix | Delete
function hostinger_use_proxy_services( $response_override, $args, $url ) {
[37] Fix | Delete
$proxy_domains = [
[38] Fix | Delete
'api.wordpress.org' => 'wpapi.hostinger.io',
[39] Fix | Delete
'downloads.wordpress.org' => 'wpdownloads.hostinger.io',
[40] Fix | Delete
];
[41] Fix | Delete
[42] Fix | Delete
foreach ( $proxy_domains as $original_domain => $proxy_domain ) {
[43] Fix | Delete
if ( strpos( $url, $original_domain ) !== false ) {
[44] Fix | Delete
$proxy_url = str_replace( $original_domain, $proxy_domain, $url );
[45] Fix | Delete
$response = wp_remote_request( $proxy_url, $args );
[46] Fix | Delete
[47] Fix | Delete
return $response;
[48] Fix | Delete
}
[49] Fix | Delete
}
[50] Fix | Delete
[51] Fix | Delete
return $response_override;
[52] Fix | Delete
}
[53] Fix | Delete
}
[54] Fix | Delete
[55] Fix | Delete
add_filter( 'pre_http_request', 'hostinger_use_proxy_services', 10, 3 );
[56] Fix | Delete
[57] Fix | Delete
/**
[58] Fix | Delete
* Modify the default auto-update tests.
[59] Fix | Delete
*
[60] Fix | Delete
* @param array $tests The array of site status tests.
[61] Fix | Delete
* @return array Modified array of site status tests.
[62] Fix | Delete
*/
[63] Fix | Delete
if ( ! function_exists( 'hostinger_change_default_autoupdates_test' ) ) {
[64] Fix | Delete
function hostinger_change_default_autoupdates_test( $tests ) {
[65] Fix | Delete
// Remove default auto-update tests
[66] Fix | Delete
unset( $tests['async']['background_updates'] );
[67] Fix | Delete
unset( $tests['direct']['plugin_theme_auto_updates'] );
[68] Fix | Delete
[69] Fix | Delete
// Add a new test to indicate Hostinger manages updates
[70] Fix | Delete
$tests['direct']['hostinger_plugin_theme_auto_updates'] = [
[71] Fix | Delete
'label' => __( 'Auto-updates managed by Hostinger' ),
[72] Fix | Delete
'test' => function () {
[73] Fix | Delete
$result = [
[74] Fix | Delete
'label' => __( 'Automatic updates managed by Hostinger' ),
[75] Fix | Delete
'status' => 'good',
[76] Fix | Delete
'badge' => [
[77] Fix | Delete
'label' => __( 'Security' ),
[78] Fix | Delete
'color' => 'blue',
[79] Fix | Delete
],
[80] Fix | Delete
'description' => __( 'Automatic updates ensure your site is always running the latest and most secure versions of WordPress, plugins, and themes.' ),
[81] Fix | Delete
'actions' => '',
[82] Fix | Delete
'test' => 'hostinger_managed_updates',
[83] Fix | Delete
];
[84] Fix | Delete
[85] Fix | Delete
return $result;
[86] Fix | Delete
},
[87] Fix | Delete
];
[88] Fix | Delete
[89] Fix | Delete
return $tests;
[90] Fix | Delete
}
[91] Fix | Delete
}
[92] Fix | Delete
[93] Fix | Delete
add_filter( 'site_status_tests', 'hostinger_change_default_autoupdates_test' );
[94] Fix | Delete
[95] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function