I am using CI hooks to prevent access to application without logging in, But i am also using cron jobs to do some schedule task, now i don't need login to schedule task,
below is my code for controller used for hook,
public function checkSession()
{
if($this->CI->router->fetch_class() == "cron")
{
//How should i continue with Cron class??
}
elseif($this->CI->router->fetch_class() != "login")
{
// session check logic here...change this accordingly
if($this->CI->session->userdata['user_id'] == '' )
{
redirect('login');
}
}
}
Now i want cron class to run without checking user session and login,
How can i continue to cron class in If condition?
Or any other thoughts?
Thanks,