Vergleich inc/class_datacache.php - 1.8.28 - 1.8.39

  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 119Zeile 134
			$query = $db->simple_select("datacache", "title,cache");
while($data = $db->fetch_array($query))
{

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

			}
}
}

			}
}
}

Zeile 173Zeile 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();

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






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





				$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 202Zeile 227
			}
else
{

			}
else
{

				$data = unserialize($cache_data['cache']);


				// use native_unserialize() over my_unserialize() for performance reasons
$data = native_unserialize($cache_data['cache']);

			}
}


			}
}


Zeile 210Zeile 236
		$this->cache[$name] = $data;

if($data !== false)

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

if($data !== false)

		{
return $data;
}
else
{
return false;

		{
return $data;
}
else
{
return false;

		}
}


		}
}


Zeile 241Zeile 267
		$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();


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


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

$call_time = get_execution_time();

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

$call_time = get_execution_time();

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

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

			}
}


			}
}


		// Greedy?
if($greedy)
{

		// Greedy?
if($greedy)
{

Zeile 319Zeile 345
			if($this->handler instanceof CacheHandlerInterface)
{
$query = $db->simple_select("datacache", "title", $where);

			if($this->handler instanceof CacheHandlerInterface)
{
$query = $db->simple_select("datacache", "title", $where);





				while($row = $db->fetch_array($query))
{
$names[$row['title']] = 0;

				while($row = $db->fetch_array($query))
{
$names[$row['title']] = 0;

Zeile 328Zeile 354
				// ...from the filesystem...
$start = strlen(MYBB_ROOT."cache/");
foreach((array)@glob(MYBB_ROOT."cache/{$name}*.php") as $filename)

				// ...from the filesystem...
$start = strlen(MYBB_ROOT."cache/");
foreach((array)@glob(MYBB_ROOT."cache/{$name}*.php") as $filename)

				{

				{

					if($filename)
{
$filename = substr($filename, $start, strlen($filename)-4-$start);

					if($filename)
{
$filename = substr($filename, $start, strlen($filename)-4-$start);

Zeile 366Zeile 392
	 * @param boolean $hit Hit or miss status
*/
function debug_call($string, $qtime, $hit)

	 * @param boolean $hit Hit or miss status
*/
function debug_call($string, $qtime, $hit)

	{

	{

		global $mybb, $plugins;

		global $mybb, $plugins;





		$debug_extra = '';
if($plugins->current_hook)
{

		$debug_extra = '';
if($plugins->current_hook)
{

Zeile 376Zeile 402
		}

if($hit)

		}

if($hit)

		{

		{

			$hit_status = 'HIT';
}
else

			$hit_status = 'HIT';
}
else

Zeile 404Zeile 430
		$this->calllist[$this->call_count]['key'] = $string;
$this->calllist[$this->call_count]['time'] = $qtime;
}

		$this->calllist[$this->call_count]['key'] = $string;
$this->calllist[$this->call_count]['time'] = $qtime;
}





	/**
* Select the size of the cache
*

	/**
* Select the size of the cache
*

Zeile 442Zeile 468
			{
$query = $db->simple_select("datacache", "cache", "title='{$name}'");
return strlen($db->fetch_field($query, "cache"));

			{
$query = $db->simple_select("datacache", "cache", "title='{$name}'");
return strlen($db->fetch_field($query, "cache"));

			}

			}

			else
{
return $db->fetch_size("datacache");

			else
{
return $db->fetch_size("datacache");

Zeile 452Zeile 478

/**
* Update the MyBB version in the cache.


/**
* Update the MyBB version in the cache.

	 *

	 *

	 */
function update_version()
{

	 */
function update_version()
{

Zeile 471Zeile 497
	 *
*/
function update_attachtypes()

	 *
*/
function update_attachtypes()

	{

	{

		global $db;

$types = array();

		global $db;

$types = array();

Zeile 488Zeile 514

/**
* Update the smilies cache.


/**
* Update the smilies cache.

	 *
*/

	 *
*/

	function update_smilies()
{
global $db;

	function update_smilies()
{
global $db;

Zeile 517Zeile 543

$query = $db->simple_select("icons", "iid, name, path");
while($icon = $db->fetch_array($query))


$query = $db->simple_select("icons", "iid, name, path");
while($icon = $db->fetch_array($query))

		{

		{

			$icons[$icon['iid']] = $icon;
}

			$icons[$icon['iid']] = $icon;
}





		$this->update("posticons", $icons);
}

/**
* Update the badwords cache.

		$this->update("posticons", $icons);
}

/**
* Update the badwords cache.

	 *
*/

	 *
*/

	function update_badwords()
{
global $db;

	function update_badwords()
{
global $db;





		$badwords = array();

$query = $db->simple_select("badwords", "*");
while($badword = $db->fetch_array($query))

		$badwords = array();

$query = $db->simple_select("badwords", "*");
while($badword = $db->fetch_array($query))

		{

		{

			$badwords[$badword['bid']] = $badword;
}

			$badwords[$badword['bid']] = $badword;
}





		$this->update("badwords", $badwords);
}

/**
* Update the usergroups cache.

		$this->update("badwords", $badwords);
}

/**
* Update the usergroups cache.

	 *
*/

	 *
*/

	function update_usergroups()
{
global $db;

	function update_usergroups()
{
global $db;





		$query = $db->simple_select("usergroups");

$gs = array();
while($g = $db->fetch_array($query))

		$query = $db->simple_select("usergroups");

$gs = array();
while($g = $db->fetch_array($query))

		{

		{

			$gs[$g['gid']] = $g;
}


			$gs[$g['gid']] = $g;
}


Zeile 593Zeile 619
		foreach($fcache as $pid => $value)
{
ksort($fcache[$pid]);

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








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

		if(!empty($this->forum_permissions_forum_cache[$pid]))
{
foreach($this->forum_permissions_forum_cache[$pid] as $main)

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


Zeile 1305Zeile 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 1313Zeile 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 1321Zeile 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 1329Zeile 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 1337Zeile 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 1345Zeile 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 1353Zeile 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")));

	}
}

	}
}