From faa66723f982e37e9e5b0f479bb73d268e64f736 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Tue, 13 Aug 2024 13:23:22 +0200 Subject: [PATCH] Fix the array-unpack PHP error during installation --- .../057_add_ldap_rows_to_settings_table.php | 52 ++++++++++++++++--- 1 file changed, 44 insertions(+), 8 deletions(-) diff --git a/application/migrations/057_add_ldap_rows_to_settings_table.php b/application/migrations/057_add_ldap_rows_to_settings_table.php index 5940161ce8..a752a03323 100644 --- a/application/migrations/057_add_ldap_rows_to_settings_table.php +++ b/application/migrations/057_add_ldap_rows_to_settings_table.php @@ -26,36 +26,72 @@ public function up() ]; if (!$this->db->get_where('settings', ['name' => 'ldap_is_active'])->num_rows()) { - $this->db->insert('settings', [...$timestamps, 'name' => 'ldap_is_active', 'value' => '0']); + $this->db->insert('settings', [ + 'create_datetime' => $timestamps['create_datetime'], + 'update_datetime' => $timestamps['update_datetime'], + 'name' => 'ldap_is_active', + 'value' => '0', + ]); } if (!$this->db->get_where('settings', ['name' => 'ldap_host'])->num_rows()) { - $this->db->insert('settings', [...$timestamps, 'name' => 'ldap_host', 'value' => '']); + $this->db->insert('settings', [ + 'create_datetime' => $timestamps['create_datetime'], + 'update_datetime' => $timestamps['update_datetime'], + 'name' => 'ldap_host', + 'value' => '', + ]); } if (!$this->db->get_where('settings', ['name' => 'ldap_port'])->num_rows()) { - $this->db->insert('settings', [...$timestamps, 'name' => 'ldap_port', 'value' => '']); + $this->db->insert('settings', [ + 'create_datetime' => $timestamps['create_datetime'], + 'update_datetime' => $timestamps['update_datetime'], + 'name' => 'ldap_port', + 'value' => '', + ]); } if (!$this->db->get_where('settings', ['name' => 'ldap_user_dn'])->num_rows()) { - $this->db->insert('settings', [...$timestamps, 'name' => 'ldap_user_dn', 'value' => '']); + $this->db->insert('settings', [ + 'create_datetime' => $timestamps['create_datetime'], + 'update_datetime' => $timestamps['update_datetime'], + 'name' => 'ldap_user_dn', + 'value' => '', + ]); } if (!$this->db->get_where('settings', ['name' => 'ldap_password'])->num_rows()) { - $this->db->insert('settings', [...$timestamps, 'name' => 'ldap_password', 'value' => '']); + $this->db->insert('settings', [ + 'create_datetime' => $timestamps['create_datetime'], + 'update_datetime' => $timestamps['update_datetime'], + 'name' => 'ldap_password', + 'value' => '', + ]); } if (!$this->db->get_where('settings', ['name' => 'ldap_base_dn'])->num_rows()) { - $this->db->insert('settings', [...$timestamps, 'name' => 'ldap_base_dn', 'value' => '']); + $this->db->insert('settings', [ + 'create_datetime' => $timestamps['create_datetime'], + 'update_datetime' => $timestamps['update_datetime'], + 'name' => 'ldap_base_dn', + 'value' => '', + ]); } if (!$this->db->get_where('settings', ['name' => 'ldap_filter'])->num_rows()) { - $this->db->insert('settings', [...$timestamps, 'name' => 'ldap_filter', 'value' => LDAP_DEFAULT_FILTER]); + $this->db->insert('settings', [ + 'create_datetime' => $timestamps['create_datetime'], + 'update_datetime' => $timestamps['update_datetime'], + 'name' => 'ldap_filter', + 'value' => LDAP_DEFAULT_FILTER, + ]); } if (!$this->db->get_where('settings', ['name' => 'ldap_field_mapping'])->num_rows()) { $this->db->insert('settings', [ - ...$timestamps, + 'create_datetime' => $timestamps['create_datetime'], + 'update_datetime' => $timestamps['update_datetime'], 'name' => 'ldap_field_mapping', 'value' => json_encode(LDAP_DEFAULT_FIELD_MAPPING, JSON_PRETTY_PRINT), ]);