diff --git a/application/controllers/api.php b/application/controllers/api.php deleted file mode 100644 index 2def42e..0000000 --- a/application/controllers/api.php +++ /dev/null @@ -1,80 +0,0 @@ - - */ -class Api extends CI_Controller { - - /** - * Unloads the session library. - */ - public function __construct() { - parent::__construct(); - - $this->session->sess_destroy(); - unset($this->session); - } - - /** - * Update the state of a given job. - * - * Because we do not want any access from servers we do not trust, - * we need a special secret to authenticate the servers. - * - * @param type $secret The secret to authenticate the server. - * @param type $job_id The job id that is running on the server. - * @param type $state The state of the job. - */ - public function update_job() { - $this->load->model('job'); - - $query = $this->db->get_where('servers', array('secret' => $secret)); - - // if we are in production mode, we do not want to tell the evil hacker - // that he used a wrong secret. That just encourages him. - if($query->num_rows() < 1 && ENVIRONMENT != 'production') { - die("Unauthorized access."); - } - - $this->job->update($job_id, $progress); - } - - /** - * Update the workload of the server. - */ - public function update_workload() { - $this->load->model('server'); - $query = $this->db->get_where('servers', array('secret' => $secret)); - - // if we are in production mode, we do not want to tell the evil hacker - // that he used a wrong secret. That just encourages him. - if($query->num_rows() < 1 && ENVIRONMENT != 'production') { - die("Unauthorized access."); - } - - $this->server->updateWorkload($secret, $workload); - } -} \ No newline at end of file