Seite 1 von 1

wieder prune.php

Verfasst: 08.02.2006 22:19
von valenterry
Es ist zum verzweifeln... ich hab die Datei mittlerweile 3mal neu drauf gepackt und die Mods wieder installiert. Diesmal gibt es diesen Fehler beim betreten des Forums:

Code: Alles auswählen

Parse error: parse error, unexpected T_VARIABLE, expecting '{' in /usr/export/www/hosting/valenterry/forum/phpBB2/includes/prune.php on line 32
und hier ist der Abschnitt in der prune.php, bitte helft mir!!!

Code: Alles auswählen

if ( !defined('IN_PHPBB') )
{
   die("Hacking attempt");
}

require($phpbb_root_path . 'includes/functions_search.'.$phpEx);

function prune($forum_id, $prune_date, $prune_all = false)

######	$sql = "SELECT * ######
		FROM " . PRUNE_TABLE . "
		WHERE forum_id = $forum_id";
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not read auto_prune table', '', __LINE__, __FILE__, $sql);
	}

	$row = $db->sql_fetchrow($result);

	$prune_type = ( $prune_all ) ? PRUNE_DELETE : $row['prune_type'];
	$move_to = $row['move_to'];

{
	global $db, $lang;

	$prune_all = ($prune_all) ? '' : 'AND t.topic_vote = 0 AND t.topic_type <> ' . POST_ANNOUNCE;
	//
	// Those without polls and announcements ... unless told otherwise!
	//
	$sql = "SELECT t.topic_id
		FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t
		WHERE t.forum_id = $forum_id
			$prune_all
			AND ( p.post_id = t.topic_last_post_id
				OR t.topic_last_post_id = 0 )";
	if ( $prune_date != '' )
(mit ###### ###### ist line 32 gekennzeichnet)

Verfasst: 08.02.2006 23:11
von rabbit
hast du denn einen MOD eingebaut, der die datei betrifft?

Verfasst: 08.02.2006 23:26
von valenterry
Ja, den Pruning_add_Move_Close Mod.
Ich hab auch (als ich nach der Installation eine Fehlermeldung bekommen
habe) ein Backup wieder draufgespielt und die Datei nochmal geändert, aber
der Fehler kam wieder und ich bin mir sicher, dass ich nichts falsch eingebaut
habe. Liegt denn der Fehler in der Datei selbst?

Verfasst: 09.02.2006 06:57
von rabbit
kenne den MOD nicht. verlinke doch mal deine prune.php hier als .txt-datei (KB:datei) und poste außerdem noch die passage aus der install.txt des MOD, in der es um die prune.php geht.

Verfasst: 09.02.2006 14:28
von valenterry
Hier ist die prune.txt

und das hier ist der Installationsabschnitt:

Code: Alles auswählen

#
#-----[ OPEN ]------------------------------------------
#

includes/prune.php

#
#-----[ FIND ]------------------------------------------
#

function prune($forum_id, $prune_date, $prune_all = false)
{
	global $db, $lang;

#
#-----[ AFTER, ADD ]------------------------------------------
#

	$sql = "SELECT *
		FROM " . PRUNE_TABLE . "
		WHERE forum_id = $forum_id";
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not read auto_prune table', '', __LINE__, __FILE__, $sql);
	}

	$row = $db->sql_fetchrow($result);

	$prune_type = ( $prune_all ) ? PRUNE_DELETE : $row['prune_type'];
	$move_to = $row['move_to'];

#
#-----[ FIND ]------------------------------------------
#

		$sql = "SELECT post_id
			FROM " . POSTS_TABLE . "
			WHERE forum_id = $forum_id
				AND topic_id IN ($sql_topics)";
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Could not obtain list of posts to prune', '', __LINE__, __FILE__, $sql);
		}

		$sql_post = '';
		while ( $row = $db->sql_fetchrow($result) )
		{
			$sql_post .= ( ( $sql_post != '' ) ? ', ' : '' ) . $row['post_id'];
		}
		$db->sql_freeresult($result);

		if ( $sql_post != '' )
		{
			$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "
				WHERE topic_id IN ($sql_topics)";
			if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
			{
				message_die(GENERAL_ERROR, 'Could not delete watched topics during prune', '', __LINE__, __FILE__, $sql);
			}

			$sql = "DELETE FROM " . TOPICS_TABLE . "
				WHERE topic_id IN ($sql_topics)";
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not delete topics during prune', '', __LINE__, __FILE__, $sql);
			}

			$pruned_topics = $db->sql_affectedrows();

			$sql = "DELETE FROM " . POSTS_TABLE . "
				WHERE post_id IN ($sql_post)";
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not delete post_text during prune', '', __LINE__, __FILE__, $sql);
			}

			$pruned_posts = $db->sql_affectedrows();

			$sql = "DELETE FROM " . POSTS_TEXT_TABLE . "
				WHERE post_id IN ($sql_post)";
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not delete post during prune', '', __LINE__, __FILE__, $sql);
			}

			remove_search_post($sql_post);

			return array ('topics' => $pruned_topics, 'posts' => $pruned_posts);

#
#-----[ REPLACE WITH ]------------------------------------------
#

		if ( $prune_type == PRUNE_MOVE || $prune_type == PRUNE_LOCK )
		{
			$move_sql = ( $prune_type == PRUNE_MOVE ) ? "forum_id = $move_to," : '';

			$sql = "UPDATE " . TOPICS_TABLE . "
				SET $move_sql topic_status = " . TOPIC_LOCKED . "
				WHERE forum_id = $forum_id
					AND topic_id IN ($sql_topics)";
			if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
			{
				message_die(GENERAL_ERROR, 'Could not move/lock topics during prune', '', __LINE__, __FILE__, $sql);
			}

			$pruned_topics = $db->sql_affectedrows();
            
			if ( $prune_type == PRUNE_MOVE )
			{
				$sql = "UPDATE " . POSTS_TABLE . "
					SET forum_id = $move_to
					WHERE forum_id = $forum_id
						AND topic_id IN ($sql_topics)";
				if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
				{
					message_die(GENERAL_ERROR, 'Could not move posts during prune', '', __LINE__, __FILE__, $sql);
				}
				
				$pruned_posts = $db->sql_affectedrows();
				
				sync('forum', $move_to);
			}
			
			return array ('topics' => $pruned_topics, 'posts' => $pruned_posts);
		}
		else
		{
			$sql = "SELECT post_id
				FROM " . POSTS_TABLE . "
				WHERE forum_id = $forum_id
					AND topic_id IN ($sql_topics)";
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not obtain list of posts to prune', '', __LINE__, __FILE__, $sql);
			}
			
			$sql_post = '';
			while ( $row = $db->sql_fetchrow($result) )
			{
				$sql_post .= ( ( $sql_post != '' ) ? ', ' : '' ) . $row['post_id'];
			}
			$db->sql_freeresult($result);

			if ( $sql_post != '' )
			{
				$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "
					WHERE topic_id IN ($sql_topics)";
				if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
				{
					message_die(GENERAL_ERROR, 'Could not delete watched topics during prune', '', __LINE__, __FILE__, $sql);
				}
				
				$sql = "DELETE FROM " . TOPICS_TABLE . "
					WHERE topic_id IN ($sql_topics)";
				if ( !$db->sql_query($sql) )
				{
					message_die(GENERAL_ERROR, 'Could not delete topics during prune', '', __LINE__, __FILE__, $sql);
				}

                		$pruned_topics = $db->sql_affectedrows();

                		$sql = "DELETE FROM " . POSTS_TABLE . "
                    		WHERE post_id IN ($sql_post)";
				if ( !$db->sql_query($sql) )
				{
					message_die(GENERAL_ERROR, 'Could not delete post_text during prune', '', __LINE__, __FILE__, $sql);
				}

				$pruned_posts = $db->sql_affectedrows();
				
				$sql = "DELETE FROM " . POSTS_TEXT_TABLE . "
					WHERE post_id IN ($sql_post)";
				if ( !$db->sql_query($sql) )
				{
					message_die(GENERAL_ERROR, 'Could not delete post during prune', '', __LINE__, __FILE__, $sql);
				}

				remove_search_post($sql_post);

				return array ('topics' => $pruned_topics, 'posts' => $pruned_posts);
			}

#
#-----[ OPEN ]------------------------------------------
#
Danke schonmal im voraus :D

Verfasst: 09.02.2006 22:24
von rabbit
du solltest mehr aufmerksamkeit beim einbau von MODs walten lassen und die zeilen bis zum ende lesen. ;)
der code soll nicht nach

Code: Alles auswählen

function prune($forum_id, $prune_date, $prune_all = false)
sondern nach

Code: Alles auswählen

function prune($forum_id, $prune_date, $prune_all = false) 
{ 
   global $db, $lang;
eingefügt werden.

also tu dies:
suche

Code: Alles auswählen

function prune($forum_id, $prune_date, $prune_all = false)

	$sql = "SELECT *
		FROM " . PRUNE_TABLE . "
		WHERE forum_id = $forum_id";
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not read auto_prune table', '', __LINE__, __FILE__, $sql);
	}

	$row = $db->sql_fetchrow($result);

	$prune_type = ( $prune_all ) ? PRUNE_DELETE : $row['prune_type'];
	$move_to = $row['move_to'];

{
	global $db, $lang;
und ersetze mit

Code: Alles auswählen

function prune($forum_id, $prune_date, $prune_all = false)
{
	global $db, $lang;
  
  $sql = "SELECT *
		FROM " . PRUNE_TABLE . "
		WHERE forum_id = $forum_id";
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not read auto_prune table', '', __LINE__, __FILE__, $sql);
	}

	$row = $db->sql_fetchrow($result);

	$prune_type = ( $prune_all ) ? PRUNE_DELETE : $row['prune_type'];
	$move_to = $row['move_to'];