Skip to content

Commit

Permalink
fixed db mutation 110 (converting adoption history)
Browse files Browse the repository at this point in the history
fix old cache-publishing syslog entries
  • Loading branch information
following5 committed Jun 12, 2013
1 parent 5242a97 commit bd75d91
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions bin/dbsv-update.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,22 @@ function dbv_110() // move adoption history to separate table
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')",
Expand All @@ -223,4 +229,10 @@ function dbv_110() // move adoption history to separate table
}
}

function dbv_111() // fix event ID of old publishing notifications
{
sql("UPDATE `logentries` SET `eventid`=8
WHERE `eventid`=5 AND `module`='notify_newcache'");
}

?>

0 comments on commit bd75d91

Please sign in to comment.