Make server update() more generic

This commit is contained in:
Karsten Heiken
2011-05-08 19:54:09 +02:00
parent 6a1ae19983
commit cb63df2405

View File

@@ -24,18 +24,13 @@ class Server extends CI_Model {
} }
/** /**
* Set a server's workload. * Update a server.
* * *
* In order to check if a server can handle another job we need to know
* the workload of every server.
*
* @param type $secret The server's secret for basic authentication. * @param type $secret The server's secret for basic authentication.
* @param type $workload The server's workload. * @param type $workload The server's workload.
*/ */
public function updateWorkload($secret, $workload) { public function update($server_id, $data) {
$this->db->query("UPDATE `servers` SET `workload`=".$this->db->escape($workload) return $this->db->update('servers', $data);
. ", `last_update`=NOW()"
. " WHERE `secret`=".$this->db->escape($secret));
} }
/** /**