mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 18:48:21 -07:00
Revert "Datastore improvements"
This commit is contained in:
parent
b8b52f4d05
commit
27be6863fc
19 changed files with 50 additions and 67 deletions
|
@ -55,7 +55,6 @@
|
|||
- Fixed seed bonus accrual [\#1518](https://github.com/torrentpier/torrentpier/pull/1518) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- [BETA] Added emojis support 😄😁 [\#1514](https://github.com/torrentpier/torrentpier/pull/1514) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Pagination with `rel="next"` and `rel="prev"` support [\#1551](https://github.com/torrentpier/torrentpier/pull/1551) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Datastore improvements [\#1538](https://github.com/torrentpier/torrentpier/pull/1538) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Resize user/group avatar image if too large 🌆 [\#1512](https://github.com/torrentpier/torrentpier/pull/1512) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Increased `PASSWORD_MAX_LENGTH` [\#1510](https://github.com/torrentpier/torrentpier/pull/1510) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Bring back forum description in `viewforum.php` [\#1540](https://github.com/torrentpier/torrentpier/pull/1540) ([belomaxorka](https://github.com/belomaxorka))
|
||||
|
|
|
@ -59,7 +59,7 @@ $def_forums = $all_forums;
|
|||
$def_sort = $sort_desc;
|
||||
|
||||
// Moderators data
|
||||
if (!$mod = $datastore->get('moderators') and !$datastore->has('moderators')) {
|
||||
if (!$mod = $datastore->get('moderators')) {
|
||||
$datastore->update('moderators');
|
||||
$mod = $datastore->get('moderators');
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ $users = array($lang['ACTS_LOG_ALL_ACTIONS'] => $all_users) + array_flip($mod['m
|
|||
unset($mod);
|
||||
|
||||
// Forums data
|
||||
if (!$forums = $datastore->get('cat_forums') and !$datastore->has('cat_forums')) {
|
||||
if (!$forums = $datastore->get('cat_forums')) {
|
||||
$datastore->update('cat_forums');
|
||||
$forums = $datastore->get('cat_forums');
|
||||
}
|
||||
|
|
|
@ -181,7 +181,7 @@ if ($mode == 'user' && (!empty($_POST['username']) || $user_id)) {
|
|||
bb_die($lang['NO_SUCH_USER']);
|
||||
}
|
||||
|
||||
if (!$forums = $datastore->get('cat_forums') and !$datastore->has('cat_forums')) {
|
||||
if (!$forums = $datastore->get('cat_forums')) {
|
||||
$datastore->update('cat_forums');
|
||||
$forums = $datastore->get('cat_forums');
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ if ($mode == 'user' && (!empty($_POST['username']) || $user_id)) {
|
|||
bb_die($lang['GROUP_NOT_EXIST']);
|
||||
}
|
||||
|
||||
if (!$forums = $datastore->get('cat_forums') and !$datastore->has('cat_forums')) {
|
||||
if (!$forums = $datastore->get('cat_forums')) {
|
||||
$datastore->update('cat_forums');
|
||||
$forums = $datastore->get('cat_forums');
|
||||
}
|
||||
|
|
|
@ -10,21 +10,19 @@
|
|||
require __DIR__ . '/pagestart.php';
|
||||
|
||||
// Statistics
|
||||
if (!$stats = $datastore->get('stats') and !$datastore->has('stats')) {
|
||||
if (!$stats = $datastore->get('stats')) {
|
||||
$datastore->update('stats');
|
||||
$stats = $datastore->get('stats');
|
||||
}
|
||||
|
||||
// Files integrity check
|
||||
// TODO: Replace with cron update
|
||||
if (!$files_integrity_data = $datastore->get('files_integrity') and !$datastore->has('files_integrity')) {
|
||||
if (!$files_integrity_data = $datastore->get('files_integrity')) {
|
||||
$datastore->update('files_integrity');
|
||||
$files_integrity_data = $datastore->get('files_integrity');
|
||||
}
|
||||
|
||||
// Check for updates
|
||||
// TODO: Replace with cron update
|
||||
if (!$update_data = $datastore->get('check_updates') and !$datastore->has('check_updates')) {
|
||||
if (!$update_data = $datastore->get('check_updates')) {
|
||||
$datastore->update('check_updates');
|
||||
$update_data = $datastore->get('check_updates');
|
||||
}
|
||||
|
|
10
index.php
10
index.php
|
@ -65,13 +65,13 @@ $tracking_topics = get_tracks('topic');
|
|||
$tracking_forums = get_tracks('forum');
|
||||
|
||||
// Statistics
|
||||
if (!$stats = $datastore->get('stats') and !$datastore->has('stats')) {
|
||||
if (!$stats = $datastore->get('stats')) {
|
||||
$datastore->update('stats');
|
||||
$stats = $datastore->get('stats');
|
||||
}
|
||||
|
||||
// Forums data
|
||||
if (!$forums = $datastore->get('cat_forums') and !$datastore->has('cat_forums')) {
|
||||
if (!$forums = $datastore->get('cat_forums')) {
|
||||
$datastore->update('cat_forums');
|
||||
$forums = $datastore->get('cat_forums');
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ if (!$cat_forums = CACHE('bb_cache')->get($cache_name)) {
|
|||
|
||||
// Obtain list of moderators
|
||||
$moderators = [];
|
||||
if (!$mod = $datastore->get('moderators') and !$datastore->has('moderators')) {
|
||||
if (!$mod = $datastore->get('moderators')) {
|
||||
$datastore->update('moderators');
|
||||
$mod = $datastore->get('moderators');
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ if ($bb_cfg['bt_show_dl_stat_on_index'] && !IS_GUEST) {
|
|||
|
||||
// Latest news
|
||||
if ($bb_cfg['show_latest_news']) {
|
||||
if (!$latest_news = $datastore->get('latest_news') and !$datastore->has('latest_news')) {
|
||||
if (!$latest_news = $datastore->get('latest_news')) {
|
||||
$datastore->update('latest_news');
|
||||
$latest_news = $datastore->get('latest_news');
|
||||
}
|
||||
|
@ -340,7 +340,7 @@ if ($bb_cfg['show_latest_news']) {
|
|||
|
||||
// Network news
|
||||
if ($bb_cfg['show_network_news']) {
|
||||
if (!$network_news = $datastore->get('network_news') and !$datastore->has('network_news')) {
|
||||
if (!$network_news = $datastore->get('network_news')) {
|
||||
$datastore->update('network_news');
|
||||
$network_news = $datastore->get('network_news');
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ if (!defined('IN_AJAX')) {
|
|||
|
||||
global $datastore, $lang;
|
||||
|
||||
if (!$ranks = $datastore->get('ranks') and !$datastore->has('ranks')) {
|
||||
if (!$ranks = $datastore->get('ranks')) {
|
||||
$datastore->update('ranks');
|
||||
$ranks = $datastore->get('ranks');
|
||||
}
|
||||
|
|
|
@ -17,19 +17,13 @@ if (!$mode = (string)$this->request['mode']) {
|
|||
$this->ajax_die('invalid mode (empty)');
|
||||
}
|
||||
|
||||
$datastore->enqueue([
|
||||
'stats',
|
||||
'moderators',
|
||||
'cat_forums'
|
||||
]);
|
||||
|
||||
$html = '';
|
||||
switch ($mode) {
|
||||
case 'birthday_week':
|
||||
if (!$stats = $datastore->get('stats') and !$datastore->has('stats')) {
|
||||
$datastore->update('stats');
|
||||
$stats = $datastore->get('stats');
|
||||
}
|
||||
$stats = $datastore->get('stats');
|
||||
$datastore->enqueue([
|
||||
'stats'
|
||||
]);
|
||||
|
||||
$users = [];
|
||||
|
||||
|
@ -44,10 +38,10 @@ switch ($mode) {
|
|||
break;
|
||||
|
||||
case 'birthday_today':
|
||||
if (!$stats = $datastore->get('stats') and !$datastore->has('stats')) {
|
||||
$datastore->update('stats');
|
||||
$stats = $datastore->get('stats');
|
||||
}
|
||||
$stats = $datastore->get('stats');
|
||||
$datastore->enqueue([
|
||||
'stats'
|
||||
]);
|
||||
|
||||
$users = [];
|
||||
|
||||
|
@ -64,12 +58,13 @@ switch ($mode) {
|
|||
case 'get_forum_mods':
|
||||
$forum_id = (int)$this->request['forum_id'];
|
||||
|
||||
if (!$mod = $datastore->get('moderators') and !$datastore->has('moderators')) {
|
||||
$datastore->update('moderators');
|
||||
$mod = $datastore->get('moderators');
|
||||
}
|
||||
$datastore->enqueue([
|
||||
'moderators',
|
||||
'cat_forums'
|
||||
]);
|
||||
|
||||
$moderators = [];
|
||||
$mod = $datastore->get('moderators');
|
||||
|
||||
if (isset($mod['mod_users'][$forum_id])) {
|
||||
foreach ($mod['mod_users'][$forum_id] as $user_id) {
|
||||
|
|
|
@ -116,10 +116,7 @@ function generate_smilies($mode)
|
|||
$user->session_start();
|
||||
}
|
||||
|
||||
if (!$data = $datastore->get('smile_replacements') and !$datastore->has('smile_replacements')) {
|
||||
$datastore->update('smile_replacements');
|
||||
$data = $datastore->get('smile_replacements');
|
||||
}
|
||||
$data = $datastore->get('smile_replacements');
|
||||
|
||||
if ($sql = $data['smile']) {
|
||||
$num_smilies = 0;
|
||||
|
|
|
@ -294,7 +294,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') and !$datastore->has('cat_forums')) {
|
||||
if (!$forums = $datastore->get('cat_forums')) {
|
||||
$datastore->update('cat_forums');
|
||||
$forums = $datastore->get('cat_forums');
|
||||
}
|
||||
|
@ -987,7 +987,7 @@ function make_jumpbox(): void
|
|||
return;
|
||||
}
|
||||
|
||||
if (!$jumpbox = $datastore->get('jumpbox') and !$datastore->has('jumpbox')) {
|
||||
if (!$jumpbox = $datastore->get('jumpbox')) {
|
||||
$datastore->update('jumpbox');
|
||||
$jumpbox = $datastore->get('jumpbox');
|
||||
}
|
||||
|
@ -1008,7 +1008,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') and !$datastore->has('cat_forums')) {
|
||||
if (!$forums = $datastore->get('cat_forums')) {
|
||||
$datastore->update('cat_forums');
|
||||
$forums = $datastore->get('cat_forums');
|
||||
}
|
||||
|
@ -1895,7 +1895,7 @@ function profile_url(array $data, bool $target_blank = false, bool $no_link = fa
|
|||
{
|
||||
global $bb_cfg, $lang, $datastore;
|
||||
|
||||
if (!$ranks = $datastore->get('ranks') and !$datastore->has('ranks')) {
|
||||
if (!$ranks = $datastore->get('ranks')) {
|
||||
$datastore->update('ranks');
|
||||
$ranks = $datastore->get('ranks');
|
||||
}
|
||||
|
@ -2131,7 +2131,7 @@ function getBanInfo(int $userId = null): ?array
|
|||
global $datastore;
|
||||
|
||||
// Get bans info from datastore
|
||||
if (!$bans = $datastore->get('ban_list') and !$datastore->has('ban_list')) {
|
||||
if (!$bans = $datastore->get('ban_list')) {
|
||||
$datastore->update('ban_list');
|
||||
$bans = $datastore->get('ban_list');
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ if (!$profiledata = get_userdata($_GET[POST_USERS_URL], profile_view: true)) {
|
|||
bb_die($lang['NO_USER_ID_SPECIFIED']);
|
||||
}
|
||||
|
||||
if (!$ranks = $datastore->get('ranks') and !$datastore->has('ranks')) {
|
||||
if (!$ranks = $datastore->get('ranks')) {
|
||||
$datastore->update('ranks');
|
||||
$ranks = $datastore->get('ranks');
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ $tracker_tbl = BB_BT_TRACKER . ' tr';
|
|||
$users_tbl = BB_USERS . ' u';
|
||||
|
||||
// Cat/forum data
|
||||
if (!$forums = $datastore->get('cat_forums') and !$datastore->has('cat_forums')) {
|
||||
if (!$forums = $datastore->get('cat_forums')) {
|
||||
$datastore->update('cat_forums');
|
||||
$forums = $datastore->get('cat_forums');
|
||||
}
|
||||
|
|
|
@ -41,11 +41,15 @@ class Censor
|
|||
}
|
||||
|
||||
// Get censored words
|
||||
if (!$censoredWords = $datastore->get('censor') and !$datastore->has('censor')) {
|
||||
if (!$censoredWords = $datastore->get('censor')) {
|
||||
$datastore->update('censor');
|
||||
$censoredWords = $datastore->get('censor');
|
||||
}
|
||||
|
||||
if (isset($censoredWords['no_words'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($censoredWords as $word) {
|
||||
$this->words[] = '#(?<![\p{Nd}\p{L}_])(' . str_replace('\*', '[\p{Nd}\p{L}_]*?', preg_quote($word['word'], '#')) . ')(?![\p{Nd}\p{L}_])#iu';
|
||||
$this->replacements[] = $word['replacement'];
|
||||
|
|
|
@ -338,8 +338,7 @@ class BBCode
|
|||
{
|
||||
global $datastore;
|
||||
|
||||
if (!$this->smilies = $datastore->get('smile_replacements') and !$datastore->has('smile_replacements')) {
|
||||
$datastore->update('smile_replacements');
|
||||
if (null === $this->smilies) {
|
||||
$this->smilies = $datastore->get('smile_replacements');
|
||||
}
|
||||
|
||||
|
|
|
@ -708,7 +708,7 @@ class User
|
|||
return '';
|
||||
}
|
||||
|
||||
if (!$forums = $datastore->get('cat_forums') and !$datastore->has('cat_forums')) {
|
||||
if (!$forums = $datastore->get('cat_forums')) {
|
||||
$datastore->update('cat_forums');
|
||||
$forums = $datastore->get('cat_forums');
|
||||
}
|
||||
|
@ -771,7 +771,7 @@ class User
|
|||
if (bf($this->opt, 'user_opt', 'user_porn_forums')) {
|
||||
global $datastore;
|
||||
|
||||
if (!$forums = $datastore->get('cat_forums') and !$datastore->has('cat_forums')) {
|
||||
if (!$forums = $datastore->get('cat_forums')) {
|
||||
$datastore->update('cat_forums');
|
||||
$forums = $datastore->get('cat_forums');
|
||||
}
|
||||
|
|
|
@ -79,15 +79,6 @@ class Common
|
|||
return $this->data[$title];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $title
|
||||
* @return bool
|
||||
*/
|
||||
public function has($title): bool
|
||||
{
|
||||
return isset($this->data[$title]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store data into cache
|
||||
*
|
||||
|
|
|
@ -31,7 +31,7 @@ class Sitemap
|
|||
|
||||
$forumUrls = [];
|
||||
|
||||
if (!$forums = $datastore->get('cat_forums') and !$datastore->has('cat_forums')) {
|
||||
if (!$forums = $datastore->get('cat_forums')) {
|
||||
$datastore->update('cat_forums');
|
||||
$forums = $datastore->get('cat_forums');
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ class Sitemap
|
|||
|
||||
$topicUrls = [];
|
||||
|
||||
if (!$forums = $datastore->get('cat_forums') and !$datastore->has('cat_forums')) {
|
||||
if (!$forums = $datastore->get('cat_forums')) {
|
||||
$datastore->update('cat_forums');
|
||||
$forums = $datastore->get('cat_forums');
|
||||
}
|
||||
|
|
|
@ -333,7 +333,7 @@ if ($search_id) {
|
|||
}
|
||||
|
||||
// Get allowed for searching forums list
|
||||
if (!$forums = $datastore->get('cat_forums') and !$datastore->has('cat_forums')) {
|
||||
if (!$forums = $datastore->get('cat_forums')) {
|
||||
$datastore->update('cat_forums');
|
||||
$forums = $datastore->get('cat_forums');
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ define('REQUESTED_PAGE', $req_page);
|
|||
caching_output(IS_GUEST, 'send', REQUESTED_PAGE . '_guest');
|
||||
|
||||
set_die_append_msg();
|
||||
if (!$forums = $datastore->get('cat_forums') and !$datastore->has('cat_forums')) {
|
||||
if (!$forums = $datastore->get('cat_forums')) {
|
||||
$datastore->update('cat_forums');
|
||||
$forums = $datastore->get('cat_forums');
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ if ($mark_read && !IS_GUEST) {
|
|||
// Subforums
|
||||
$show_subforums = $bb_cfg['sf_on_first_page_only'] ? !$start : true;
|
||||
|
||||
if (!$forums = $datastore->get('cat_forums') and !$datastore->has('cat_forums')) {
|
||||
if (!$forums = $datastore->get('cat_forums')) {
|
||||
$datastore->update('cat_forums');
|
||||
$forums = $datastore->get('cat_forums');
|
||||
}
|
||||
|
|
|
@ -200,7 +200,7 @@ if ($is_auth['auth_mod']) {
|
|||
|
||||
if ($moderation) {
|
||||
if (IS_ADMIN) {
|
||||
if (!$forum_select = $datastore->get('viewtopic_forum_select') and !$datastore->has('viewtopic_forum_select')) {
|
||||
if (!$forum_select = $datastore->get('viewtopic_forum_select')) {
|
||||
$datastore->update('viewtopic_forum_select');
|
||||
$forum_select = $datastore->get('viewtopic_forum_select');
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ if ($moderation) {
|
|||
$template->assign_vars(['S_FORUM_SELECT' => $forum_select_html]);
|
||||
}
|
||||
|
||||
if (!$forums = $datastore->get('cat_forums') and !$datastore->has('cat_forums')) {
|
||||
if (!$forums = $datastore->get('cat_forums')) {
|
||||
$datastore->update('cat_forums');
|
||||
$forums = $datastore->get('cat_forums');
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ if ($postrow = DB()->fetch_rowset($sql)) {
|
|||
bb_die($lang['NO_POSTS_TOPIC']);
|
||||
}
|
||||
|
||||
if (!$ranks = $datastore->get('ranks') and !$datastore->has('ranks')) {
|
||||
if (!$ranks = $datastore->get('ranks')) {
|
||||
$datastore->update('ranks');
|
||||
$ranks = $datastore->get('ranks');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue