Skip to content

Commit

Permalink
Fix the array-unpack PHP error during installation
Browse files Browse the repository at this point in the history
  • Loading branch information
alextselegidis committed Aug 13, 2024
1 parent 58f53b1 commit faa6672
Showing 1 changed file with 44 additions and 8 deletions.
52 changes: 44 additions & 8 deletions application/migrations/057_add_ldap_rows_to_settings_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -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),
]);
Expand Down

0 comments on commit faa6672

Please sign in to comment.