Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/setup/upgrade/0.9.9/convert_private.php
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2020-02-01 09:05:48 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2020-02-01 09:05:48 +0100
commit6854cb3f4d8219cf1829e32122eb2502a916eae9 (patch)
tree350feb504587d932e02837a1442b059759927646 /setup/upgrade/0.9.9/convert_private.php
initial checkin
Diffstat (limited to 'setup/upgrade/0.9.9/convert_private.php')
-rw-r--r--setup/upgrade/0.9.9/convert_private.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/setup/upgrade/0.9.9/convert_private.php b/setup/upgrade/0.9.9/convert_private.php
new file mode 100644
index 0000000..b871d39
--- /dev/null
+++ b/setup/upgrade/0.9.9/convert_private.php
@@ -0,0 +1,26 @@
+<?php
+ /**********************************************************\
+ | This script converts the private/public history entries |
+ \***********************************************************/
+
+
+$check_sql = $db->query('SELECT * FROM {history} WHERE event_type = 26 OR event_type = 27');
+
+while ($row = $db->fetchRow($check_sql))
+{
+ $db->query('DELETE FROM {history} WHERE history_id = ?', array($row['history_id']));
+ if ($row['event_type'] == 26) {
+ $row['old_value'] = 0;
+ $row['new_value'] = 1;
+ }
+ if ($row['event_type'] == 27) {
+ $row['old_value'] = 1;
+ $row['new_value'] = 0;
+ }
+ $db->query("INSERT INTO {history} (task_id, user_id, event_date, event_type, field_changed, old_value, new_value)
+ VALUES(?, ?, ?, 0, 'mark_private', ?, ?)",
+ array($row['task_id'], $row['user_id'], $row['event_date'], $row['old_value'], $row['new_value']));
+}
+
+
+?>