Store update state in a site option, instead of a normal, per-site field. WordPress itself stores updates in a site transient, and there's really no point in maintaining separate update states for each site in a network.

This commit is contained in:
Yahnis Elsts 2012-10-20 15:19:47 +00:00
parent aceb9e62a5
commit 80a644e329
1 changed files with 3 additions and 3 deletions

View File

@ -288,7 +288,7 @@ class PluginUpdateChecker {
* @return StdClass|null
*/
private function getUpdateState() {
$state = get_option($this->optionName);
$state = get_site_option($this->optionName);
if ( !empty($state) && isset($state->update) && !($state->update instanceof PluginUpdate) ){
$state->update = PluginUpdate::fromObject($state->update);
}
@ -307,7 +307,7 @@ class PluginUpdateChecker {
$update = $state->update; /** @var PluginUpdate $update */
$state->update = $update->toStdClass();
}
update_option($this->optionName, $state);
update_site_option($this->optionName, $state);
}
/**
@ -317,7 +317,7 @@ class PluginUpdateChecker {
* clear the update cache.
*/
public function resetUpdateState() {
delete_option($this->optionName);
delete_site_option($this->optionName);
}
/**