Revert "Merge pull request #5304 from JakubOnderka/version-loading"

This reverts commit 71fb7fcbd7, reversing
changes made to 11ee95aeb3.

Note: broke freetext import.
pull/5435/head
Raphaël Vinot 2019-11-12 10:16:18 +01:00
parent 170d38345f
commit 623bb20cb0
2 changed files with 5 additions and 2 deletions

View File

@ -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']);

View File

@ -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();