Vergleich inc/class_datacache.php - 1.6.5 - 1.6.13

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: class_datacache.php 5473 2011-06-23 11:12:10Z Tomm $

 * $Id$

 */

class datacache

 */

class datacache

Zeile 95Zeile 95
	function read($name, $hard=false)
{
global $db, $mybb;

	function read($name, $hard=false)
{
global $db, $mybb;

		



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

Zeile 106Zeile 106
		else if($hard == false && !is_object($this->handler))
{
return false;

		else if($hard == false && !is_object($this->handler))
{
return false;

		}


		}


		if(is_object($this->handler))
{
$data = $this->handler->fetch($name);

		if(is_object($this->handler))
{
$data = $this->handler->fetch($name);

			



			// No data returned - cache gone bad?
if($data === false)
{

			// No data returned - cache gone bad?
if($data === false)
{

Zeile 119Zeile 119
				$query = $db->simple_select("datacache", "title,cache", "title='".$db->escape_string($name)."'");
$cache_data = $db->fetch_array($query);
$data = @unserialize($cache_data['cache']);

				$query = $db->simple_select("datacache", "title,cache", "title='".$db->escape_string($name)."'");
$cache_data = $db->fetch_array($query);
$data = @unserialize($cache_data['cache']);

				
if($data == null)
{
$data = '';
}









				// Update cache for handler
$this->handler->put($name, $data);
}

				// Update cache for handler
$this->handler->put($name, $data);
}

		}		

		}

		// Else, using internal database cache
else
{
$query = $db->simple_select("datacache", "title,cache", "title='$name'");
$cache_data = $db->fetch_array($query);

		// Else, using internal database cache
else
{
$query = $db->simple_select("datacache", "title,cache", "title='$name'");
$cache_data = $db->fetch_array($query);

 


			if(!$cache_data['title'])
{
$data = false;

			if(!$cache_data['title'])
{
$data = false;

Zeile 309Zeile 305
	 *
*/
function update_badwords()

	 *
*/
function update_badwords()

	{
global $db;


	{
global $db;


		$badwords = array();

		$badwords = array();





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

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

Zeile 325Zeile 321

/**
* Update the usergroups cache.


/**
* Update the usergroups cache.

	 *

	 *

	 */
function update_usergroups()
{
global $db;

	 */
function update_usergroups()
{
global $db;

		

		

		$query = $db->simple_select("usergroups");
while($g = $db->fetch_array($query))
{

		$query = $db->simple_select("usergroups");
while($g = $db->fetch_array($query))
{

Zeile 338Zeile 334
		}

$this->update("usergroups", $gs);

		}

$this->update("usergroups", $gs);

	}

	}


/**
* Update the forum permissions cache.


/**
* Update the forum permissions cache.

Zeile 377Zeile 373
		// Fetch forum permissions from the database
$query = $db->simple_select("forumpermissions");
while($forum_permission = $db->fetch_array($query))

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

		{

		{

			$this->forum_permissions[$forum_permission['fid']][$forum_permission['gid']] = $forum_permission;
}


			$this->forum_permissions[$forum_permission['fid']][$forum_permission['gid']] = $forum_permission;
}


Zeile 415Zeile 411
						}
}
$this->build_forum_permissions($perms, $forum['fid']);

						}
}
$this->build_forum_permissions($perms, $forum['fid']);

				}
}

				}
}

		}
}


		}
}


Zeile 627Zeile 623
	 *
*/
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 668Zeile 664
	 * Update update_check cache (dummy function used by upgrade/install scripts)
*/
function update_update_check()

	 * Update update_check cache (dummy function used by upgrade/install scripts)
*/
function update_update_check()

	{

	{

		$update_cache = array(
"dateline" => TIME_NOW
);

		$update_cache = array(
"dateline" => TIME_NOW
);

Zeile 680Zeile 676
	 * 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);


Zeile 732Zeile 728
		}

$this->update("bannedemails", $banned_emails);

		}

$this->update("bannedemails", $banned_emails);

	}


	}


	/**
* Updates the search engine spiders cache
*/

	/**
* Updates the search engine spiders cache
*/

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

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

	}

	}

	
function update_most_replied_threads()
{
global $db, $mybb;

	
function update_most_replied_threads()
{
global $db, $mybb;

		

		

		$threads = array();

		$threads = array();

		

		

		$query = $db->simple_select("threads", "tid, subject, replies, fid", "visible='1'", array('order_by' => 'replies', 'order_dir' => 'DESC', 'limit_start' => 0, 'limit' => $mybb->settings['statslimit']));

		$query = $db->simple_select("threads", "tid, subject, replies, fid", "visible='1'", array('order_by' => 'replies', 'order_dir' => 'DESC', 'limit_start' => 0, 'limit' => $mybb->settings['statslimit']));

		while($thread = $db->fetch_array($query))
{
$threads[] = $thread;
}


		while($thread = $db->fetch_array($query))
{
$threads[] = $thread;
}


		$this->update("most_replied_threads", $threads);
}


		$this->update("most_replied_threads", $threads);
}


Zeile 813Zeile 809
			$bday['bday'] = explode('-', $bday['birthday']);
array_pop($bday['bday']);
$bday['bday'] = implode('-', $bday['bday']);

			$bday['bday'] = explode('-', $bday['birthday']);
array_pop($bday['bday']);
$bday['bday'] = implode('-', $bday['bday']);

			

			

			if($bday['birthdayprivacy'] != 'all')
{
++$birthdays[$bday['bday']]['hiddencount'];

			if($bday['birthdayprivacy'] != 'all')
{
++$birthdays[$bday['bday']]['hiddencount'];

Zeile 839Zeile 835
		while($groupleader = $db->fetch_array($query))
{
$groupleaders[$groupleader['uid']][] = $groupleader;

		while($groupleader = $db->fetch_array($query))
{
$groupleaders[$groupleader['uid']][] = $groupleader;

		}

		}

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

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

Zeile 875Zeile 871
				if(!isset($fd_statistics[$forum['fid']]['announcements']))
{
$fd_statistics[$forum['fid']]['announcements'] = 1;

				if(!isset($fd_statistics[$forum['fid']]['announcements']))
{
$fd_statistics[$forum['fid']]['announcements'] = 1;

				}
}
}

// Do we have any mod tools to use in our forums?
$query = $db->simple_select("modtools", "forums, tid", "type = 't'", array("order_by" => "tid"));

				}
}
}

// Do we have any mod tools to use in our forums?
$query = $db->simple_select("modtools", "forums, tid", '', array("order_by" => "tid"));


if($db->num_rows($query))
{


if($db->num_rows($query))
{

Zeile 905Zeile 901
		}

$this->update("forumsdisplay", $fd_statistics);

		}

$this->update("forumsdisplay", $fd_statistics);

	}


	}


	/* Other, extra functions for reloading caches if we just changed to another cache extension (i.e. from db -> xcache) */
function reload_mostonline()

	/* Other, extra functions for reloading caches if we just changed to another cache extension (i.e. from db -> xcache) */
function reload_mostonline()

	{
global $db;

	{
global $db;


$query = $db->simple_select("datacache", "title,cache", "title='mostonline'");
$this->update("mostonline", @unserialize($db->fetch_field($query, "cache")));
}


$query = $db->simple_select("datacache", "title,cache", "title='mostonline'");
$this->update("mostonline", @unserialize($db->fetch_field($query, "cache")));
}





	function reload_plugins()

	function reload_plugins()

	{
global $db;


	{
global $db;


		$query = $db->simple_select("datacache", "title,cache", "title='plugins'");
$this->update("plugins", @unserialize($db->fetch_field($query, "cache")));
}

		$query = $db->simple_select("datacache", "title,cache", "title='plugins'");
$this->update("plugins", @unserialize($db->fetch_field($query, "cache")));
}

Zeile 946Zeile 942

$query = $db->simple_select("datacache", "title,cache", "title='version_history'");
$this->update("version_history", @unserialize($db->fetch_field($query, "cache")));


$query = $db->simple_select("datacache", "title,cache", "title='version_history'");
$this->update("version_history", @unserialize($db->fetch_field($query, "cache")));

 
	}

function reload_modnotes()
{
global $db;

$query = $db->simple_select("datacache", "title,cache", "title='modnotes'");
$this->update("modnotes", @unserialize($db->fetch_field($query, "cache")));
}

function reload_adminnotes()
{
global $db;

$query = $db->simple_select("datacache", "title,cache", "title='adminnotes'");
$this->update("adminnotes", @unserialize($db->fetch_field($query, "cache")));

	}
}
?>

	}
}
?>