mirror of https://github.com/MISP/MISP
chg: [internal] Use AdminSetting::getSetting method
parent
687556df32
commit
48016120b7
|
@ -626,11 +626,8 @@ class AdminShell extends AppShell
|
|||
{
|
||||
$this->ConfigLoad->execute();
|
||||
$dbActualSchema = $this->Server->getActualDBSchema();
|
||||
$dbVersion = $this->AdminSetting->find('first', array(
|
||||
'conditions' => array('setting' => 'db_version')
|
||||
));
|
||||
$dbVersion = $this->AdminSetting->getSetting('db_version');
|
||||
if (!empty($dbVersion) && !empty($dbActualSchema['schema'])) {
|
||||
$dbVersion = $dbVersion['AdminSetting']['value'];
|
||||
$data = array(
|
||||
'schema' => $dbActualSchema['schema'],
|
||||
'indexes' => $dbActualSchema['indexes'],
|
||||
|
|
|
@ -3532,15 +3532,14 @@ class Event extends AppModel
|
|||
|
||||
public function checkEventBlockRules($event)
|
||||
{
|
||||
$this->AdminSetting = ClassRegistry::init('AdminSetting');
|
||||
$setting = $this->AdminSetting->find('first', [
|
||||
'conditions' => ['setting' => 'eventBlockRule'],
|
||||
'recursive' => -1
|
||||
]);
|
||||
if (empty($setting) || empty($setting['AdminSetting']['value'])) {
|
||||
if (!isset($this->AdminSetting)) {
|
||||
$this->AdminSetting = ClassRegistry::init('AdminSetting');
|
||||
}
|
||||
$setting = $this->AdminSetting->getSetting('eventBlockRule');
|
||||
if (empty($setting)) {
|
||||
return true;
|
||||
}
|
||||
$rules = json_decode($setting['AdminSetting']['value'], true);
|
||||
$rules = json_decode($setting, true);
|
||||
if (empty($rules)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -2756,9 +2756,7 @@ class Server extends AppModel
|
|||
public function dbSchemaDiagnostic()
|
||||
{
|
||||
$this->AdminSetting = ClassRegistry::init('AdminSetting');
|
||||
$actualDbVersion = $this->AdminSetting->find('first', array(
|
||||
'conditions' => array('setting' => 'db_version')
|
||||
))['AdminSetting']['value'];
|
||||
$actualDbVersion = $this->AdminSetting->getSetting('db_version');
|
||||
$dataSource = $this->getDataSource()->config['datasource'];
|
||||
$schemaDiagnostic = array(
|
||||
'dataSource' => $dataSource,
|
||||
|
|
|
@ -231,12 +231,8 @@ class User extends AppModel
|
|||
{
|
||||
parent::__construct($id, $table, $ds);
|
||||
$this->AdminSetting = ClassRegistry::init('AdminSetting');
|
||||
$db_version = $this->AdminSetting->find('first', [
|
||||
'recursive' => -1,
|
||||
'conditions' => ['setting' => 'db_version'],
|
||||
'fields' => ['value']
|
||||
]);
|
||||
if ($db_version['AdminSetting']['value'] >= 62) {
|
||||
$db_version = $this->AdminSetting->getSetting('db_version');
|
||||
if ($db_version >= 62) {
|
||||
$this->bindModel([
|
||||
'hasMany' => ['AuthKey']
|
||||
], false);
|
||||
|
|
Loading…
Reference in New Issue