Commit r2369: https://sourceforge.net/p/mrbs/code/2369/

------------------------------------------------------------------------
r2369 | jberanek | 2012-08-01 22:06:31 +0100 (Wed, 01 Aug 2012) | 1 line
Changed paths:
   M /mrbs/trunk/web/upgrade/17/post.inc
   M /mrbs/trunk/web/upgrade/24/post.inc
   M /mrbs/trunk/web/upgrade/25/mysql.sql
   M /mrbs/trunk/web/upgrade/25/pgsql.sql

Upgrade fixes as suggested in [bugs:#224]
------------------------------------------------------------------------

Index: mrbs/trunk/web/upgrade/24/post.inc
===================================================================
--- mrbs/trunk/web/upgrade/24/post.inc  (revision 2368)
+++ mrbs/trunk/web/upgrade/24/post.inc  (revision 2369)
@@ -51,6 +51,39 @@
 
 $start_clock = get_microtime();
 
+$sql = "ALTER TABLE $tbl_entry ADD COLUMN saved_ts DATETIME";
+$res = sql_command($sql);
+if ($res == -1)
+{
+  trigger_error(sql_error(), E_USER_WARNING);
+  // No need to localise, should never happen
+  print "<span class=\"error\">Failed to add saved_ts column in entry table.</
+}
+$sql = "UPDATE $tbl_entry SET saved_ts=timestamp"l
+$res = sql_command($sql);
+if ($res == -1)
+{
+  trigger_error(sql_error(), E_USER_WARNING);
+  // No need to localise, should never happen
+  print "<span class=\"error\">Failed to set saved_ts column in entry table.</
+}
+$sql = "ALTER TABLE $tbl_repeat ADD COLUMN saved_ts DATETIME";
+$res = sql_command($sql);
+if ($res == -1)
+{
+  trigger_error(sql_error(), E_USER_WARNING);
+  // No need to localise, should never happen
+  print "<span class=\"error\">Failed to add saved_ts column in repeat table.</
+}
+$sql = "UPDATE $tbl_repeat SET saved_ts=timestamp"l
+$res = sql_command($sql);
+if ($res == -1)
+{
+  trigger_error(sql_error(), E_USER_WARNING);
+  // No need to localise, should never happen
+  print "<span class=\"error\">Failed to set saved_ts column in repeat table.</
+}
+
 // MySQL (mysql and mysqli)
 // ------------------------
 if ($dbsys != "pgsql")
@@ -140,6 +173,39 @@
   do_sql_command($sql, 4);
 }
 
+$sql = "UPDATE $tbl_entry SET timestamp=saved_ts";
+$res = sql_command($sql);
+if ($res == -1)
+{
+  trigger_error(sql_error(), E_USER_WARNING);
+  // No need to localise, should never happen
+  print "<span class=\"error\">Failed to update timestamp column in entry 
table.</span>";
+}
+$sql = "ALTER TABLE $tbl_entry DROP COLUMN saved_ts";
+$res = sql_command($sql);
+if ($res == -1)
+{
+  trigger_error(sql_error(), E_USER_WARNING);
+  // No need to localise, should never happen
+  print "<span class=\"error\">Failed to delete saved_ts column in entry 
table.</span>";
+}
+$sql = "UPDATE $tbl_repeat SET timestamp=saved_ts";
+$res = sql_command($sql);
+if ($res == -1)
+{
+  trigger_error(sql_error(), E_USER_WARNING);
+  // No need to localise, should never happen
+  print "<span class=\"error\">Failed to update timestamp column in repeat 
table.</span>";
+}
+$sql = "ALTER TABLE $tbl_repeat DROP COLUMN saved_ts";
+$res = sql_command($sql);
+if ($res == -1)
+{
+  trigger_error(sql_error(), E_USER_WARNING);
+  // No need to localise, should never happen
+  print "<span class=\"error\">Failed to delete saved_ts column in repeat 
table.</span>";
+}
+
 $stop_clock = get_microtime();
 $clock_diff = $stop_clock - $start_clock;
 if (is_float($start_clock))
Index: mrbs/trunk/web/upgrade/25/mysql.sql
===================================================================
--- mrbs/trunk/web/upgrade/25/mysql.sql (revision 2368)
+++ mrbs/trunk/web/upgrade/25/mysql.sql (revision 2369)
@@ -4,5 +4,9 @@
 # series that has been modified, ie has entry_type=2, then the sequence number 
 # cannot be 0.   We will set it to 1.
 
+ALTER TABLE %DB_TBL_PREFIX%entry ADD COLUMN saved_ts DATETIME;
+UPDATE %DB_TBL_PREFIX%entry SET saved_ts=timestamp;
 UPDATE %DB_TBL_PREFIX%entry 
-SET ical_sequence=1 WHERE ical_sequence=0 AND entry_type=2;
+  SET ical_sequence=1 WHERE ical_sequence=0 AND entry_type=2;
+UPDATE %DB_TBL_PREFIX%entry SET timestamp=saved_ts;
+ALTER TABLE %DB_TBL_PREFIX%entry DROP COLUMN saved_ts;
Index: mrbs/trunk/web/upgrade/25/pgsql.sql
===================================================================
--- mrbs/trunk/web/upgrade/25/pgsql.sql (revision 2368)
+++ mrbs/trunk/web/upgrade/25/pgsql.sql (revision 2369)
@@ -4,5 +4,9 @@
 -- series that has been modified, ie has entry_type=2, then the sequence 
number 
 -- cannot be 0.   We will set it to 1.
 
+ALTER TABLE %DB_TBL_PREFIX%entry ADD COLUMN saved_ts DATETIME;
+UPDATE %DB_TBL_PREFIX%entry SET saved_ts=timestamp;
 UPDATE %DB_TBL_PREFIX%entry 
-SET ical_sequence=1 WHERE ical_sequence=0 AND entry_type=2;
+  SET ical_sequence=1 WHERE ical_sequence=0 AND entry_type=2;
+UPDATE %DB_TBL_PREFIX%entry SET timestamp=saved_ts;
+ALTER TABLE %DB_TBL_PREFIX%entry DROP COLUMN saved_ts;
Index: mrbs/trunk/web/upgrade/17/post.inc
===================================================================
--- mrbs/trunk/web/upgrade/17/post.inc  (revision 2368)
+++ mrbs/trunk/web/upgrade/17/post.inc  (revision 2369)
@@ -31,6 +31,23 @@
   fatal_error(1, get_vocab("failed_to_acquire"));
 }
 
+$sql = "ALTER TABLE $tbl_entry ADD COLUMN saved_ts DATETIME";
+$res = sql_command($sql);
+if ($res == -1)
+{
+  trigger_error(sql_error(), E_USER_WARNING);
+  // No need to localise, should never happen
+  print "<span class=\"error\">Failed to add saved_ts column in entry table.</
+}
+$sql = "UPDATE $tbl_entry SET saved_ts=timestamp"l
+$res = sql_command($sql);
+if ($res == -1)
+{
+  trigger_error(sql_error(), E_USER_WARNING);
+  // No need to localise, should never happen
+  print "<span class=\"error\">Failed to set saved_ts column in entry table.</
+}
+
 $sql = "UPDATE $tbl_entry SET status=(((~status)&1)<<1)|(private&1)";
 $res = sql_command($sql);
 if ($res == -1)
@@ -40,6 +57,23 @@
   print "<span class=\"error\">Failed to update status column in entry 
table.</span>";
 }
 
+$sql = "UPDATE $tbl_entry SET timestamp=saved_ts";
+$res = sql_command($sql);
+if ($res == -1)
+{
+  trigger_error(sql_error(), E_USER_WARNING);
+  // No need to localise, should never happen
+  print "<span class=\"error\">Failed to update timestamp column in entry 
table.</span>";
+}
+$sql = "ALTER TABLE $tbl_entry DROP COLUMN saved_ts";
+$res = sql_command($sql);
+if ($res == -1)
+{
+  trigger_error(sql_error(), E_USER_WARNING);
+  // No need to localise, should never happen
+  print "<span class=\"error\">Failed to delete saved_ts column in entry 
table.</span>";
+}
+
 sql_mutex_unlock("$tbl_entry");
 
 
@@ -56,6 +90,23 @@
   fatal_error(1, get_vocab("failed_to_acquire"));
 }
 
+$sql = "ALTER TABLE $tbl_repeat ADD COLUMN saved_ts DATETIME";
+$res = sql_command($sql);
+if ($res == -1)
+{
+  trigger_error(sql_error(), E_USER_WARNING);
+  // No need to localise, should never happen
+  print "<span class=\"error\">Failed to add saved_ts column in repeat table.</
+}
+$sql = "UPDATE $tbl_repeat SET saved_ts=timestamp"l
+$res = sql_command($sql);
+if ($res == -1)
+{
+  trigger_error(sql_error(), E_USER_WARNING);
+  // No need to localise, should never happen
+  print "<span class=\"error\">Failed to set saved_ts column in repeat table.</
+}
+
 $sql = "UPDATE $tbl_repeat SET status=private&1";
 $res = sql_command($sql);
 
@@ -98,6 +149,23 @@
   }
 }  
 
+$sql = "UPDATE $tbl_repeat SET timestamp=saved_ts";
+$res = sql_command($sql);
+if ($res == -1)
+{
+  trigger_error(sql_error(), E_USER_WARNING);
+  // No need to localise, should never happen
+  print "<span class=\"error\">Failed to update timestamp column in repeat 
table.</span>";
+}
+$sql = "ALTER TABLE $tbl_repeat DROP COLUMN saved_ts";
+$res = sql_command($sql);
+if ($res == -1)
+{
+  trigger_error(sql_error(), E_USER_WARNING);
+  // No need to localise, should never happen
+  print "<span class=\"error\">Failed to delete saved_ts column in repeat 
table.</span>";
+}
+
 sql_mutex_unlock("$tbl_repeat");
 
 ?>
\ No newline at end of file

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to