Seite 1 von 1

Cachepath ändern

Verfasst: 01.12.2007 22:22
von StRiCKHoSe
Hallo PHPbb Comunity,

war bist jetzt stiller Mitleser, aber nun bräuchte ich eure Hilfe. ;)


Ich möchte gerne phpbb3 Foren hosten (Datenbank basierend).
Nun können aber nicht alle Foren den gleichen Cache verwenden.
Daher wird für jedes vom User registrierte Forum einen eigenen Cache-Ordner erstellt in cache/"subdomain"_cache.

Nun muss ich dem PHPbb3 Board ja sagen, dass er für jedes Forum den eigenen Cache verwenden soll.

Folgendes habe ich gefunden:

Code: Alles auswählen

templates.php

// Root dir and hash of filenames for each template handle.
var $root = '';
var $cachepath = "cache/$subdomain_cache";
var $files = array();
var $filename = array();

	// this will hash handle names to the compiled/uncompiled code for that handle.
	var $compiled_code = array();
var $cachepath = war vorher leer.

Nun wird bei den Userforen aber immer noch alles im cache/ ordner abgespeichert. Gibt es noch mehr zu ändern?

Chmod von cache/ und cache/"subdomain"_cache, ist 777.



Mit freundlichen Grüssen

Winkler Marcel / StRiCkHoSe

Verfasst: 02.12.2007 22:59
von StRiCKHoSe
*push*

Hallo Leute ich hoffe ich hab mein Problem gut genug geschildert?

MFG

Verfasst: 04.12.2007 17:25
von Dave
hi
includes/template.php

Code: Alles auswählen

			$this->cachepath = $phpbb_root_path . 'cache/tpl_' . $user->theme['template_path'] . '_';
&

Code: Alles auswählen

$this->cachepath = $phpbb_root_path . 'cache/ctpl_' . $template_name . '_';
inculdes/acm/acm_file.php

Code: Alles auswählen

		$this->cache_dir = $phpbb_root_path . 'cache/';
Ich denke mal das suchste ;) Ob es noch mehr stellen gibt kann ich dir gerade nicht sagen. Das sind die, die mir gerade einfallen.


MfG
Dave

Verfasst: 06.12.2007 20:59
von StRiCKHoSe
Hallo Leute

Danke an Dave die Pfade hab ich komplett übersehen ;)

hab jetzt mal auf RC 8 geupdated. Und hab die ganze Sache nochmals vereinfacht.

Nun wird kein eigener Ordner erstellt sondern einfach die Datei umgeschrieben.

Das passiert ja eigentlich in der template.php oder?

Hier der Ausschnitt meiner template.php

Code: Alles auswählen

<?php
$split = explode('.', $_SERVER['HTTP_HOST']);
$subdomain = ereg_replace('http://', '', $split[0]);

/**
*
* @package phpBB3
* @version $Id: template.php,v 1.116 2007/10/04 12:02:03 acydburn Exp $
* @copyright (c) 2005 phpBB Group, sections (c) 2001 ispi of Lincoln Inc
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
	exit;
}

/**
* Base Template class.
* @package phpBB3
*/
class template
{
	/** variable that holds all the data we'll be substituting into
	* the compiled templates. Takes form:
	* --> $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value
	* if it's a root-level variable, it'll be like this:
	* --> $this->_tpldata[.][0][varname] == value
	*/
	var $_tpldata = array('.' => array(0 => array()));
	var $_rootref;

	// Root dir and hash of filenames for each template handle.
	var $root = '';
	var $cachepath = 'cache/';
	var $files = array();
	var $filename = array();

	// this will hash handle names to the compiled/uncompiled code for that handle.
	var $compiled_code = array();

	/**
	* Set template location
	* @access public
	*/
	function set_template()
	{
		global $phpbb_root_path, $user;

		if (file_exists($phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template'))
		{
			$this->root = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template';
			$this->cachepath = $phpbb_root_path . "cache/tpl_$subdomain_" . $user->theme['template_path'] . '_';
		}
		else
		{
			trigger_error('Template path could not be found: styles/' . $user->theme['template_path'] . '/template', E_USER_ERROR);
		}

		$this->_rootref = &$this->_tpldata['.'][0];

		return true;
	}

	/**
	* Set custom template location (able to use directory outside of phpBB)
	* @access public
	*/
	function set_custom_template($template_path, $template_name)
	{
		global $phpbb_root_path;

		$this->root = $template_path;
		$this->cachepath = $phpbb_root_path . "cache/ctpl_$subdomain_" . $template_name . '_';

		return true;
	}


Jedoch werden immer noch die normalen Cachedateien erstellt.

Verfasst: 06.12.2007 22:41
von Dave
also

Code: Alles auswählen

var $cachepath = 'cache/';
kann

Code: Alles auswählen

var $cachepath = '';
bleiben.

Dann

Code: Alles auswählen

$this->cachepath = $phpbb_root_path . "cache/tpl_{$subdomain}_" . $user->theme['template_path'] . '_';
und

Code: Alles auswählen

$this->cachepath = $phpbb_root_path . "cache/ctpl_{$subdomain}_" . $template_name . '_';
Und was noch fehlt ist das in $subdomain was drin steht ;) Ein

Code: Alles auswählen

global $subdomain;
wäre angebracht :D

Verfasst: 08.12.2007 09:01
von StRiCKHoSe
Guten Morgen

Deine ersten Schritte kann ich gut nachvollziehen.

Jedoch beim deinem letzten Schritt musst du mir nochmals Nachhilfe geben ;)

Ich hab mich mal über diese Globale Funktion schlau gemacht. Wenn ich das richtig verstehe muss ich eine globale variable erstellen damit diese auch im ganzen script verfügbar ist oder? also in der template.php.

Nach meinem neu angeeigneten Wissen muss jetzt der Anfang der template.php so aussehen:

Code: Alles auswählen

<?php
$split = explode('.', $_SERVER['HTTP_HOST']);
global $subdomain = ereg_replace('http://', '', $split[0]);
Jedoch wird nun eine Fehlermeldung bei Aufruf des Forums ausgegeben.

Parse error: syntax error, unexpected '=', expecting ',' or ';' in /var/www/web534/html/foren/includes/template.php on line 3


und noch ne andere Frage. Was ist mit den anderes Dateien im Cache? Wo werden denn die definiert?

Gruss StRiCkHoSe



-----------------------


EDIT:

Habs nun geschafft.

Code: Alles auswählen

<?php
$split = explode('.', $_SERVER['HTTP_HOST']);
global $subdomain;
$subdomain = ereg_replace('http://', '', $split[0]);
;)

Jedoch werden die Cachedateien nicht umgeschrieben sondern immer noch die gleichen erstellt.

Verfasst: 08.12.2007 18:36
von Dave
Hi

Ersetze mal

Code: Alles auswählen

	function set_template()
	{
		global $phpbb_root_path, $user;

		if (file_exists($phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template'))
		{
			$this->root = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template';
			$this->cachepath = $phpbb_root_path . 'cache/tpl_' . $user->theme['template_path'] . '_';
		}
		else
		{
			trigger_error('Template path could not be found: styles/' . $user->theme['template_path'] . '/template', E_USER_ERROR);
		}

		$this->_rootref = &$this->_tpldata['.'][0];

		return true;
	}

	/**
	* Set custom template location (able to use directory outside of phpBB)
	* @access public
	*/
	function set_custom_template($template_path, $template_name)
	{
		global $phpbb_root_path;

		$this->root = $template_path;
		$this->cachepath = $phpbb_root_path . 'cache/ctpl_' . $template_name . '_';

		return true;
	}
mit

Code: Alles auswählen

	var $sub_path = '';

	function template()
	{
		$path = explode('.', $_SERVER['HTTP_HOST']);
		$this->sub_path = $path[0];
		
	}

	/**
	* Set template location
	* @access public
	*/
	function set_template()
	{
		global $phpbb_root_path, $user;

		if (file_exists($phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template'))
		{
			$this->root = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template';
			$this->cachepath = $phpbb_root_path . 'cache/tpl_' . $this->sub_cache . '_' . $user->theme['template_path'] . '_';
		}
		else
		{
			trigger_error('Template path could not be found: styles/' . $user->theme['template_path'] . '/template', E_USER_ERROR);
		}

		$this->_rootref = &$this->_tpldata['.'][0];

		return true;
	}

	/**
	* Set custom template location (able to use directory outside of phpBB)
	* @access public
	*/
	function set_custom_template($template_path, $template_name)
	{
		global $phpbb_root_path;

		$this->root = $template_path;
		$this->cachepath = $phpbb_root_path . 'cache/ctpl_' . $this->sub_cache . '_' . $template_name . '_';

		return true;
	}
Als sub_path wird dann IMMER die subdomain genommen. Gibst du die domain ein ohne www. oder user1. wird der domain name benutzt!

Ich habe es nicht getestet. Also versuch mal dein Glück :wink:

Verfasst: 08.12.2007 20:35
von StRiCKHoSe
Das Glück hat mich verlassen.

Leider hat das nichts bewirkt. Immer noch die gleichen Dateien im Cacheordner.

Es wird keine Fehlermeldung ausgegeben.