public static function run_updates() { /* Get list of updaters from Landing_Pages_Activation_Update_Processes class */ $updaters = get_class_methods('Landing_Pages_Activation_Update_Processes'); /* Get transient list of completed update processes */ $completed = get_transient('lp_completed_updaters') ? get_transient('lp_completed_updaters') : array(); print_r($completed); exit; /* Get the difference between the two arrays */ $remaining = array_diff($updates, $completed); /* Loop through updaters and run updaters that have not been ran */ foreach ($remaining as $updater) { Landing_Pages_Activation_Update_Processes::$updater(); $completed[] = $updater; } /* Update this transient value with list of completed upgrade processes */ update_transient('lp_completed_updaters', $completed); }
public function remove_old_update_plugins_data($plugin) { if (empty($this->old_update_data['plugins']) || !isset($this->old_update_data['plugins'][$plugin])) { return null; } $data['2.8'] = get_transient('update_plugins'); $data['2.6'] = get_option('update_plugins'); $found_match = array(); foreach (array('2.8', '2.6') as $version) { $found_match[$version] = false; if (is_object($data[$version]) && !empty($data[$version]->response) && isset($data[$version]->response[$plugin])) { unset($data[$version]->response[$plugin]); $found_match[$version] = true; } if (empty($data[$version]->response) && 1 == count(get_object_vars($data[$version]))) { $data[$version] = false; } } if ($found_match['2.8']) { if (false === $data['2.8']) { delete_transient('update_plugins'); } else { update_transient('update_plugins', $data['2.8']); } } if ($found_match['2.6']) { if (false === $data['2.6']) { delete_option('update_plugins'); } else { update_option('update_plugins', $data['2.6']); } } return $found_match['2.8'] || $found_match['2.6']; }