Created
October 22, 2010 17:12
-
-
Save dkobia/640970 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
private function _get_release_version() | |
{ | |
// From version.ushahidi.com/2/ | |
$release_version = $this->release->version; | |
$release_version | |
$version_ushahidi = Kohana::config('settings.ushahidi_version'); | |
if( $this->_new_or_not($release_version, $version_ushahidi) ) | |
{ | |
return $release_version; | |
} | |
else | |
{ | |
return ""; | |
} | |
} | |
/** | |
* Check version sequence parts | |
*/ | |
private function _new_or_not($release_version=NULL, $version_ushahidi = NULL) | |
{ | |
if ($release_version AND $version_ushahidi) | |
{ | |
// Split version numbers xx.xx.xx | |
$remote_version = explode($release_version, "."); | |
$local_version = explode($version_ushahidi, "."); | |
// Check first part .. if its the same, move on to next part | |
if (isset($remote_version[0]) AND isset($local_version[0]) | |
AND (int) $remote_version[0] > (int) $local_version[0]) | |
{ | |
return true; | |
} | |
// Check second part .. if its the same, move on to next part | |
if (isset($remote_version[1]) AND isset($local_version[1]) | |
AND (int) $remote_version[1] > (int) $local_version[1]) | |
{ | |
return true; | |
} | |
// Check third part | |
if (isset($remote_version[2]) AND isset($local_version[2]) | |
AND (int) $remote_version[2] > (int) $local_version[2]) | |
{ | |
return true; | |
} | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment