CC-2950: Tell users if they are running an out-of-date version or not

Get rid of hardcoded url for downloading the latest version, and use the url
stored in the stat server instead
This commit is contained in:
Yuchen Wang 2011-11-17 14:10:26 -05:00
parent d836425931
commit eae90862b1
4 changed files with 25 additions and 8 deletions

View file

@ -526,6 +526,19 @@ class Application_Model_Preference
self::SetValue("latest_version", $version);
}
}
public static function GetLatestLink(){
$link = self::GetValue("latest_link");
if($link == null || strlen($link) == 0) {
return "";
} else {
return $link;
}
}
public static function SetLatestLink($link){
self::SetValue("latest_link", $link);
}
public static function SetUploadToSoundcloudOption($upload) {
self::SetValue("soundcloud_upload_option", $upload);

View file

@ -19,6 +19,7 @@ class Airtime_View_Helper_VersionNotify extends Zend_View_Helper_Abstract{
// retrieve and validate current and latest versions,
$current = Application_Model_Preference::GetAirtimeVersion();
$latest = Application_Model_Preference::GetLatestVersion();
$link = Application_Model_Preference::GetLatestLink();
$pattern = "/^([0-9]+)\.([0-9]+)\.[0-9]+/";
preg_match($pattern, $current, $curMatch);
preg_match($pattern, $latest, $latestMatch);
@ -50,6 +51,7 @@ class Airtime_View_Helper_VersionNotify extends Zend_View_Helper_Abstract{
$result = "<div id='version-diff' style='display:none'>" . $diff . "</div>"
. "<div id='version-current' style='display:none'>" . $current . "</div>"
. "<div id='version-latest' style='display:none'>" . $latest . "</div>"
. "<div id='version-link' style='display:none'>" . $link . "</div>"
. "<div id='version-icon' class='" . $class . "'></div>";
return $result;
}