[patch] update_logs_table.php

"Jason M. Felice" <[email protected]>
Newsgroups gmane.comp.horde.whups
Message-ID <[email protected]>
My old comments weren't showing up because there were no entries in
whups_logs for the comments in whups_comments.

The following patch to update_logs_table.php will add the appropriate
entries.

It's the first patch from `epm', my new patch manager, so let me know if it
horks (it applies fine here).

-- 
 Jason M. Felice
 Cronosys, LLC <http://www.cronosys.com/>
 216.221.4600 x302


-- 
Whups mailing list
Frequently Asked Questions: http://horde.org/faq/
To unsubscribe, mail: [email protected]
whups-update_logs.diff (text/plain, 1.1 KB)
epm diff update_logs_table.php
--- update_logs_table.php	2003-08-22 14:35:34.000000000 -0400
+++ update_logs_table.php	2003-08-22 14:37:08.000000000 -0400
@@ -72,6 +72,42 @@
     }
 }
 
+$sql = 'INSERT INTO whups_logs (
+	ticket_id,
+	state_id_to,
+	priority_id_to,
+	log_timestamp,
+	user_id,
+	comment_id_log,
+	type_id_to,
+	module_id_to,
+	user_uid_action,
+	user_uid_changed
+    ) SELECT
+	whups_comments.ticket_id,
+	whups_tickets.state_id,
+	whups_tickets.priority_id,
+	whups_comments.comment_timestamp,
+	whups_comments.user_id_creator,
+	whups_comments.comment_id,
+	whups_tickets.type_id,
+	whups_tickets.module_id,
+	NULL,
+	NULL
+    FROM
+	whups_comments,
+	whups_tickets
+    WHERE
+    	whups_tickets.ticket_id = whups_comments.ticket_id
+	AND whups_comments.comment_id NOT IN (
+	    SELECT comment_id_log FROM whups_logs
+	);';
+$result = $db->query($sql);
+if (is_a($result,'PEAR_Error')) {
+    $output .= 'Could not add log entries for old comments.';
+    $output .= $result->toString() . "\n\n";
+}
+
 if (empty($output)) {
     echo "Migrated successfully.\n";
 } else {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.