/** * Fetch Version * * @access public * @return string */ function _fetch_version() { ee()->load->helper('version_helper'); $details = get_version_info(); $download_url = ee()->cp->masked_url('https://store.ellislab.com/manage'); if (!$details) { return str_replace(array('%v', '%b'), array(APP_VER, APP_BUILD), lang('error_getting_version')); } end($details); $latest_version = current($details); if ($latest_version[0] > APP_VER) { $instruct_url = ee()->cp->masked_url(ee()->config->item('doc_url') . 'installation/update.html'); $str = '<p><strong>' . lang('version_update_available') . '</strong></p><br />'; $str .= '<ul>'; $str .= '<li>' . str_replace(array('%v', '%b'), array($latest_version[0], $latest_version[1]), lang('current_version')) . '</li>'; $str .= '<li>' . str_replace(array('%v', '%b'), array(APP_VER, APP_BUILD), lang('installed_version')) . '</li>'; $str .= '</ul>'; $str .= '<br /><p>' . NL . str_replace(array('%d', '%i'), array($download_url, $instruct_url), lang('version_update_inst')) . '</p>'; return $str; } /* elseif($latest_version[1] > APP_BUILD) { $instruct_url = ee()->cp->masked_url(ee()->config->item('doc_url').'installation/update_build.html'); $str = '<p><strong>' . lang('build_update_available') . '</strong></p><br />'; $str .= '<ul>'; $str .= '<li>'.str_replace(array('%v', '%b'), array($latest_version[0], $latest_version[1]), lang('current_version')).'</li>'; $str .= '<li>'.str_replace(array('%v', '%b'), array(APP_VER, APP_BUILD), lang('installed_version')).'</li>'; $str .= '</ul>'; $str .= '<br /><p>'.NL.str_replace(array('%d', '%i'), array($download_url, $instruct_url), lang('build_update_inst')).'</p>'; return $str; } */ return str_replace(array('%v', '%b'), array(APP_VER, APP_BUILD), lang('running_current')); }
/** * EE Version Check function * * Requests a file from ExpressionEngine.com that informs us what the current available version * of ExpressionEngine. * * @access private * @return bool|string */ function _version_check() { $download_url = $this->cp->masked_url('https://store.ellislab.com/manage'); $this->load->helper('version_helper'); $version_file = get_version_info(); if (!$version_file) { return sprintf(lang('new_version_error'), $download_url); } $new_release = FALSE; $high_priority = FALSE; // Do we have a newer version out? foreach ($version_file as $app_data) { if ($app_data[0] > APP_VER && $app_data[2] == 'high') { $new_release = TRUE; $high_priority = TRUE; $high_priority_release = array('version' => $app_data[0], 'build' => $app_data[1]); continue; } elseif ($app_data[1] > APP_BUILD && $app_data[2] == 'high') { // A build could sometimes be a security release. So we can plan for it here. $new_release = TRUE; $high_priority = TRUE; $high_priority_release = array('version' => $app_data[0], 'build' => $app_data[1]); continue; } } if (!$new_release) { return FALSE; } $cur_ver = end($version_file); // Extracting the date the build was released. IF the build was // released in the past 2 calendar days, we don't show anything // on the control panel home page unless it was a security release $date_threshold = mktime(0, 0, 0, substr($cur_ver[1], 4, -2), substr($cur_ver[1], -2) + 2, substr($cur_ver[1], 0, 4)); if ($this->localize->now < $date_threshold && $high_priority != TRUE) { return FALSE; } if ($high_priority) { return sprintf(lang('new_version_notice_high_priority'), $high_priority_release['version'], $high_priority_release['build'], $cur_ver[0], $cur_ver[1], $download_url, $this->cp->masked_url($this->config->item('doc_url') . 'installation/update.html')); } return sprintf(lang('new_version_notice'), $details['version'], $download_url, $this->cp->masked_url($this->config->item('doc_url') . 'installation/update.html')); }