Vergleich inc/class_datacache.php - 1.8.20 - 1.8.26

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 93Zeile 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;
}


				break;
}


Zeile 122Zeile 132
	 * @return mixed
*/
function read($name, $hard=false)

	 * @return mixed
*/
function read($name, $hard=false)

	{
global $db, $mybb;


	{
global $db, $mybb;


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

Zeile 138Zeile 148
		}

if($this->handler instanceof CacheHandlerInterface)

		}

if($this->handler instanceof CacheHandlerInterface)

		{
get_execution_time();

		{
get_execution_time();


$data = $this->handler->fetch($name);



$data = $this->handler->fetch($name);


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

				$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++;

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)

	{
global $db, $mybb;


	{
global $db, $mybb;


		$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 718Zeile 728

reset($forum_cache);
$fcache = array();


reset($forum_cache);
$fcache = array();





		// Resort in to the structure we require
foreach($forum_cache as $fid => $forum)
{
$this->moderators_forum_cache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;

		// Resort in to the structure we require
foreach($forum_cache as $fid => $forum)
{
$this->moderators_forum_cache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;

		}


		}


		// Sort children
foreach($fcache as $pid => $value)
{
ksort($fcache[$pid]);
}
ksort($fcache);

		// Sort children
foreach($fcache as $pid => $value)
{
ksort($fcache[$pid]);
}
ksort($fcache);





		$this->moderators = array();

		$this->moderators = array();





		// Fetch moderators from the database
$query = $db->query("
SELECT m.*, u.username, u.usergroup, u.displaygroup

		// Fetch moderators from the database
$query = $db->query("
SELECT m.*, u.username, u.usergroup, u.displaygroup

Zeile 764Zeile 774
			ORDER BY u.title
");
while($moderator = $db->fetch_array($query))

			ORDER BY u.title
");
while($moderator = $db->fetch_array($query))

		{

		{

			$this->moderators[$moderator['fid']]['usergroups'][$moderator['id']] = $moderator;
}


			$this->moderators[$moderator['fid']]['usergroups'][$moderator['id']] = $moderator;
}


Zeile 843Zeile 853

/**
* Update the forums cache.


/**
* Update the forums cache.

	 *

	 *

	 */
function update_forums()
{

	 */
function update_forums()
{

Zeile 919Zeile 929
	 *
*/
function update_mycode()

	 *
*/
function update_mycode()

	{
global $db;


	{
global $db;


		$mycodes = array();
$query = $db->simple_select("mycode", "regex, replacement", "active=1", array('order_by' => 'parseorder'));
while($mycode = $db->fetch_array($query))

		$mycodes = array();
$query = $db->simple_select("mycode", "regex, replacement", "active=1", array('order_by' => 'parseorder'));
while($mycode = $db->fetch_array($query))

Zeile 968Zeile 978
		$update_cache = array(
"dateline" => TIME_NOW
);

		$update_cache = array(
"dateline" => TIME_NOW
);





		$this->update("update_check", $update_cache);

		$this->update("update_check", $update_cache);

	}


	}


	/**
* Update default_theme cache
*/
function update_default_theme()
{
global $db;

	/**
* Update default_theme cache
*/
function update_default_theme()
{
global $db;





		$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()

	 * Updates the tasks cache saving the next run time
*/
function update_tasks()

Zeile 1013Zeile 1023
	 * Updates the banned IPs cache
*/
function update_bannedips()

	 * Updates the banned IPs cache
*/
function update_bannedips()

	{
global $db;


	{
global $db;


		$banned_ips = array();
$query = $db->simple_select("banfilters", "fid,filter", "type=1");
while($banned_ip = $db->fetch_array($query))

		$banned_ips = array();
$query = $db->simple_select("banfilters", "fid,filter", "type=1");
while($banned_ip = $db->fetch_array($query))

Zeile 1029Zeile 1039
	 * Updates the banned emails cache
*/
function update_bannedemails()

	 * Updates the banned emails cache
*/
function update_bannedemails()

	{
global $db;

	{
global $db;


$banned_emails = array();
$query = $db->simple_select("banfilters", "fid, filter", "type = '3'");


$banned_emails = array();
$query = $db->simple_select("banfilters", "fid, filter", "type = '3'");

Zeile 1060Zeile 1070
	}

function update_most_replied_threads()

	}

function update_most_replied_threads()

	{
global $db, $mybb;

	{
global $db, $mybb;


$threads = array();



$threads = array();


Zeile 1077Zeile 1087
	function update_most_viewed_threads()
{
global $db, $mybb;

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