Zeile 93 | Zeile 93 |
---|
case "apc": require_once MYBB_ROOT."/inc/cachehandlers/apc.php"; $this->handler = new apcCacheHandler();
|
case "apc": require_once MYBB_ROOT."/inc/cachehandlers/apc.php"; $this->handler = new apcCacheHandler();
|
| break; // APCu cache case "apcu": require_once MYBB_ROOT."/inc/cachehandlers/apcu.php"; $this->handler = new apcuCacheHandler(); break; // Redis cache case "redis": require_once MYBB_ROOT."/inc/cachehandlers/redis.php"; $this->handler = new redisCacheHandler();
|
break; }
if($this->handler instanceof CacheHandlerInterface)
|
break; }
if($this->handler instanceof CacheHandlerInterface)
|
{
| {
|
if(!$this->handler->connect())
|
if(!$this->handler->connect())
|
{
| {
|
$this->handler = null;
|
$this->handler = null;
|
}
| }
|
} else {
| } else {
|
Zeile 110 | Zeile 120 |
---|
while($data = $db->fetch_array($query)) { $this->cache[$data['title']] = unserialize($data['cache']);
|
while($data = $db->fetch_array($query)) { $this->cache[$data['title']] = unserialize($data['cache']);
|
}
| }
|
} }
| } }
|
Zeile 129 | Zeile 139 |
---|
if(isset($this->cache[$name]) && $hard == false) { return $this->cache[$name];
|
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 // It would have been loaded pre-global if it did exist anyway... else if($hard == false && !($this->handler instanceof CacheHandlerInterface))
|
// If we're not hard refreshing, and this cache doesn't exist, return false // It would have been loaded pre-global if it did exist anyway... else if($hard == false && !($this->handler instanceof CacheHandlerInterface))
|
{ return false; }
if($this->handler instanceof CacheHandlerInterface) { get_execution_time();
$data = $this->handler->fetch($name);
$call_time = get_execution_time(); $this->call_time += $call_time; $this->call_count++;
if($mybb->debug_mode)
| { return false; }
if($this->handler instanceof CacheHandlerInterface) { get_execution_time();
$data = $this->handler->fetch($name);
$call_time = get_execution_time(); $this->call_time += $call_time; $this->call_count++;
if($mybb->debug_mode)
|
{ $hit = true; if($data === false)
| { $hit = true; if($data === false)
|
Zeile 163 | Zeile 173 |
---|
// 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 = unserialize($cache_data['cache']);
| $data = my_unserialize($cache_data['cache']);
|
// Update cache for handler get_execution_time();
|
// Update cache for handler get_execution_time();
|
|
|
$hit = $this->handler->put($name, $data);
$call_time = get_execution_time();
| $hit = $this->handler->put($name, $data);
$call_time = get_execution_time();
|
Zeile 204 | Zeile 214 |
---|
return $data; } else
|
return $data; } else
|
{
| {
|
return false; } }
| return false; } }
|
Zeile 213 | Zeile 223 |
---|
* Update cache contents. * * @param string $name The cache content identifier.
|
* Update cache contents. * * @param string $name The cache content identifier.
|
* @param string $contents The cache content.
| * @param mixed $contents The cache content.
|
*/ function update($name, $contents) {
| */ function update($name, $contents) {
|
Zeile 222 | Zeile 232 |
---|
$this->cache[$name] = $contents;
// We ALWAYS keep a running copy in the db just incase we need it
|
$this->cache[$name] = $contents;
// We ALWAYS keep a running copy in the db just incase we need it
|
$dbcontents = $db->escape_string(serialize($contents));
| $dbcontents = $db->escape_string(my_serialize($contents));
|
$replace_array = array( "title" => $db->escape_string($name),
| $replace_array = array( "title" => $db->escape_string($name),
|
Zeile 244 | Zeile 254 |
---|
if($mybb->debug_mode) { $this->debug_call('update:'.$name, $call_time, $hit);
|
if($mybb->debug_mode) { $this->debug_call('update:'.$name, $call_time, $hit);
|
} } }
| } } }
|
/** * Delete cache contents. * Originally from frostschutz's PluginLibrary
| /** * Delete cache contents. * Originally from frostschutz's PluginLibrary
|
Zeile 258 | Zeile 268 |
---|
*/ function delete($name, $greedy = false) {
|
*/ function delete($name, $greedy = false) {
|
global $db, $mybb, $cache;
| global $db, $mybb, $cache;
|
// Prepare for database query. $dbname = $db->escape_string($name);
| // Prepare for database query. $dbname = $db->escape_string($name);
|
Zeile 550 | Zeile 560 |
---|
}
$this->update("usergroups", $gs);
|
}
$this->update("usergroups", $gs);
|
}
| }
|
/** * Update the forum permissions cache. *
| /** * Update the forum permissions cache. *
|
Zeile 561 | Zeile 571 |
---|
{ global $forum_cache, $db;
|
{ global $forum_cache, $db;
|
$this->built_forum_permissions = array(0);
| $this->forum_permissions = $this->built_forum_permissions = array(0);
|
// Get our forum list cache_forums(true); if(!is_array($forum_cache))
|
// Get our forum list cache_forums(true); if(!is_array($forum_cache))
|
{
| {
|
return false; }
| return false; }
|
Zeile 618 | Zeile 628 |
---|
$perms = $permissions; foreach($usergroups as $gid) {
|
$perms = $permissions; foreach($usergroups as $gid) {
|
if($this->forum_permissions[$forum['fid']][$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]; }
|
Zeile 636 | Zeile 646 |
---|
/** * 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(); }
|
Zeile 651 | Zeile 661 |
---|
function update_statistics() { global $db;
|
function update_statistics() { 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);
$timesearch = TIME_NOW - 86400; switch($db->type)
|
$query = $db->simple_select('users', 'uid, username, referrals', 'referrals>0', array('order_by' => 'referrals', 'order_dir' => 'DESC', 'limit' => 1)); $topreferrer = $db->fetch_array($query);
$timesearch = TIME_NOW - 86400; switch($db->type)
|
{
| {
|
case 'pgsql': $group_by = $db->build_fields_string('users', 'u.');
|
case 'pgsql': $group_by = $db->build_fields_string('users', 'u.');
|
break;
| break;
|
default: $group_by = 'p.uid'; 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 GROUP BY {$group_by} ORDER BY poststoday DESC ");
|
|
|
$query = $db->query(' SELECT u.uid, u.username, COUNT(pid) AS poststoday FROM '.TABLE_PREFIX.'posts p LEFT JOIN '.TABLE_PREFIX.'users u ON (p.uid=u.uid) WHERE p.dateline>'.$timesearch.' GROUP BY '.$group_by.' ORDER BY poststoday DESC LIMIT 1 '); $topposter = $db->fetch_array($query);
| $most_posts = 0; $topposter = array(); while($user = $db->fetch_array($query)) { if($user['poststoday'] > $most_posts) { $most_posts = $user['poststoday']; $topposter = $user; } }
|
$query = $db->simple_select('users', 'COUNT(uid) AS posters', 'postnum>0'); $posters = $db->fetch_field($query, 'posters');
| $query = $db->simple_select('users', 'COUNT(uid) AS posters', 'postnum>0'); $posters = $db->fetch_field($query, 'posters');
|
Zeile 808 | Zeile 828 |
---|
{ foreach($main as $forum) {
|
{ foreach($main as $forum) {
|
$forum_mods = '';
| $forum_mods = array();
|
if(count($moderators)) { $forum_mods = $moderators;
| if(count($moderators)) { $forum_mods = $moderators;
|
Zeile 885 | Zeile 905 |
---|
*/ function update_reportedcontent() {
|
*/ function update_reportedcontent() {
|
global $db, $mybb;
| global $db;
|
$query = $db->simple_select("reportedcontent", "COUNT(rid) AS unreadcount", "reportstatus='0'");
|
$query = $db->simple_select("reportedcontent", "COUNT(rid) AS unreadcount", "reportstatus='0'");
|
$num = $db->fetch_array($query);
| $unreadcount = $db->fetch_field($query, 'unreadcount');
|
$query = $db->simple_select("reportedcontent", "COUNT(rid) AS reportcount");
|
$query = $db->simple_select("reportedcontent", "COUNT(rid) AS reportcount");
|
$total = $db->fetch_array($query);
$query = $db->simple_select("reportedcontent", "dateline", "reportstatus='0'", array('order_by' => 'dateline', 'order_dir' => 'DESC')); $latest = $db->fetch_array($query);
| $reportcount = $db->fetch_field($query, 'reportcount'); $query = $db->simple_select("reportedcontent", "dateline", "reportstatus='0'", array('order_by' => 'dateline', 'order_dir' => 'DESC', 'limit' => 1)); $dateline = $db->fetch_field($query, 'dateline');
|
$reports = array(
|
$reports = array(
|
"unread" => $num['unreadcount'], "total" => $total['reportcount'], "lastdateline" => $latest['dateline']
| 'unread' => $unreadcount, 'total' => $reportcount, 'lastdateline' => $dateline,
|
);
$this->update("reportedcontent", $reports);
| );
$this->update("reportedcontent", $reports);
|
Zeile 973 | Zeile 993 |
---|
$query = $db->simple_select("themes", "name, tid, properties, stylesheets", "def='1'", array('limit' => 1)); $theme = $db->fetch_array($query); $this->update("default_theme", $theme);
|
$query = $db->simple_select("themes", "name, tid, properties, stylesheets", "def='1'", array('limit' => 1)); $theme = $db->fetch_array($query); $this->update("default_theme", $theme);
|
}
| }
|
/** * Updates the tasks cache saving the next run time */ function update_tasks() { global $db;
|
/** * Updates the tasks cache saving the next run time */ function update_tasks() { global $db;
|
|
|
$query = $db->simple_select("tasks", "nextrun", "enabled=1", array("order_by" => "nextrun", "order_dir" => "asc", "limit" => 1)); $next_task = $db->fetch_array($query);
| $query = $db->simple_select("tasks", "nextrun", "enabled=1", array("order_by" => "nextrun", "order_dir" => "asc", "limit" => 1)); $next_task = $db->fetch_array($query);
|
Zeile 991 | Zeile 1011 |
---|
$task_cache = array(); } $task_cache['nextrun'] = $next_task['nextrun'];
|
$task_cache = array(); } $task_cache['nextrun'] = $next_task['nextrun'];
|
|
|
if(!$task_cache['nextrun']) { $task_cache['nextrun'] = TIME_NOW+3600;
| if(!$task_cache['nextrun']) { $task_cache['nextrun'] = TIME_NOW+3600;
|
Zeile 1024 | Zeile 1044 |
---|
global $db;
$banned_emails = array();
|
global $db;
$banned_emails = array();
|
$query = $db->simple_select("banfilters", "fid, filter", "type = '3'");
| $query = $db->simple_select("banfilters", "fid, filter", "type = '3'");
|
while($banned_email = $db->fetch_array($query)) {
| while($banned_email = $db->fetch_array($query)) {
|
Zeile 1038 | Zeile 1058 |
---|
* Updates the search engine spiders cache */ function update_spiders()
|
* Updates the search engine spiders cache */ function update_spiders()
|
{
| {
|
global $db;
$spiders = array();
| global $db;
$spiders = array();
|
Zeile 1046 | Zeile 1066 |
---|
while($spider = $db->fetch_array($query)) { $spiders[$spider['sid']] = $spider;
|
while($spider = $db->fetch_array($query)) { $spiders[$spider['sid']] = $spider;
|
}
| }
|
$this->update("spiders", $spiders); }
|
$this->update("spiders", $spiders); }
|
|
|
function update_most_replied_threads()
|
function update_most_replied_threads()
|
{ global $db, $mybb;
| { global $db, $mybb;
|
$threads = array();
|
$threads = array();
|
|
|
$query = $db->simple_select("threads", "tid, subject, replies, fid, uid", "visible='1'", array('order_by' => 'replies', 'order_dir' => 'DESC', 'limit_start' => 0, 'limit' => $mybb->settings['statslimit']));
|
$query = $db->simple_select("threads", "tid, subject, replies, fid, uid", "visible='1'", array('order_by' => 'replies', 'order_dir' => 'DESC', 'limit_start' => 0, 'limit' => $mybb->settings['statslimit']));
|
while($thread = $db->fetch_array($query)) { $threads[] = $thread; }
| while($thread = $db->fetch_array($query)) { $threads[] = $thread; }
|
$this->update("most_replied_threads", $threads); }
function update_most_viewed_threads() { global $db, $mybb;
|
$this->update("most_replied_threads", $threads); }
function update_most_viewed_threads() { global $db, $mybb;
|
|
|
$threads = array();
|
$threads = array();
|
|
|
$query = $db->simple_select("threads", "tid, subject, views, fid, uid", "visible='1'", array('order_by' => 'views', 'order_dir' => 'DESC', 'limit_start' => 0, 'limit' => $mybb->settings['statslimit'])); while($thread = $db->fetch_array($query)) { $threads[] = $thread;
|
$query = $db->simple_select("threads", "tid, subject, views, fid, uid", "visible='1'", array('order_by' => 'views', 'order_dir' => 'DESC', 'limit_start' => 0, 'limit' => $mybb->settings['statslimit'])); while($thread = $db->fetch_array($query)) { $threads[] = $thread;
|
}
| }
|
$this->update("most_viewed_threads", $threads); }
|
$this->update("most_viewed_threads", $threads); }
|
| /** * @deprecated */
|
function update_banned() {
|
function update_banned() {
|
global $db;
$bans = array();
$query = $db->simple_select("banned"); while($ban = $db->fetch_array($query)) { $bans[$ban['uid']] = $ban; }
$this->update("banned", $bans);
| // "banned" cache removed
|
}
function update_birthdays()
| }
function update_birthdays()
|
Zeile 1329 | Zeile 1342 |
---|
$query = $db->simple_select("datacache", "title,cache", "title='adminnotes'"); $this->update("adminnotes", unserialize($db->fetch_field($query, "cache")));
|
$query = $db->simple_select("datacache", "title,cache", "title='adminnotes'"); $this->update("adminnotes", unserialize($db->fetch_field($query, "cache")));
|
}
function reload_mybb_credits() { admin_redirect('index.php?module=home-credits&fetch_new=-2');
| |
} }
| } }
|