summaryrefslogtreecommitdiffstats
path: root/application/core/MY_Controller.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/core/MY_Controller.php')
-rw-r--r--application/core/MY_Controller.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/application/core/MY_Controller.php b/application/core/MY_Controller.php
index 0f71a7fdc..a58d03563 100644
--- a/application/core/MY_Controller.php
+++ b/application/core/MY_Controller.php
@@ -18,10 +18,12 @@ class MY_Controller extends CI_Controller {
$this->var = new StdClass();
$csrf_protection = true;
+ $this->load->library('customautoloader');
+
// check if DB is up to date
if (!$this->input->is_cli_request()) {
if (!$this->db->table_exists('migrations')){
- show_error("Database not initialized. Can't find migrations table. Please run the migration script. (php index.php tools update_database)");
+ throw new \exceptions\PublicApiException("general/db/not-initialized", "Database not initialized. Can't find migrations table. Please run the migration script. (php index.php tools update_database)");
} else {
$this->config->load("migration", true);
$target_version = $this->config->item("migration_version", "migration");
@@ -31,7 +33,7 @@ class MY_Controller extends CI_Controller {
$current_version = $row ? $row->version : 0;
if ($current_version != $target_version) {
- show_error("Database version is $current_version, we want $target_version. Please run the migration script. (php index.php tools update_database)");
+ throw new \exceptions\PublicApiException("general/db/wrong-version", "Database version is $current_version, we want $target_version. Please run the migration script. (php index.php tools update_database)");
}
}
}
@@ -41,7 +43,6 @@ class MY_Controller extends CI_Controller {
mb_internal_encoding('UTF-8');
$this->load->helper(array('form', 'filebin'));
- $this->load->library('customautoloader');
if ($this->uri->segment(1) == "api") {
is_cli_client(true);