"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/Cache/Driver_Json.php" between
ganglia-web-3.7.1.tar.gz and ganglia-web-3.7.2.tar.gz

About: Ganglia is a scalable distributed monitoring system for high-performance computing systems such as clusters and grids (Ganglia Web UI).

Driver_Json.php  (ganglia-web-3.7.1):Driver_Json.php  (ganglia-web-3.7.2)
<?php <?php
function g_cache_exists() { function g_cache_exists() {
global $conf; global $conf;
return file_exists( $conf['cachefile'] ); return file_exists( $conf['cachefile'] );
} // end function g_cache_exists } // end function g_cache_exists
function g_cache_serialize($data) { function g_cache_serialize($data) {
global $conf; global $conf;
file_put_contents($conf['cachefile'], serialize($data)); file_put_contents($conf['cachefile'], json_encode($data));
file_put_contents($conf['cachefile'] . "_cluster_data", serialize($data[" file_put_contents($conf['cachefile'] . "_cluster_data", json_encode($data
cluster"])); ["cluster"]));
file_put_contents($conf['cachefile'] . "_host_list", serialize($data["hos file_put_contents($conf['cachefile'] . "_host_list", json_encode($data["h
ts"])); osts"]));
file_put_contents($conf['cachefile'] . "_metric_list", serialize(array_ke file_put_contents($conf['cachefile'] . "_metric_list", json_encode(array_
ys($data["metrics"]))); keys($data["metrics"])));
} // end function g_cache_serialize } // end function g_cache_serialize
function g_cache_deserialize($index) { function g_cache_deserialize($index) {
global $conf; global $conf;
$index_array = array(); $index_array = array();
switch ( $index ) { switch ( $index ) {
case "hosts_and_metrics": case "hosts_and_metrics":
$index_array["cluster"] = unserialize(file_get_contents($conf['cac $index_array["cluster"] = json_decode(file_get_contents($conf['cac
hefile'] . "_cluster_data")); hefile'] . "_cluster_data"), TRUE);
$index_array["hosts"] = unserialize(file_get_contents($conf['cache $index_array["hosts"] = json_decode(file_get_contents($conf['cache
file'] . "_host_list")); file'] . "_host_list"), TRUE);
$index_array["metrics"] = unserialize(file_get_contents($conf['cac $index_array["metrics"] = json_decode(file_get_contents($conf['cac
hefile'] . "_metric_list")); hefile'] . "_metric_list"), TRUE);
break; break;
case "metric_list": case "metric_list":
$index_array["metric_list"] = unserialize(file_get_contents($conf[ 'cachefile'] . "_" . $index)); $index_array["metric_list"] = json_decode(file_get_contents($conf[ 'cachefile'] . "_" . $index), TRUE);
break; break;
default: default:
$index_array = unserialize(file_get_contents($conf['cachefile'])); $index_array = json_decode(file_get_contents($conf['cachefile']), TRUE);
} }
return $index_array; return $index_array;
} // end function g_cache_deserialize } // end function g_cache_deserialize
function g_cache_expire () { function g_cache_expire () {
global $conf; global $conf;
$time_diff = time() - filemtime($conf['cachefile']); $time_diff = time() - filemtime($conf['cachefile']);
return $time_diff; return $time_diff;
} // end function g_cache_expire } // end function g_cache_expire
 End of changes. 4 change blocks. 
15 lines changed or deleted 15 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS