Vergleich inc/class_datacache.php - 1.2.2 - 1.2.13

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 3Zeile 3
 * MyBB 1.2
* Copyright � 2006 MyBB Group, All Rights Reserved
*

 * MyBB 1.2
* Copyright � 2006 MyBB Group, All Rights Reserved
*

 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/eula.html

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/eula.html

 *

 *

 * $Id: class_datacache.php 2163 2006-08-30 05:53:05Z chris $

 * $Id: class_datacache.php 3306 2007-09-13 05:29:43Z Tikitiki $

 */

class datacache

 */

class datacache

Zeile 59Zeile 59
		global $db, $mybb;
if($mybb->config['cache_store'] == "files")
{

		global $db, $mybb;
if($mybb->config['cache_store'] == "files")
{

			if($hard)

			if(!isset($this->cache[$name]) || $hard)

			{
@include(MYBB_ROOT."inc/cache/".$name.".php");

			{
@include(MYBB_ROOT."inc/cache/".$name.".php");

			}
else
{
@include_once(MYBB_ROOT."inc/cache/".$name.".php");
}
$this->cache[$name] = $$name;
unset($$name);
}

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






		else
{
if($hard)

		else
{
if($hard)

Zeile 79Zeile 74
				$this->cache[$data['title']] = unserialize($data['cache']);
}
}

				$this->cache[$data['title']] = unserialize($data['cache']);
}
}

 
		

		if(isset($this->cache[$name]))
{
return $this->cache[$name];

		if(isset($this->cache[$name]))
{
return $this->cache[$name];

Zeile 96Zeile 92
	{
global $db, $mybb;
$this->cache[$name] = $contents;

	{
global $db, $mybb;
$this->cache[$name] = $contents;





		// We ALWAYS keep a running copy in the db just incase we need it
$dbcontents = $db->escape_string(serialize($contents));
$db->query("

		// We ALWAYS keep a running copy in the db just incase we need it
$dbcontents = $db->escape_string(serialize($contents));
$db->query("

Zeile 162Zeile 158
			$smilies[$smilie['sid']] = $smilie;
}
$this->update("smilies", $smilies);

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

	}

/**

	}

/**

	 * Update the posticon cache.
*
*/
function updateposticons()

	 * Update the posticon cache.
*
*/
function updateposticons()

	{

	{

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

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

		{

		{

			$icons[$icon['iid']] = $icon;
}
$this->update("posticons", $icons);

			$icons[$icon['iid']] = $icon;
}
$this->update("posticons", $icons);

	}

	}


/**
* Update the badwords cache.


/**
* Update the badwords cache.

Zeile 196Zeile 192

/**
* Update the usergroups cache.


/**
* Update the usergroups cache.

	 *
*/

	 *
*/

	function updateusergroups()
{
global $db;

	function updateusergroups()
{
global $db;

Zeile 231Zeile 227
				}
}
$usergroupcache[$gid] = $usergroup;

				}
}
$usergroupcache[$gid] = $usergroup;

		}

		}

	
// Get our forum list

	
// Get our forum list

		cache_forums();


		cache_forums(true);
$fcache = array();

		if(!is_array($forum_cache))
{
return false;

		if(!is_array($forum_cache))
{
return false;

Zeile 294Zeile 291
	}

/**

	}

/**

	 * Update the stats cache.

	 * Update the stats cache (kept for the sake of being able to rebuild this cache via the cache interface)

	 *
*/
function updatestats()

	 *
*/
function updatestats()

	{
global $db;

$query = $db->simple_select(TABLE_PREFIX."threads", "COUNT(tid) AS threads", "visible='1' AND closed NOT LIKE 'moved|%'");
$stats['numthreads'] = $db->fetch_field($query, 'threads');
$query = $db->simple_select(TABLE_PREFIX."posts", "COUNT(pid) AS posts", "visible='1'");
$stats['numposts'] = $db->fetch_field($query, 'posts');
$query = $db->simple_select(TABLE_PREFIX."users", "uid, username", "", array('order_by' => 'uid', 'order_dir' => 'DESC', 'limit' => 1));
$lastmember = $db->fetch_array($query);
$stats['lastuid'] = $lastmember['uid'];
$stats['lastusername'] = $lastmember['username'];
$query = $db->simple_select(TABLE_PREFIX."users", "COUNT(uid) AS users");
$stats['numusers'] = $db->fetch_field($query, 'users');
$this->update("stats", $stats);
}

	{
global $db;

require_once MYBB_ROOT."inc/functions_rebuild.php";
rebuild_stats();
}














	/**
* Update the moderators cache.
*
*/

 
	function updatemoderators()

	function updatemoderators()

	{
global $db;
$query = $db->simple_select(TABLE_PREFIX."moderators", "mid, fid, uid, caneditposts, candeleteposts, canviewips, canopenclosethreads, canmanagethreads");
while($mod = $db->fetch_array($query))
{
$mods[$mod['fid']][$mod['uid']] = $mod;
}
$this->update("moderators", $mods);




































































	{
global $forum_cache, $db;

// Get our forum list
cache_forums(true);
if(!is_array($forum_cache))
{
return false;
}

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

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

// Fetch moderators from the database
$query = $db->simple_select(TABLE_PREFIX."moderators");
while($moderator = $db->fetch_array($query))
{
$this->moderators[$moderator['fid']][$moderator['uid']] = $moderator;
}

$this->build_moderators();

$this->update("moderators", $this->built_moderators);
}

/**
* Build the moderators array
*
* @access private
* @param array An optional moderators array (moderators of the parent forum for example).
* @param int An optional parent ID.
*/
function build_moderators($moderators=array(), $pid=0)
{
if($this->moderators_forum_cache[$pid])
{
foreach($this->moderators_forum_cache[$pid] as $main)
{
foreach($main as $forum)
{
$forum_mods = '';
if($moderators)
{
$forum_mods = $moderators;
}
// Append - local settings override that of a parent - array_merge works here
if($this->moderators[$forum['fid']])
{
if(is_array($forum_mods))
{
$forum_mods = array_merge($forum_mods, $this->moderators[$forum['fid']]);
}
else
{
$forum_mods = $this->moderators[$forum['fid']];
}
}
$this->built_moderators[$forum['fid']] = $forum_mods;
$this->build_moderators($forum_mods, $forum['fid']);
}
}
}

	}

/**

	}

/**

Zeile 347Zeile 398
				{
unset($forum[$key]);
}

				{
unset($forum[$key]);
}

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

 
			}

			}

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

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

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

 
	


/**
* Update usertitles cache.


/**
* Update usertitles cache.