Implement a simple rpc system

Servers can transmit their workload and jobstatus updates.
This commit is contained in:
Karsten Heiken
2011-04-22 02:49:53 +02:00
parent 55f4fc9b66
commit b381e54d99
3 changed files with 112 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
<?php
/**
* @author Karsten Heiken, karsten@disposed.de
*/
class Job extends CI_Model {
/**
* Update the progress of a given job.
*
* @param string $job_id The job's id you want to update.
* @param integer $progress The progress of the job.
*/
public function update($job_id, $progress) {
$finished_at = "";
if($progress == 100)
$finished_at = ", `finished_at`=NOW()";
$this->db->query("UPDATE `jobs` SET `progress`=".
$this->db->escape($progress).$finished_at. " WHERE `id`=".
$this->db->escape($job_id));
}
}