'codeigniter post_controller hook not called on server

my hook worked in local host but on server not called even i write anoymous functions and print "hook Was run" to test that hook run but not worked.

my Hook class on Update.php file

    class CheckUpdates
{
    protected $CI;

    public function __construct()
    {
        $this->CI =& get_instance();
        $this->CI->load->model('web/update_model');
    }

    public function index()
    {
        $lastUpdate = $this->CI->update_model->getlastUpdate()->first();

        if ($lastUpdate->publish_at <= time() && $_COOKIE['lastUpdate'] < $lastUpdate->publish_at) {
                set_cookie('lastUpdate', $lastUpdate->created_at, time() + (86400 * 30));
                $this->CI->load->view('admin/header');
                $this->CI->load->view('admin/rightMenu');
                $this->CI->load->view('admin/showUpdate', ['update' => $lastUpdate]);
                $this->CI->load->view('admin/footer');
        }
    }
}

and hook file:

$hook['post_controller'] = [
    'class'    => 'CheckUpdates',
    'function' => 'index',
    'filename' => 'Update.php',
    'filepath' => 'hooks'
];


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source