Datastore improvements (#1538)

* Datastore improvements

* Updated

* Update functions.php

* Updated

* Updated

* Updated

* Update index.php

* Update index.php

* Update index.php

* Update index.php

* Update viewtopic.php

* Update functions.php

* Updated

* Updated

* Revert "Updated"

This reverts commit 0ff7d4ac60.

* Revert "Updated"

This reverts commit 8d637dff6c.

* Update index_data.php

* Update index_data.php

* Update index_data.php

* Updated

* Update CHANGELOG.md
This commit is contained in:
Roman Kelesidis 2024-07-13 14:26:34 +07:00 committed by GitHub
commit c7f2223f7f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 67 additions and 50 deletions

View file

@ -296,7 +296,7 @@ function auth($type, $forum_id, $ug_data, array $f_access = [], $group_perm = UG
// If f_access has been passed, or auth is needed to return an array of forums
// then we need to pull the auth information on the given forum (or all forums)
if (empty($f_access)) {
if (!$forums = $datastore->get('cat_forums')) {
if (!$forums = $datastore->get('cat_forums') and !$datastore->has('cat_forums')) {
$datastore->update('cat_forums');
$forums = $datastore->get('cat_forums');
}
@ -997,7 +997,7 @@ function make_jumpbox(): void
return;
}
if (!$jumpbox = $datastore->get('jumpbox')) {
if (!$jumpbox = $datastore->get('jumpbox') and !$datastore->has('jumpbox')) {
$datastore->update('jumpbox');
$jumpbox = $datastore->get('jumpbox');
}
@ -1018,7 +1018,7 @@ function get_forum_select($mode = 'guest', $name = POST_FORUM_URL, $selected = n
$max_length = HTML_SELECT_MAX_LENGTH;
}
$select = null === $all_forums_option ? [] : [$lang['ALL_AVAILABLE'] => $all_forums_option];
if (!$forums = $datastore->get('cat_forums')) {
if (!$forums = $datastore->get('cat_forums') and !$datastore->has('cat_forums')) {
$datastore->update('cat_forums');
$forums = $datastore->get('cat_forums');
}
@ -1893,7 +1893,7 @@ function profile_url(array $data, bool $target_blank = false, bool $no_link = fa
{
global $bb_cfg, $lang, $datastore;
if (!$ranks = $datastore->get('ranks')) {
if (!$ranks = $datastore->get('ranks') and !$datastore->has('ranks')) {
$datastore->update('ranks');
$ranks = $datastore->get('ranks');
}
@ -2129,7 +2129,7 @@ function getBanInfo(int $userId = null): ?array
global $datastore;
// Get bans info from datastore
if (!$bans = $datastore->get('ban_list')) {
if (!$bans = $datastore->get('ban_list') and !$datastore->has('ban_list')) {
$datastore->update('ban_list');
$bans = $datastore->get('ban_list');
}