sync Funktion Problem /

Probleme bei der regulären Arbeiten mit phpBB, Fragen zu Vorgehensweisen oder Funktionsweise sowie sonstige Fragen zu phpBB im Allgemeinen.
Forumsregeln
phpBB 2.0 hat das Ende seiner Lebenszeit überschritten
phpBB 2.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 2.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf phpBB 3.1, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
Antworten
Vatex
Mitglied
Beiträge: 99
Registriert: 03.09.2006 17:30

sync Funktion Problem /

Beitrag von Vatex »

Hallo,

habe etwas sehr eigenartiges festgestellt. Die phpBB Standartfunktion sync (includes/functions_admin.php) führt alle SQL korrekt aus, allerdings funktioniert das UPDATE Statement nicht, obwohl die Syntax Korrekt ist. Der selbe UPDATE Query mit phpmyadmin funktioniert einwandfrei.

Hier der Code aus der sync Funktion:

Code: Alles auswählen

case 'forum':
		$sql = "SELECT MAX(post_id) AS last_post, COUNT(post_id) AS total
				FROM " . POSTS_TABLE . "  
				WHERE forum_id = $id";
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Could not get post ID', '', __LINE__, __FILE__, $sql);
		}

		if ( $row = $db->sql_fetchrow($result) )
		{
			$last_post = ( $row['last_post'] ) ? $row['last_post'] : 0;
			$total_posts = ($row['total']) ? $row['total'] : 0;
		}
		else
		{
			$last_post = 0;
			$total_posts = 0;
		}

		$sql = "SELECT COUNT(topic_id) AS total
				FROM " . TOPICS_TABLE . "
				WHERE forum_id = $id";
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Could not get topic count', '', __LINE__, __FILE__, $sql);
		}

		$total_topics = ( $row = $db->sql_fetchrow($result) ) ? ( ( $row['total'] ) ? $row['total'] : 0 ) : 0;

		$sql = "UPDATE " . FORUMS_TABLE . "
				SET forum_last_post_id = $last_post, forum_posts = $total_posts, forum_topics = $total_topics
				WHERE forum_id = $id";
		echo $sql."<br>";
		if ( !$db->sql_query($sql) )
		{
			message_die(GENERAL_ERROR, 'Could not update forum', '', __LINE__, __FILE__, $sql);
		}
		break;
Das QUERY was nicht funktioniert:

Code: Alles auswählen

UPDATE phpbb_forums SET forum_last_post_id = 9890, forum_posts = 32, forum_topics = 32 WHERE forum_id = 46
Die forum_id gibt es in der Datenbank. Eigenartigerweise funktioniert es wenn die sync Funktion in einem anderen Script aufgerufen wird.

Woran kann das nur liegen?
Antworten

Zurück zu „phpBB 2.0: Administration, Benutzung und Betrieb“