chg: [internal] Reduce one SQL query for every request

pull/7889/head
Jakub Onderka 2021-10-25 18:39:09 +02:00
parent fd0faf53d7
commit 3d236bcdea
1 changed files with 3 additions and 3 deletions

View File

@ -231,9 +231,9 @@ class User extends AppModel
public function __construct($id = false, $table = null, $ds = null)
{
parent::__construct($id, $table, $ds);
$this->AdminSetting = ClassRegistry::init('AdminSetting');
$db_version = $this->AdminSetting->getSetting('db_version');
if ($db_version >= 62) {
// bind AuthKey just when authkey table already exists. This is important for updating from old versions
if (in_array('auth_keys', $this->getDataSource()->listSources(), true)) {
$this->bindModel([
'hasMany' => ['AuthKey']
], false);