Welcome Guest, Not a member yet? Register   Sign In
Specifying no sessions
#2

[eluser]Pascal Kriete[/eluser]
I ran into this on an old project - in my case it was an installer that couldn't autoload the session, because the database config values weren't known yet.

What I ended up doing is overriding the core's _ci_initialize method to kill all autoloading code for that controller.
Code:
class Install extends Controller {

    /**
     * Constructor
     *
     * @access    private
     */
    function Install()
    {
        parent::Controller();
    }
    
    // --------------------------------------------------------------------

    /**
     * Index Function
     *
     * @access    public
     */
    function index()
    {
        // Code here
    }
    
    // --------------------------------------------------------------------

    /**
     * Overriden _ci_initialize function to skip the autoloading process
     *
     * @access    private
     */
    function _ci_initialize()
    {
        // Assign all the class objects that were instantiated by the
        // front controller to local class variables so that CI can be
        // run as one big super object.
        $classes = array(
                            'config'    => 'Config',
                            'input'        => 'Input',
                            'benchmark'    => 'Benchmark',
                            'uri'        => 'URI',
                            'output'    => 'Output',
                            'lang'        => 'Language',
                            'router'    => 'Router'
                            );
        
        foreach ($classes as $var => $class)
        {
            $this->$var =& load_class($class);
        }

        // In PHP 5 the Loader class is run as a discreet
        // class.  In PHP 4 it extends the Controller
        if (floor(phpversion()) >= 5)
        {
            $this->load =& load_class('Loader');
        }
        else
        {
            // sync up the objects since PHP4 was working from a copy
            foreach (array_keys(get_object_vars($this)) as $attribute)
            {
                if (is_object($this->$attribute))
                {
                    $this->load->$attribute =& $this->$attribute;
                }
            }
        }
    }
}


Messages In This Thread
Specifying no sessions - by El Forum - 06-27-2009, 06:37 PM
Specifying no sessions - by El Forum - 06-28-2009, 03:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB