Zeile 51 | Zeile 51 |
---|
* @var string */ public $cache_debug;
|
* @var string */ public $cache_debug;
|
| /** * @var array */ public $moderators;
/** * @var array */ public $built_moderators;
/** * @var array */ public $moderators_forum_cache;
|
/** * Build cache data.
| /** * Build cache data.
|
Zeile 118 | Zeile 133 |
---|
// Database cache $query = $db->simple_select("datacache", "title,cache"); while($data = $db->fetch_array($query))
|
// Database cache $query = $db->simple_select("datacache", "title,cache"); while($data = $db->fetch_array($query))
|
{ $this->cache[$data['title']] = unserialize($data['cache']); }
| { // use native_unserialize() over my_unserialize() for performance reasons $this->cache[$data['title']] = native_unserialize($data['cache']); }
|
} }
|
} }
|
|
|
/** * Read cache from files or db. *
| /** * Read cache from files or db. *
|
Zeile 137 | Zeile 153 |
---|
// Already have this cache and we're not doing a hard refresh? Return cached copy if(isset($this->cache[$name]) && $hard == false)
|
// Already have this cache and we're not doing a hard refresh? Return cached copy if(isset($this->cache[$name]) && $hard == false)
|
{
| {
|
return $this->cache[$name]; } // If we're not hard refreshing, and this cache doesn't exist, return false
| return $this->cache[$name]; } // If we're not hard refreshing, and this cache doesn't exist, return false
|
Zeile 173 | Zeile 189 |
---|
// Fetch from database $query = $db->simple_select("datacache", "title,cache", "title='".$db->escape_string($name)."'"); $cache_data = $db->fetch_array($query);
|
// Fetch from database $query = $db->simple_select("datacache", "title,cache", "title='".$db->escape_string($name)."'"); $cache_data = $db->fetch_array($query);
|
$data = my_unserialize($cache_data['cache']);
| |
|
|
// Update cache for handler get_execution_time();
| if($cache_data) { // use native_unserialize() over my_unserialize() for performance reasons $data = native_unserialize($cache_data['cache']);
// Update cache for handler get_execution_time();
|
|
|
$hit = $this->handler->put($name, $data);
| $hit = $this->handler->put($name, $data);
|
|
|
$call_time = get_execution_time(); $this->call_time += $call_time; $this->call_count++;
| $call_time = get_execution_time(); $this->call_time += $call_time; $this->call_count++;
|
|
|
if($mybb->debug_mode)
| if($mybb->debug_mode) { $this->debug_call('set:'.$name, $call_time, $hit); } } else
|
{
|
{
|
$this->debug_call('set:'.$name, $call_time, $hit);
| $data = false;
|
} } }
| } } }
|
Zeile 195 | Zeile 220 |
---|
{ $query = $db->simple_select("datacache", "title,cache", "title='$name'"); $cache_data = $db->fetch_array($query);
|
{ $query = $db->simple_select("datacache", "title,cache", "title='$name'"); $cache_data = $db->fetch_array($query);
|
if(!$cache_data['title'])
| if(empty($cache_data['title']))
|
{ $data = false; } else {
|
{ $data = false; } else {
|
$data = unserialize($cache_data['cache']);
| // use native_unserialize() over my_unserialize() for performance reasons $data = native_unserialize($cache_data['cache']);
|
} }
| } }
|
Zeile 461 | Zeile 487 |
---|
$version = array( "version" => $mybb->version, "version_code" => $mybb->version_code
|
$version = array( "version" => $mybb->version, "version_code" => $mybb->version_code
|
);
| );
|
$this->update("version", $version); }
| $this->update("version", $version); }
|
Zeile 491 | Zeile 517 |
---|
* */ function update_smilies()
|
* */ function update_smilies()
|
{ global $db;
| { global $db;
|
$smilies = array();
| $smilies = array();
|
Zeile 507 | Zeile 533 |
---|
/** * Update the posticon cache.
|
/** * Update the posticon cache.
|
* */
| * */
|
function update_posticons() { global $db;
|
function update_posticons() { global $db;
|
$icons = array();
| $icons = array();
|
$query = $db->simple_select("icons", "iid, name, path"); while($icon = $db->fetch_array($query)) { $icons[$icon['iid']] = $icon; }
|
$query = $db->simple_select("icons", "iid, name, path"); while($icon = $db->fetch_array($query)) { $icons[$icon['iid']] = $icon; }
|
|
|
$this->update("posticons", $icons);
|
$this->update("posticons", $icons);
|
}
| }
|
/** * Update the badwords cache. *
| /** * Update the badwords cache. *
|
Zeile 532 | Zeile 558 |
---|
{ global $db;
|
{ global $db;
|
$badwords = array();
| $badwords = array();
|
$query = $db->simple_select("badwords", "*"); while($badword = $db->fetch_array($query)) { $badwords[$badword['bid']] = $badword;
|
$query = $db->simple_select("badwords", "*"); while($badword = $db->fetch_array($query)) { $badwords[$badword['bid']] = $badword;
|
}
| }
|
$this->update("badwords", $badwords); }
| $this->update("badwords", $badwords); }
|
Zeile 555 | Zeile 581 |
---|
$gs = array(); while($g = $db->fetch_array($query))
|
$gs = array(); while($g = $db->fetch_array($query))
|
{
| {
|
$gs[$g['gid']] = $g; }
| $gs[$g['gid']] = $g; }
|
Zeile 587 | Zeile 613 |
---|
foreach($forum_cache as $fid => $forum) { $this->forum_permissions_forum_cache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;
|
foreach($forum_cache as $fid => $forum) { $this->forum_permissions_forum_cache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;
|
}
// Sort children foreach($fcache as $pid => $value) { ksort($fcache[$pid]); }
| }
// Sort children foreach($fcache as $pid => $value) { ksort($fcache[$pid]); }
|
ksort($fcache);
// Fetch forum permissions from the database
| ksort($fcache);
// Fetch forum permissions from the database
|
Zeile 618 | Zeile 644 |
---|
*/ private function build_forum_permissions($permissions=array(), $pid=0) {
|
*/ private function build_forum_permissions($permissions=array(), $pid=0) {
|
$usergroups = array_keys($this->read("usergroups", true)); if($this->forum_permissions_forum_cache[$pid])
| $usergroups = $this->read("usergroups", true);
if($usergroups === false) { $usergroups = array(); } $usergroups = array_keys($usergroups); if(!empty($this->forum_permissions_forum_cache[$pid]))
|
{ foreach($this->forum_permissions_forum_cache[$pid] as $main) {
| { foreach($this->forum_permissions_forum_cache[$pid] as $main) {
|
Zeile 629 | Zeile 662 |
---|
foreach($usergroups as $gid) { if(isset($this->forum_permissions[$forum['fid']][$gid]) && $this->forum_permissions[$forum['fid']][$gid])
|
foreach($usergroups as $gid) { if(isset($this->forum_permissions[$forum['fid']][$gid]) && $this->forum_permissions[$forum['fid']][$gid])
|
{
| {
|
$perms[$gid] = $this->forum_permissions[$forum['fid']][$gid];
|
$perms[$gid] = $this->forum_permissions[$forum['fid']][$gid];
|
} if($perms[$gid])
| } if(!empty($perms[$gid]))
|
{ $perms[$gid]['fid'] = $forum['fid']; $this->built_forum_permissions[$forum['fid']][$gid] = $perms[$gid];
| { $perms[$gid]['fid'] = $forum['fid']; $this->built_forum_permissions[$forum['fid']][$gid] = $perms[$gid];
|
Zeile 646 | Zeile 679 |
---|
/** * Update the stats cache (kept for the sake of being able to rebuild this cache via the cache interface)
|
/** * Update the stats cache (kept for the sake of being able to rebuild this cache via the cache interface)
|
*
| *
|
*/ function update_stats()
|
*/ function update_stats()
|
{
| {
|
require_once MYBB_ROOT."inc/functions_rebuild.php"; rebuild_stats(); }
|
require_once MYBB_ROOT."inc/functions_rebuild.php"; rebuild_stats(); }
|
|
|
/** * Update the statistics cache *
| /** * Update the statistics cache *
|
Zeile 663 | Zeile 696 |
---|
global $db;
$query = $db->simple_select('users', 'uid, username, referrals', 'referrals>0', array('order_by' => 'referrals', 'order_dir' => 'DESC', 'limit' => 1));
|
global $db;
$query = $db->simple_select('users', 'uid, username, referrals', 'referrals>0', array('order_by' => 'referrals', 'order_dir' => 'DESC', 'limit' => 1));
|
$topreferrer = $db->fetch_array($query);
| $topreferrer = $db->fetch_array($query);
|
$timesearch = TIME_NOW - 86400;
|
$timesearch = TIME_NOW - 86400;
|
switch($db->type) { case 'pgsql': $group_by = $db->build_fields_string('users', 'u.'); break; default: $group_by = 'p.uid'; break; }
| |
$query = $db->query(" SELECT u.uid, u.username, COUNT(*) AS poststoday FROM {$db->table_prefix}posts p LEFT JOIN {$db->table_prefix}users u ON (p.uid=u.uid) WHERE p.dateline > {$timesearch} AND p.visible=1
|
$query = $db->query(" SELECT u.uid, u.username, COUNT(*) AS poststoday FROM {$db->table_prefix}posts p LEFT JOIN {$db->table_prefix}users u ON (p.uid=u.uid) WHERE p.dateline > {$timesearch} AND p.visible=1
|
GROUP BY {$group_by}
| GROUP BY u.uid, u.username
|
ORDER BY poststoday DESC ");
| ORDER BY poststoday DESC ");
|
Zeile 719 | Zeile 743 |
---|
global $forum_cache, $db;
$this->built_moderators = array(0);
|
global $forum_cache, $db;
$this->built_moderators = array(0);
|
|
|
// Get our forum list cache_forums(true); if(!is_array($forum_cache)) { return false;
|
// Get our forum list cache_forums(true); if(!is_array($forum_cache)) { return false;
|
}
| }
|
reset($forum_cache); $fcache = array();
| reset($forum_cache); $fcache = array();
|
Zeile 734 | Zeile 758 |
---|
foreach($forum_cache as $fid => $forum) { $this->moderators_forum_cache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;
|
foreach($forum_cache as $fid => $forum) { $this->moderators_forum_cache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;
|
}
| }
|
// Sort children foreach($fcache as $pid => $value) {
| // Sort children foreach($fcache as $pid => $value) {
|
Zeile 779 | Zeile 803 |
---|
$this->moderators[$moderator['fid']]['usergroups'][$moderator['id']] = $moderator; }
|
$this->moderators[$moderator['fid']]['usergroups'][$moderator['id']] = $moderator; }
|
if(is_array($this->moderators))
| foreach(array_keys($this->moderators) as $fid)
|
{
|
{
|
foreach(array_keys($this->moderators) as $fid)
| if(isset($this->moderators[$fid]['users']))
|
{
|
{
|
uasort($this->moderators[$fid], 'sort_moderators_by_usernames');
| uasort($this->moderators[$fid]['users'], 'sort_moderators_by_usernames');
|
} }
| } }
|
Zeile 1130 | Zeile 1154 |
---|
if($bday['birthdayprivacy'] != 'all') {
|
if($bday['birthdayprivacy'] != 'all') {
|
++$birthdays[$bday['bday']]['hiddencount'];
| if(isset($birthdays[$bday['bday']]['hiddencount'])) { ++$birthdays[$bday['bday']]['hiddencount']; } else { $birthdays[$bday['bday']]['hiddencount'] = 1; }
|
continue;
|
continue;
|
}
| }
|
// We don't need any excess caleries in the cache unset($bday['birthdayprivacy']);
|
// We don't need any excess caleries in the cache unset($bday['birthdayprivacy']);
|
| if(!isset($birthdays[$bday['bday']]['users'])) { $birthdays[$bday['bday']]['users'] = array(); }
|
$birthdays[$bday['bday']]['users'][] = $bday; }
| $birthdays[$bday['bday']]['users'][] = $bday; }
|
Zeile 1293 | Zeile 1329 |
---|
global $db;
$query = $db->simple_select("datacache", "title,cache", "title='mostonline'");
|
global $db;
$query = $db->simple_select("datacache", "title,cache", "title='mostonline'");
|
$this->update("mostonline", unserialize($db->fetch_field($query, "cache")));
| $this->update("mostonline", my_unserialize($db->fetch_field($query, "cache")));
|
}
function reload_plugins()
| }
function reload_plugins()
|
Zeile 1301 | Zeile 1337 |
---|
global $db;
$query = $db->simple_select("datacache", "title,cache", "title='plugins'");
|
global $db;
$query = $db->simple_select("datacache", "title,cache", "title='plugins'");
|
$this->update("plugins", unserialize($db->fetch_field($query, "cache")));
| $this->update("plugins", my_unserialize($db->fetch_field($query, "cache")));
|
}
function reload_last_backup()
| }
function reload_last_backup()
|
Zeile 1309 | Zeile 1345 |
---|
global $db;
$query = $db->simple_select("datacache", "title,cache", "title='last_backup'");
|
global $db;
$query = $db->simple_select("datacache", "title,cache", "title='last_backup'");
|
$this->update("last_backup", unserialize($db->fetch_field($query, "cache")));
| $this->update("last_backup", my_unserialize($db->fetch_field($query, "cache")));
|
}
function reload_internal_settings()
| }
function reload_internal_settings()
|
Zeile 1317 | Zeile 1353 |
---|
global $db;
$query = $db->simple_select("datacache", "title,cache", "title='internal_settings'");
|
global $db;
$query = $db->simple_select("datacache", "title,cache", "title='internal_settings'");
|
$this->update("internal_settings", unserialize($db->fetch_field($query, "cache")));
| $this->update("internal_settings", my_unserialize($db->fetch_field($query, "cache")));
|
}
function reload_version_history()
| }
function reload_version_history()
|
Zeile 1325 | Zeile 1361 |
---|
global $db;
$query = $db->simple_select("datacache", "title,cache", "title='version_history'");
|
global $db;
$query = $db->simple_select("datacache", "title,cache", "title='version_history'");
|
$this->update("version_history", unserialize($db->fetch_field($query, "cache")));
| $this->update("version_history", my_unserialize($db->fetch_field($query, "cache")));
|
}
function reload_modnotes()
| }
function reload_modnotes()
|
Zeile 1333 | Zeile 1369 |
---|
global $db;
$query = $db->simple_select("datacache", "title,cache", "title='modnotes'");
|
global $db;
$query = $db->simple_select("datacache", "title,cache", "title='modnotes'");
|
$this->update("modnotes", unserialize($db->fetch_field($query, "cache")));
| $this->update("modnotes", my_unserialize($db->fetch_field($query, "cache")));
|
}
function reload_adminnotes()
| }
function reload_adminnotes()
|
Zeile 1341 | Zeile 1377 |
---|
global $db;
$query = $db->simple_select("datacache", "title,cache", "title='adminnotes'");
|
global $db;
$query = $db->simple_select("datacache", "title,cache", "title='adminnotes'");
|
$this->update("adminnotes", unserialize($db->fetch_field($query, "cache")));
| $this->update("adminnotes", my_unserialize($db->fetch_field($query, "cache")));
|
} }
| } }
|