public function __construct()
{
parent::__construct();
log_message('info', 'Base Controller Class Initialized');
// Load session
$this->load->library('session');
$this->load->library('alert');
// Load installer library and database config items
$this->load->library('installer');
// If 'config/updated.txt' exists, system needs upgrade
if (is_file(IGNITEPATH . 'config/updated.txt')) {
if ($this->installer->upgrade()) {
redirect(admin_url('dashboard'));
}
}
// Redirect to setup if app requires setup
if (($installed = $this->installer->isInstalled()) !== TRUE and APPDIR !== 'setup') {
redirect(root_url('setup'));
}
// If database is connected, then app is ready
if ($this->installer->db_exists === TRUE) {
// Load extension library
$this->load->library('extension');
// Load events library
$this->load->library('events');
// If the requested controller is a module controller then load the module config
if (ENVIRONMENT !== 'testing') {
if ($this->extension and $this->router and $_module = $this->router->fetch_module()) {
// Load the module configuration file and retrieve its items.
// Shows 404 error message on failure to load
$this->extension->loadConfig($_module, TRUE);
}
}
}
// Check app for maintenance in production environments.
if (ENVIRONMENT === 'production') {
// Show maintenance message if maintenance is enabled
if ($this->maintenanceEnabled()) {
show_error($this->config->item('maintenance_message'), '503', 'Maintenance Enabled');
}
}
// Enable profiler for development environments.
if (!$this->input->is_ajax_request()) {
$this->output->enable_profiler(TI_DEBUG);
}
$this->form_validation->CI =& $this;
}