Vergleich inc/class_datacache.php - 1.8.15 - 1.8.27

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 94Zeile 94
				require_once MYBB_ROOT."/inc/cachehandlers/apc.php";
$this->handler = new apcCacheHandler();
break;

				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)
{


if($this->handler instanceof CacheHandlerInterface)
{

Zeile 110Zeile 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']);

			}
}
}

			}
}
}


/**
* Read cache from files or db.


/**
* Read cache from files or db.

Zeile 163Zeile 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 204Zeile 214
			return $data;
}
else

			return $data;
}
else

		{

		{

			return false;
}
}

			return false;
}
}

Zeile 213Zeile 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 222Zeile 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 244Zeile 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 258Zeile 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 554Zeile 564

/**
* Update the forum permissions cache.


/**
* Update the forum permissions cache.

	 *

	 *

	 * @return bool When failed, returns false.
*/
function update_forumpermissions()
{
global $forum_cache, $db;


	 * @return bool When failed, returns false.
*/
function update_forumpermissions()
{
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);


// Get our forum list
cache_forums(true);

Zeile 618Zeile 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 672Zeile 682
			LEFT JOIN {$db->table_prefix}users u ON (p.uid=u.uid)
WHERE p.dateline > {$timesearch} AND p.visible=1
GROUP BY {$group_by}

			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 NULL DESC

			ORDER BY poststoday DESC

		");

$most_posts = 0;

		");

$most_posts = 0;

 
		$topposter = array();

		while($user = $db->fetch_array($query))
{
if($user['poststoday'] > $most_posts)

		while($user = $db->fetch_array($query))
{
if($user['poststoday'] > $most_posts)

Zeile 862Zeile 873
				if(in_array($key, $exclude))
{
unset($forum[$key]);

				if(in_array($key, $exclude))
{
unset($forum[$key]);

				}

				}

			}
$forums[$forum['fid']] = $forum;
}

			}
$forums[$forum['fid']] = $forum;
}

Zeile 894Zeile 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);
}





	/**
* Update mycode cache.
*

	/**
* Update mycode cache.
*

Zeile 927Zeile 938
		while($mycode = $db->fetch_array($query))
{
$mycodes[] = $mycode;

		while($mycode = $db->fetch_array($query))
{
$mycodes[] = $mycode;

		}


		}


		$this->update("mycode", $mycodes);
}

		$this->update("mycode", $mycodes);
}





	/**
* Update the mailqueue cache
*

	/**
* Update the mailqueue cache
*

Zeile 947Zeile 958

$mailqueue = $this->read("mailqueue");
if(!is_array($mailqueue))


$mailqueue = $this->read("mailqueue");
if(!is_array($mailqueue))

		{

		{

			$mailqueue = array();
}
$mailqueue['queue_size'] = $queue_size;

			$mailqueue = array();
}
$mailqueue['queue_size'] = $queue_size;

Zeile 1004Zeile 1015
		if(!$task_cache['nextrun'])
{
$task_cache['nextrun'] = TIME_NOW+3600;

		if(!$task_cache['nextrun'])
{
$task_cache['nextrun'] = TIME_NOW+3600;

		}

		}


$this->update("tasks", $task_cache);


$this->update("tasks", $task_cache);

	}


	}


	/**
* Updates the banned IPs cache
*/

	/**
* Updates the banned IPs cache
*/

Zeile 1023Zeile 1034
			$banned_ips[$banned_ip['fid']] = $banned_ip;
}
$this->update("bannedips", $banned_ips);

			$banned_ips[$banned_ip['fid']] = $banned_ip;
}
$this->update("bannedips", $banned_ips);

	}

	}


/**
* Updates the banned emails cache


/**
* Updates the banned emails cache

Zeile 1060Zeile 1071
	}

function update_most_replied_threads()

	}

function update_most_replied_threads()

	{
global $db, $mybb;


	{
global $db, $mybb;


		$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']));

		$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']));

Zeile 1089Zeile 1100
		$this->update("most_viewed_threads", $threads);
}


		$this->update("most_viewed_threads", $threads);
}


 
	/**
* @deprecated
*/

	function update_banned()

	function update_banned()

 
	{
// "banned" cache removed
}

function update_birthdays()

	{
global $db;


	{
global $db;


		$bans = array();

$query = $db->simple_select("banned");
while($ban = $db->fetch_array($query))
{
$bans[$ban['uid']] = $ban;
}

$this->update("banned", $bans);
}

function update_birthdays()
{
global $db;

$birthdays = array();

		$birthdays = array();

















// Get today, yesterday, and tomorrow's time (for different timezones)
$bdaytime = TIME_NOW;


// Get today, yesterday, and tomorrow's time (for different timezones)
$bdaytime = TIME_NOW;

Zeile 1147Zeile 1151

$query = $db->simple_select("groupleaders");
while($groupleader = $db->fetch_array($query))


$query = $db->simple_select("groupleaders");
while($groupleader = $db->fetch_array($query))

		{

		{

			$groupleaders[$groupleader['uid']][] = $groupleader;
}


			$groupleaders[$groupleader['uid']][] = $groupleader;
}


Zeile 1185Zeile 1189
				if(!isset($fd_statistics[$forum['fid']]['announcements']))
{
$fd_statistics[$forum['fid']]['announcements'] = 1;

				if(!isset($fd_statistics[$forum['fid']]['announcements']))
{
$fd_statistics[$forum['fid']]['announcements'] = 1;

				}

				}

			}
}


			}
}


Zeile 1204Zeile 1208
					if(!$forum)
{
$forum = -1;

					if(!$forum)
{
$forum = -1;

					}

					}


if(!isset($fd_statistics[$forum]['modtools']))
{


if(!isset($fd_statistics[$forum]['modtools']))
{

Zeile 1222Zeile 1226
	 *
*/
function update_profilefields()

	 *
*/
function update_profilefields()

	{
global $db;


	{
global $db;


		$fields = array();
$query = $db->simple_select("profilefields", "*", "", array('order_by' => 'disporder'));
while($field = $db->fetch_array($query))

		$fields = array();
$query = $db->simple_select("profilefields", "*", "", array('order_by' => 'disporder'));
while($field = $db->fetch_array($query))

Zeile 1240Zeile 1244
	 *
*/
function update_reportreasons($no_plugins = false)

	 *
*/
function update_reportreasons($no_plugins = false)

	{
global $db;


	{
global $db;


		$content_types = array('post', 'profile', 'reputation');
if(!$no_plugins)
{

		$content_types = array('post', 'profile', 'reputation');
if(!$no_plugins)
{

Zeile 1258Zeile 1262
			if($reason['appliesto'] == 'all')
{
foreach($content_types as $content)

			if($reason['appliesto'] == 'all')
{
foreach($content_types as $content)

				{
$reasons[$content][] = array(
'rid' => $reason['rid'],
'title' => $reason['title'],

				{
$reasons[$content][] = array(
'rid' => $reason['rid'],
'title' => $reason['title'],

						'extra' => $reason['extra'],
);
}

						'extra' => $reason['extra'],
);
}

Zeile 1298Zeile 1302

$query = $db->simple_select("datacache", "title,cache", "title='plugins'");
$this->update("plugins", unserialize($db->fetch_field($query, "cache")));


$query = $db->simple_select("datacache", "title,cache", "title='plugins'");
$this->update("plugins", unserialize($db->fetch_field($query, "cache")));

	}


	}


	function reload_last_backup()

	function reload_last_backup()

	{
global $db;

	{
global $db;


$query = $db->simple_select("datacache", "title,cache", "title='last_backup'");
$this->update("last_backup", unserialize($db->fetch_field($query, "cache")));


$query = $db->simple_select("datacache", "title,cache", "title='last_backup'");
$this->update("last_backup", unserialize($db->fetch_field($query, "cache")));

	}


	}


	function reload_internal_settings()

	function reload_internal_settings()

	{

	{

		global $db;

$query = $db->simple_select("datacache", "title,cache", "title='internal_settings'");

		global $db;

$query = $db->simple_select("datacache", "title,cache", "title='internal_settings'");

Zeile 1317Zeile 1321
	}

function reload_version_history()

	}

function reload_version_history()

	{
global $db;

	{
global $db;


$query = $db->simple_select("datacache", "title,cache", "title='version_history'");
$this->update("version_history", unserialize($db->fetch_field($query, "cache")));


$query = $db->simple_select("datacache", "title,cache", "title='version_history'");
$this->update("version_history", unserialize($db->fetch_field($query, "cache")));

	}


	}


	function reload_modnotes()

	function reload_modnotes()

	{
global $db;

	{
global $db;


$query = $db->simple_select("datacache", "title,cache", "title='modnotes'");
$this->update("modnotes", unserialize($db->fetch_field($query, "cache")));


$query = $db->simple_select("datacache", "title,cache", "title='modnotes'");
$this->update("modnotes", unserialize($db->fetch_field($query, "cache")));

	}

	}


function reload_adminnotes()


function reload_adminnotes()

	{

	{

		global $db;

		global $db;





		$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');

 
	}
}

	}
}