From bd75d91c98fa5e4d04803b873db7b7ea072363ea Mon Sep 17 00:00:00 2001 From: following Date: Wed, 12 Jun 2013 17:58:32 +0200 Subject: [PATCH] fixed db mutation 110 (converting adoption history) fix old cache-publishing syslog entries --- bin/dbsv-update.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/bin/dbsv-update.php b/bin/dbsv-update.php index e33a62fc..f33c0003 100644 --- a/bin/dbsv-update.php +++ b/bin/dbsv-update.php @@ -202,16 +202,22 @@ KEY `cache_id` (`cache_id`,`date`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1"); + // Up to commit d15ee5f9, new cache notification logs were erronously stored with + // event ID 5 (instead of 8). Therefore we need to check for the module, too: $rs = sql("SELECT `id`, `date_created`, `objectid1`, `logtext` FROM `logentries` - WHERE `eventid`=5 + WHERE `eventid`=5 AND `module`='cache' ORDER BY `date_created`, `id`"); while ($rLog = sql_fetch_assoc($rs)) { preg_match('/Cache (\d+) has changed the owner from userid (\d+) to (\d+) by (\d+)/', $rLog['logtext'], $matches); if (count($matches) != 5) - die("unknown adoption log entry format for ID " . $rLog['id'] . "\n"); + { + sql_free_result($rs); + sql("DROP TABLE `cache_adoptions`"); + die("\nunknown adoption log entry format for ID " . $rLog['id'] . "\n"); + } sql("INSERT INTO `cache_adoptions` (`cache_id`,`date`,`from_user_id`,`to_user_id`) VALUES ('&1','&2','&3','&4')", @@ -223,4 +229,10 @@ } } + function dbv_111() // fix event ID of old publishing notifications + { + sql("UPDATE `logentries` SET `eventid`=8 + WHERE `eventid`=5 AND `module`='notify_newcache'"); + } + ?> \ No newline at end of file