rebase code on oct-10-2023

This commit is contained in:
Rachit Bhargava
2023-10-10 17:51:46 -04:00
parent b16ad94b69
commit 8f1a2c3a66
2197 changed files with 184921 additions and 35568 deletions

View File

@@ -6,9 +6,6 @@ class wfUpdateCheck {
const VULN_SEVERITY_MEDIUM = 40;
const VULN_SEVERITY_LOW = 1;
const VULN_SEVERITY_NONE = 0;
const LAST_UPDATE_CHECK_ERROR_KEY = 'lastUpdateCheckError';
const LAST_UPDATE_CHECK_ERROR_SLUG_KEY = 'lastUpdateCheckErrorSlug';
private $needs_core_update = false;
private $core_update_version = 0;
@@ -172,11 +169,6 @@ class wfUpdateCheck {
* @return $this
*/
public function checkAllUpdates($useCachedValued = true) {
if (!$useCachedValued) {
wfConfig::remove(self::LAST_UPDATE_CHECK_ERROR_KEY);
wfConfig::remove(self::LAST_UPDATE_CHECK_ERROR_SLUG_KEY);
}
return $this->checkCoreUpdates($useCachedValued)
->checkPluginUpdates($useCachedValued)
->checkThemeUpdates($useCachedValued);
@@ -197,7 +189,7 @@ class wfUpdateCheck {
require_once(ABSPATH . 'wp-admin/includes/update.php');
}
include(ABSPATH . WPINC . '/version.php'); /** @var $wp_version */
include(ABSPATH . WPINC . '/version.php'); //defines $wp_version
$update_core = get_preferred_from_update_core();
if ($useCachedValued && isset($update_core->last_checked) && isset($update_core->version_checked) && 12 * HOUR_IN_SECONDS > (time() - $update_core->last_checked) && $update_core->version_checked == $wp_version) { //Duplicate of _maybe_update_core, which is a private call
@@ -284,19 +276,7 @@ class wfUpdateCheck {
return $update_plugins;
if (!function_exists('wp_update_plugins'))
require_once(ABSPATH . WPINC . '/update.php');
try {
wp_update_plugins();
}
catch (Exception $e) {
wfConfig::set(self::LAST_UPDATE_CHECK_ERROR_KEY, $e->getMessage(), false);
wfConfig::remove(self::LAST_UPDATE_CHECK_ERROR_SLUG_KEY);
error_log('Caught exception while attempting to refresh plugin update status: ' . $e->getMessage());
}
catch (Throwable $t) {
wfConfig::set(self::LAST_UPDATE_CHECK_ERROR_KEY, $t->getMessage(), false);
wfConfig::remove(self::LAST_UPDATE_CHECK_ERROR_SLUG_KEY);
error_log('Caught error while attempting to refresh plugin update status: ' . $t->getMessage());
}
wp_update_plugins();
return get_site_transient('update_plugins');
}
@@ -313,7 +293,7 @@ class wfUpdateCheck {
self::requirePluginsApi();
$update_plugins = $this->fetchPluginUpdates($useCachedValued);
$update_plugins = $this->fetchPluginUpdates();
//Get the full plugin list
if (!function_exists('get_plugins')) {
@@ -377,18 +357,7 @@ class wfUpdateCheck {
//Do nothing, use cached value
}
else {
try {
wp_update_themes();
}
catch (Exception $e) {
wfConfig::set(self::LAST_UPDATE_CHECK_ERROR_KEY, $e->getMessage(), false);
error_log('Caught exception while attempting to refresh theme update status: ' . $e->getMessage());
}
catch (Throwable $t) {
wfConfig::set(self::LAST_UPDATE_CHECK_ERROR_KEY, $t->getMessage(), false);
error_log('Caught error while attempting to refresh theme update status: ' . $t->getMessage());
}
wp_update_themes();
$update_themes = get_site_transient('update_themes');
}