Remove all lambda functions

This is an addition to commit 65dc6ce.
There was still a lamba function left in the server model.
This commit is contained in:
Karsten Heiken
2011-10-22 13:26:44 +00:00
parent 038d200955
commit 57a0ee0ca9

View File

@@ -27,6 +27,17 @@
*/
class Server extends CI_Model {
/**
* Add a field 'available' to the server.
*
* This field will be true if the last heartbeat was received less
* than 2 minutes ago.
*/
private function addAvailability($var) {
$var['available'] = time_diff($var['last_update'], mysql_now()) < 120 ? true : false;
return $var;
}
/**
* Creates a new server.
*
@@ -59,10 +70,7 @@ class Server extends CI_Model {
*/
public function getAll() {
$servers = $this->db->get('servers')->result_array();
return array_map(function($var) {
$var['available'] = time_diff($var['last_update'], mysql_now()) < 120 ? true : false;
return $var;
}, $servers);
return array_map(array($this, "addAvailability"), $servers);
}
/**