Vergleich inc/class_datacache.php - 1.8.27 - 1.8.38

  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 118Zeile 133
			// Database cache
$query = $db->simple_select("datacache", "title,cache");
while($data = $db->fetch_array($query))

			// Database cache
$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']);
}

		}
}

		}
}





	/**
* Read cache from files or db.
*

	/**
* Read cache from files or db.
*

Zeile 137Zeile 153

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

		{

		{

			return $this->cache[$name];
}
// If we're not hard refreshing, and this cache doesn't exist, return false

			return $this->cache[$name];
}
// If we're not hard refreshing, and this cache doesn't exist, return false

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






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

					$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 195Zeile 220
		{
$query = $db->simple_select("datacache", "title,cache", "title='$name'");
$cache_data = $db->fetch_array($query);

		{
$query = $db->simple_select("datacache", "title,cache", "title='$name'");
$cache_data = $db->fetch_array($query);


if(!$cache_data['title'])


if(empty($cache_data['title']))

			{
$data = false;
}
else
{

			{
$data = false;
}
else
{

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


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

			}
}


			}
}


Zeile 461Zeile 487
		$version = array(
"version" => $mybb->version,
"version_code" => $mybb->version_code

		$version = array(
"version" => $mybb->version,
"version_code" => $mybb->version_code

		);


		);


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


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


Zeile 491Zeile 517
	 *
*/
function update_smilies()

	 *
*/
function update_smilies()

	{
global $db;

	{
global $db;


$smilies = array();



$smilies = array();


Zeile 507Zeile 533

/**
* Update the posticon cache.


/**
* Update the posticon cache.

	 *
*/

	 *
*/

	function update_posticons()
{
global $db;


	function update_posticons()
{
global $db;


		$icons = array();


		$icons = array();


		$query = $db->simple_select("icons", "iid, name, path");
while($icon = $db->fetch_array($query))
{
$icons[$icon['iid']] = $icon;
}

		$query = $db->simple_select("icons", "iid, name, path");
while($icon = $db->fetch_array($query))
{
$icons[$icon['iid']] = $icon;
}





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

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

	}


	}


	/**
* Update the badwords cache.
*

	/**
* Update the badwords cache.
*

Zeile 532Zeile 558
	{
global $db;


	{
global $db;


		$badwords = array();


		$badwords = array();


		$query = $db->simple_select("badwords", "*");
while($badword = $db->fetch_array($query))
{
$badwords[$badword['bid']] = $badword;

		$query = $db->simple_select("badwords", "*");
while($badword = $db->fetch_array($query))
{
$badwords[$badword['bid']] = $badword;

		}


		}


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


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


Zeile 555Zeile 581

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


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

		{

		{

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


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


Zeile 587Zeile 613
		foreach($forum_cache as $fid => $forum)
{
$this->forum_permissions_forum_cache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;

		foreach($forum_cache as $fid => $forum)
{
$this->forum_permissions_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);


// Fetch forum permissions from the database
$query = $db->simple_select("forumpermissions");


// Fetch forum permissions from the database
$query = $db->simple_select("forumpermissions");

Zeile 605Zeile 631

$this->build_forum_permissions();
$this->update("forumpermissions", $this->built_forum_permissions);


$this->build_forum_permissions();
$this->update("forumpermissions", $this->built_forum_permissions);





		return true;
}

/**
* Build the forum permissions array

		return true;
}

/**
* Build the forum permissions array

	 *

	 *

	 * @access private
* @param array $permissions An optional permissions array.
* @param int $pid An optional permission id.

	 * @access private
* @param array $permissions An optional permissions array.
* @param int $pid An optional permission id.

Zeile 619Zeile 645
	private function build_forum_permissions($permissions=array(), $pid=0)
{
$usergroups = array_keys($this->read("usergroups", true));

	private function build_forum_permissions($permissions=array(), $pid=0)
{
$usergroups = array_keys($this->read("usergroups", true));

		if($this->forum_permissions_forum_cache[$pid])

		if(!empty($this->forum_permissions_forum_cache[$pid]))

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

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

Zeile 632Zeile 658
						{
$perms[$gid] = $this->forum_permissions[$forum['fid']][$gid];
}

						{
$perms[$gid] = $this->forum_permissions[$forum['fid']][$gid];
}

						if($perms[$gid])

						if(!empty($perms[$gid]))

						{
$perms[$gid]['fid'] = $forum['fid'];
$this->built_forum_permissions[$forum['fid']][$gid] = $perms[$gid];

						{
$perms[$gid]['fid'] = $forum['fid'];
$this->built_forum_permissions[$forum['fid']][$gid] = $perms[$gid];

Zeile 646Zeile 672

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

Zeile 666Zeile 692
		$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 734Zeile 751
		foreach($forum_cache as $fid => $forum)
{
$this->moderators_forum_cache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;

		foreach($forum_cache as $fid => $forum)
{
$this->moderators_forum_cache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;

		}

		}


// Sort children
foreach($fcache as $pid => $value)


// Sort children
foreach($fcache as $pid => $value)

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


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


		if(is_array($this->moderators))

		foreach(array_keys($this->moderators) as $fid)

		{

		{

			foreach(array_keys($this->moderators) as $fid)

			if(isset($this->moderators[$fid]['users']))

			{

			{

				uasort($this->moderators[$fid], 'sort_moderators_by_usernames');

				uasort($this->moderators[$fid]['users'], 'sort_moderators_by_usernames');

			}
}


			}
}


Zeile 1130Zeile 1147

if($bday['birthdayprivacy'] != 'all')
{


if($bday['birthdayprivacy'] != 'all')
{

				++$birthdays[$bday['bday']]['hiddencount'];








				if(isset($birthdays[$bday['bday']]['hiddencount']))
{
++$birthdays[$bday['bday']]['hiddencount'];
}
else
{
$birthdays[$bday['bday']]['hiddencount'] = 1;
}

				continue;

				continue;

			}


			}


			// We don't need any excess caleries in the cache
unset($bday['birthdayprivacy']);

			// We don't need any excess caleries in the cache
unset($bday['birthdayprivacy']);

 

if(!isset($birthdays[$bday['bday']]['users']))
{
$birthdays[$bday['bday']]['users'] = array();
}


$birthdays[$bday['bday']]['users'][] = $bday;
}


$birthdays[$bday['bday']]['users'][] = $bday;
}

Zeile 1293Zeile 1322
		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 1301Zeile 1330
		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 1309Zeile 1338
		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 1317Zeile 1346
		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 1325Zeile 1354
		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 1333Zeile 1362
		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 1341Zeile 1370
		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")));

	}
}

	}
}