diff --git a/app/Controller/AppController.php b/app/Controller/AppController.php index 02774ef55..e80bc857f 100755 --- a/app/Controller/AppController.php +++ b/app/Controller/AppController.php @@ -165,10 +165,10 @@ class AppController extends Controller } else { $this->Auth->authenticate['Form']['userFields'] = $auth_user_fields; } + $versionArray = $this->{$this->modelClass}->checkMISPVersion(); if (!empty($this->params['named']['disable_background_processing'])) { Configure::write('MISP.background_jobs', 0); } - $versionArray = $this->{$this->modelClass}->checkMISPVersion(); $this->mispVersion = implode('.', array_values($versionArray)); $this->Security->blackHoleCallback = 'blackHole'; $this->_setupBaseurl(); @@ -395,8 +395,10 @@ class AppController extends Controller // instead of using checkAction(), like we normally do from controllers when trying to find out about a permission flag, we can use getActions() // getActions returns all the flags in a single SQL query if ($this->Auth->user()) { + $versionArray = $this->{$this->modelClass}->checkMISPVersion(); + $this->mispVersionFull = implode('.', array_values($versionArray)); $this->set('mispVersion', implode('.', array($versionArray['major'], $versionArray['minor'], 0))); - $this->set('mispVersionFull', $this->mispVersion); + $this->set('mispVersionFull', $this->mispVersionFull); $role = $this->getActions(); $this->set('me', $this->Auth->user()); $this->set('isAdmin', $role['perm_admin']); diff --git a/app/Model/AppModel.php b/app/Model/AppModel.php index 04e3557d0..de9a8be12 100644 --- a/app/Model/AppModel.php +++ b/app/Model/AppModel.php @@ -1545,6 +1545,7 @@ class AppModel extends Model public function checkMISPVersion() { + App::uses('Folder', 'Utility'); $file = new File(ROOT . DS . 'VERSION.json', true); $version_array = json_decode($file->read(), true); $file->close();