Vergleich inc/class_datacache.php - 1.8.30 - 1.8.31

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 51Zeile 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 111Zeile 126
			if(!$this->handler->connect())
{
$this->handler = null;

			if(!$this->handler->connect())
{
$this->handler = null;

			}

			}

		}
else
{

		}
else
{

Zeile 130Zeile 145
	 * @param string $name The cache component to read.
* @param boolean $hard If true, cannot be overwritten during script execution.
* @return mixed

	 * @param string $name The cache component to read.
* @param boolean $hard If true, cannot be overwritten during script execution.
* @return mixed

	 */

	 */

	function read($name, $hard=false)
{
global $db, $mybb;

	function read($name, $hard=false)
{
global $db, $mybb;

Zeile 150Zeile 165
		if($this->handler instanceof CacheHandlerInterface)
{
get_execution_time();

		if($this->handler instanceof CacheHandlerInterface)
{
get_execution_time();





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

$call_time = get_execution_time();

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

$call_time = get_execution_time();

Zeile 169Zeile 184

// No data returned - cache gone bad?
if($data === false)


// No data returned - cache gone bad?
if($data === false)

			{

			{

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

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

$hit = $this->handler->put($name, $data);

				// Update cache for handler
get_execution_time();

$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 188Zeile 203
				{
$this->debug_call('set:'.$name, $call_time, $hit);
}

				{
$this->debug_call('set:'.$name, $call_time, $hit);
}

			}

			}

		}
// Else, using internal database cache
else

		}
// Else, using internal database cache
else

Zeile 207Zeile 222
		}

// Cache locally

		}

// Cache locally

		$this->cache[$name] = $data;

		$this->cache[$name] = $data;


if($data !== false)


if($data !== false)

		{

		{

			return $data;

			return $data;

		}

		}

		else
{
return false;

		else
{
return false;

		}
}

		}
}


/**
* Update cache contents.


/**
* Update cache contents.

Zeile 241Zeile 256
		$db->replace_query("datacache", $replace_array, "", false);

// Do we have a cache handler we're using?

		$db->replace_query("datacache", $replace_array, "", false);

// Do we have a cache handler we're using?

		if($this->handler instanceof CacheHandlerInterface)
{
get_execution_time();

$hit = $this->handler->put($name, $contents);


		if($this->handler instanceof CacheHandlerInterface)
{
get_execution_time();

$hit = $this->handler->put($name, $contents);


			$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 284Zeile 299
			$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)
{
$this->debug_call('delete:'.$name, $call_time, $hit);

			if($mybb->debug_mode)
{
$this->debug_call('delete:'.$name, $call_time, $hit);

Zeile 666Zeile 681
		$topreferrer = $db->fetch_array($query);

$timesearch = TIME_NOW - 86400;

		$topreferrer = $db->fetch_array($query);

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