private function displayCurrentUpdate() { $update = $this->updateChecker->getUpdate(); if ($update !== null) { echo '<h3>An Update Is Available</h3>'; echo '<table class="puc-debug-data">'; $fields = array('version', 'download_url', 'slug', 'homepage', 'upgrade_notice'); foreach ($fields as $field) { $this->row(ucwords(str_replace('_', ' ', $field)), htmlentities($update->{$field})); } echo '</table>'; } else { echo '<h3>No updates currently available</h3>'; } }
/** * Calculate the actual check period based on the current status and environment. * * @return int Check period in seconds. */ protected function getEffectiveCheckPeriod() { $currentFilter = current_filter(); if (in_array($currentFilter, array('load-update-core.php', 'upgrader_process_complete'))) { //Check more often when the user visits "Dashboard -> Updates" or does a bulk update. $period = 60; } else { if (in_array($currentFilter, array('load-plugins.php', 'load-update.php'))) { //Also check more often on the "Plugins" page and /wp-admin/update.php. $period = 3600; } else { if ($this->throttleRedundantChecks && $this->updateChecker->getUpdate() !== null) { //Check less frequently if it's already known that an update is available. $period = $this->throttledCheckPeriod * 3600; } else { if (defined('DOING_CRON') && constant('DOING_CRON')) { //WordPress cron schedules are not exact, so lets do an update check even //if slightly less than $checkPeriod hours have elapsed since the last check. $cronFuzziness = 20 * 60; $period = $this->checkPeriod * 3600 - $cronFuzziness; } else { $period = $this->checkPeriod * 3600; } } } } return $period; }