Vergleich inc/class_datacache.php - 1.2.4 - 1.2.12

  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 2671 2007-01-26 07:11:42Z 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.
*
*/

	 * Update the posticon cache.
*
*/

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

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

		}


		}


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

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

		{

		{

			return false;
}
reset($forum_cache);

			return false;
}
reset($forum_cache);

Zeile 266Zeile 262
	 *
* @param array An optional permissions array.
* @param int An optional permission id.

	 *
* @param array An optional permissions array.
* @param int An optional permission id.

	 */

	 */

	function buildforumpermissions($permissions="", $pid=0)
{
global $fcache, $usergroupcache, $fperms, $forumpermissions;

	function buildforumpermissions($permissions="", $pid=0)
{
global $fcache, $usergroupcache, $fperms, $forumpermissions;

Zeile 295Zeile 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()
{
global $db;

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

/**
* Update the moderators cache.
*
*/
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;
























































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

function updatemoderators()
{
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']);
}
}

		}

		}

		$this->update("moderators", $mods);

 
	}

/**

	}

/**

Zeile 348Zeile 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.