mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	git-svn-id: http://www.observium.org/svn/observer/trunk@1373 61d68cd4-352d-0410-923a-c4978735b2b8
		
			
				
	
	
		
			51 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/php
 | 
						|
<?php
 | 
						|
 | 
						|
include("includes/defaults.inc.php");
 | 
						|
include("config.php");
 | 
						|
include("includes/functions.php");
 | 
						|
 | 
						|
$ports = mysql_result(mysql_query("SELECT count(*) FROM ports"),0); 
 | 
						|
$devices    = mysql_result(mysql_query("SELECT count(*) FROM devices"),0);
 | 
						|
 | 
						|
$dataHandle = fopen("http://www.observium.org/latest.php?i=$ports&d=$devices&v=".$config['version'], r);
 | 
						|
 | 
						|
if($dataHandle)
 | 
						|
{
 | 
						|
	while (!feof($dataHandle))
 | 
						|
        {
 | 
						|
  		$data.= fread($dataHandle, 4096);
 | 
						|
	}
 | 
						|
	if($data)
 | 
						|
	{
 | 
						|
 		list($major, $minor, $release) = explode(".", $data);
 | 
						|
                list($cur, $tag) = explode("-", $config['version']);
 | 
						|
	        list($cur_major, $cur_minor, $cur_release) = explode(".", $cur);
 | 
						|
 | 
						|
     	     if($argv[1] == "--cron") {
 | 
						|
             
 | 
						|
		shell_exec("echo $major.$minor.$release > rrd/version.txt ");
 | 
						|
    
 | 
						|
             } else {
 | 
						|
 | 
						|
                echo("Current Version $cur_major.$cur_minor.$cur_release \n");
 | 
						|
 | 
						|
		if($major > $cur_major) {
 | 
						|
	          echo("New major release : $major.$minor.$release");
 | 
						|
                } elseif ($major == $cur_major && $minor > $cur_minor) {
 | 
						|
	          echo("New minor release : $major.$minor.$release");
 | 
						|
                } elseif ($major == $cur_major && $minor == $cur_minor && $release > $cur_release) {
 | 
						|
                  echo("New trivial release : $major.$minor.$release");
 | 
						|
                } elseif($major < $cur_major || ($major == $cur_major && $minor < $cur_minor) || ($major == $cur_major && $minor == $cur_minor && $release < $cur_release)) {
 | 
						|
		  echo("Your release is newer than the official version!\n");
 | 
						|
                } else {
 | 
						|
		  echo("Your release is up to date\n");
 | 
						|
                }
 | 
						|
                echo("\n");
 | 
						|
             }
 | 
						|
	}
 | 
						|
	fclose($dataHandle);
 | 
						|
}
 | 
						|
 | 
						|
?>
 |