Vergleich inc/class_datacache.php - 1.8.27 - 1.8.33

  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 196Zeile 211
			$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;
}

			{
$data = false;
}

Zeile 321Zeile 336
				$query = $db->simple_select("datacache", "title", $where);

while($row = $db->fetch_array($query))

				$query = $db->simple_select("datacache", "title", $where);

while($row = $db->fetch_array($query))

				{

				{

					$names[$row['title']] = 0;

					$names[$row['title']] = 0;

				}


				}


				// ...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 337Zeile 352
				}

foreach($names as $key => $val)

				}

foreach($names as $key => $val)

				{
get_execution_time();

				{
get_execution_time();


$hit = $this->handler->delete($key);



$hit = $this->handler->delete($key);


Zeile 403Zeile 418

$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
*
* @param string $name The name of the cache

	 * Select the size of the cache
*
* @param string $name The name of the cache

Zeile 439Zeile 454
		else
{
if($name)

		else
{
if($name)

			{

			{

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

Zeile 455Zeile 470
	 *
*/
function update_version()

	 *
*/
function update_version()

	{

	{

		global $mybb;

		global $mybb;





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

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

Zeile 471Zeile 486
	 *
*/
function update_attachtypes()

	 *
*/
function update_attachtypes()

	{

	{

		global $db;

$types = array();

		global $db;

$types = array();

Zeile 503Zeile 518
		}

$this->update("smilies", $smilies);

		}

$this->update("smilies", $smilies);

	}


	}


	/**
* Update the posticon cache.
*

	/**
* Update the posticon cache.
*

Zeile 513Zeile 528
	{
global $db;


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


Zeile 570Zeile 585
	function update_forumpermissions()
{
global $forum_cache, $db;

	function update_forumpermissions()
{
global $forum_cache, $db;





		$this->forum_permissions = $this->built_forum_permissions = array(0);

		$this->forum_permissions = $this->built_forum_permissions = array(0);





		// Get our forum list
cache_forums(true);
if(!is_array($forum_cache))

		// Get our forum list
cache_forums(true);
if(!is_array($forum_cache))

		{

		{

			return false;

			return false;

		}

		}


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


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





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

		// Resort in to the structure we require
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)
{

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

Zeile 615Zeile 630
	 * @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.

	 */

	 */

	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 647
						{
$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 661

/**
* 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 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
");


Zeile 779Zeile 785
			$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 867Zeile 873

$query = $db->simple_select("forums", "*", "", array('order_by' => 'pid,disporder'));
while($forum = $db->fetch_array($query))


$query = $db->simple_select("forums", "*", "", array('order_by' => 'pid,disporder'));
while($forum = $db->fetch_array($query))

		{

		{

			foreach($forum as $key => $val)
{
if(in_array($key, $exclude))

			foreach($forum as $key => $val)
{
if(in_array($key, $exclude))

Zeile 877Zeile 883
			}
$forums[$forum['fid']] = $forum;
}

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





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

/**
* Update usertitles cache.

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

/**
* Update usertitles cache.

	 *

	 *

	 */
function update_usertitles()
{
global $db;

	 */
function update_usertitles()
{
global $db;





		$usertitles = array();
$query = $db->simple_select("usertitles", "utid, posts, title, stars, starimage", "", array('order_by' => 'posts', 'order_dir' => 'DESC'));
while($usertitle = $db->fetch_array($query))
{
$usertitles[] = $usertitle;
}

		$usertitles = array();
$query = $db->simple_select("usertitles", "utid, posts, title, stars, starimage", "", array('order_by' => 'posts', 'order_dir' => 'DESC'));
while($usertitle = $db->fetch_array($query))
{
$usertitles[] = $usertitle;
}





		$this->update("usertitles", $usertitles);

		$this->update("usertitles", $usertitles);

	}

/**

	}

/**

	 * Update reported content cache.
*
*/

	 * Update reported content cache.
*
*/

Zeile 930Zeile 936
	 *
*/
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 981Zeile 987
		);

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

		);

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

	}


	}


	/**
* Update default_theme cache
*/
function update_default_theme()

	/**
* Update default_theme cache
*/
function update_default_theme()

	{
global $db;

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

	{
global $db;


	{
global $db;


		$query = $db->simple_select("tasks", "nextrun", "enabled=1", array("order_by" => "nextrun", "order_dir" => "asc", "limit" => 1));
$next_task = $db->fetch_array($query);

		$query = $db->simple_select("tasks", "nextrun", "enabled=1", array("order_by" => "nextrun", "order_dir" => "asc", "limit" => 1));
$next_task = $db->fetch_array($query);





		$task_cache = $this->read("tasks");
if(!is_array($task_cache))
{

		$task_cache = $this->read("tasks");
if(!is_array($task_cache))
{

Zeile 1018Zeile 1024
		}

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

		}

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

	}


	}


	/**
* Updates the banned IPs cache
*/

	/**
* Updates the banned IPs cache
*/

Zeile 1034Zeile 1040
			$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 1068Zeile 1074
			$spiders[$spider['sid']] = $spider;
}
$this->update("spiders", $spiders);

			$spiders[$spider['sid']] = $spider;
}
$this->update("spiders", $spiders);

	}

	}


function update_most_replied_threads()
{


function update_most_replied_threads()
{

Zeile 1130Zeile 1136

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