Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: fluxbb/fluxbb
...
head fork: fluxbb/fluxbb
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 6 files changed
  • 0 commit comments
  • 1 contributor
View
8 footer.php
@@ -68,9 +68,7 @@
// Display the "Jump to" drop list
if ($pun_config['o_quickjump'] == '1')
{
- $quickjump = $cache->get('quickjump');
- if ($quickjump === \fluxbb\cache\Cache::NOT_FOUND)
- {
+ $quickjump = $cache->remember('quickjump', function() use ($db) {
$quickjump = array();
// Generate the quick jump cache for all groups
@@ -101,8 +99,8 @@
unset ($result, $query_forums);
- $cache->set('quickjump', $quickjump);
- }
+ return $quickjump;
+ });
if (!empty($quickjump[$pun_user['g_id']]))
{
View
8 header.php
@@ -233,9 +233,7 @@ function process_form(the_form)
{
if ($pun_config['o_report_method'] == '0' || $pun_config['o_report_method'] == '2')
{
- $num_reports = $cache->get('num_reports');
- if ($num_reports === \fluxbb\cache\Cache::NOT_FOUND)
- {
+ $num_reports = $cache->remember('num_reports', function() use ($db) {
$query = $db->select(array('num_reports' => 'COUNT(r.id) AS num_reports'), 'reports AS r');
$query->where = 'r.zapped IS NULL';
@@ -245,8 +243,8 @@ function process_form(the_form)
$num_reports = $result[0]['num_reports'];
unset ($result, $query, $params);
- $cache->set('num_reports', $num_reports);
- }
+ return $num_reports;
+ });
if ($num_reports > 0)
$page_statusinfo[] = '<li class="reportlink"><span><strong><a href="admin_reports.php">'.$lang->t('New reports').'</a></strong></span></li>';
View
22 include/common.php
@@ -114,10 +114,8 @@ function stripslashes_array($array)
$db->startTransaction();
// Load cached config
-$pun_config = $cache->get('config');
-if ($pun_config === \fluxbb\cache\Cache::NOT_FOUND)
-{
- $pun_config = array();
+$pun_config = $cache->remember('config', function() use ($db) {
+ $cfg = array();
// Get the forum config from the DB
$query = $db->select(array('conf_name' => 'c.conf_name', 'conf_value' => 'c.conf_value'), 'config AS c');
@@ -125,12 +123,12 @@ function stripslashes_array($array)
$result = $query->run($params);
foreach ($result as $cur_config_item)
- $pun_config[$cur_config_item['conf_name']] = $cur_config_item['conf_value'];
+ $cfg[$cur_config_item['conf_name']] = $cur_config_item['conf_value'];
unset ($query, $params, $result);
- $cache->set('config', $pun_config);
-}
+ return $cfg;
+});
// Verify that we are running the proper database schema revision
/*if (!isset($pun_config['o_database_revision']) || $pun_config['o_database_revision'] < FORUM_DB_REVISION ||
@@ -173,18 +171,16 @@ function stripslashes_array($array)
maintenance_message();
// Load cached bans
-$pun_bans = $cache->get('bans');
-if ($pun_bans === \fluxbb\cache\Cache::NOT_FOUND)
-{
+$pun_bans = $cache->remember('bans', function() use ($db) {
// Get the ban list from the DB
$query = $db->select(array('id' => 'b.id', 'username' => 'b.username', 'ip' => 'b.ip', 'email' => 'b.email', 'message' => 'b.message', 'expire' => 'b.expire', 'ban_creator' => 'b.ban_creator'), 'bans AS b');
$params = array();
- $pun_bans = $query->run($params);
+ $bans = $query->run($params);
unset ($query, $params);
- $cache->set('bans', $pun_bans);
-}
+ return $bans;
+});
// Check if current user is banned
check_bans();
View
30 include/functions.php
@@ -14,9 +14,7 @@ function fetch_board_stats()
{
global $cache, $db;
- $stats = $cache->get('boardstats');
- if ($stats === \fluxbb\cache\Cache::NOT_FOUND)
- {
+ return $cache->remember('boardstats', function() use ($db) {
$stats = array();
// Count total registered users
@@ -39,10 +37,8 @@ function fetch_board_stats()
$stats['last_user'] = current($query->run($params));
unset ($query, $params);
- $cache->set('boardstats', $stats);
- }
-
- return $stats;
+ return $stats;
+ });
}
@@ -1014,9 +1010,7 @@ function censor_words($text)
// If not already built in a previous call, build an array of censor words and their replacement text
if (!isset($censors))
{
- $censors = $cache->get('censors');
- if ($censors === \fluxbb\cache\Cache::NOT_FOUND)
- {
+ $censors = $cache->remember('censors', function() use ($db) {
$censors = array();
$query = $db->select(array('search_for' => 'c.search_for', 'replace_with' => 'c.replace_with'), 'censoring AS c');
@@ -1030,8 +1024,8 @@ function censor_words($text)
}
unset ($result, $query, $params);
- $cache->set('censors', $censors);
- }
+ return $censors;
+ });
}
if (!empty($censors))
@@ -1062,10 +1056,8 @@ function get_title($user)
// If not already loaded in a previous call, load the cached ranks
if ($pun_config['o_ranks'] == '1' && !isset($pun_ranks))
{
- $pun_ranks = $cache->get('ranks');
- if ($pun_ranks === \fluxbb\cache\Cache::NOT_FOUND)
- {
- $pun_ranks = array();
+ $pun_ranks = $cache->remember('ranks', function() use ($db) {
+ $ranks = array();
// Get the rank list from the DB
$query = $db->select(array('ranks' => 'r.*'), 'ranks AS r');
@@ -1073,11 +1065,11 @@ function get_title($user)
$params = array();
- $pun_ranks = $query->run($params);
+ $ranks = $query->run($params);
unset ($query, $params);
- $cache->set('ranks', $pun_ranks);
- }
+ return $ranks;
+ });
}
// If the user has a custom title
View
8 include/search_idx.php
@@ -90,9 +90,7 @@ function validate_search_word($word, $idx)
{
$cache_id = generate_stopwords_cache_id();
- $stopwords = $cache->get('stopwords.'.$cache_id);
- if ($stopwords === \fluxbb\cache\Cache::NOT_FOUND)
- {
+ $stopwords = $cache->remember('stopwords.'.$cache_id, function() {
$stopwords = array();
$d = dir(PUN_ROOT.'lang');
@@ -110,8 +108,8 @@ function validate_search_word($word, $idx)
$stopwords = array_map('pun_trim', $stopwords);
$stopwords = array_filter($stopwords);
- $cache->set('stopwords.'.$cache_id, $stopwords);
- }
+ return $stopwords;
+ });
}
// If it is a stopword it isn't valid
2  modules/cache
@@ -1 +1 @@
-Subproject commit 383c7cf924199bdaff6f426c314309c01e6e6fb1
+Subproject commit 11b5af48e959b63f0bf3272cff9da26b852f711b

No commit comments for this range

Something went wrong with that request. Please try again.