From 013774ba79c5589f0a1abf653518f5b3aeffa081 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 21 Mar 2008 08:52:25 +0000 Subject: - Patch #235821 by kbahey and pwolanin: include upgrade path for cron changes, improved security of key. --- modules/system/system.install | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'modules/system/system.install') diff --git a/modules/system/system.install b/modules/system/system.install index c1854b20f..fc78a4db2 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -408,9 +408,9 @@ function system_install() { db_query("INSERT INTO {variable} (name, value) VALUES ('%s', '%s')", 'node_options_forum', 'a:1:{i:0;s:6:"status";}'); - $cron_key = md5(time()); + $cron_key = serialize(md5(mt_rand())); - db_query("INSERT INTO {variable} (name, value) VALUES ('%s', '%s')", 'cron_key', serialize($cron_key)); + db_query("INSERT INTO {variable} (name, value) VALUES ('%s', '%s')", 'cron_key', $cron_key); } /** @@ -2658,6 +2658,17 @@ function system_update_7000() { return $ret; } +/** + * Generate a cron key and save it in the variables table + */ +function system_update_7001() { + $ret = array(); + variable_set('cron_key', md5(mt_rand())); + $ret[] = array('success' => TRUE, 'query' => "variable_set('cron_key')"); + return $ret; +} + + /** * @} End of "defgroup updates-6.x-to-7.x" * The next series of updates should start at 8000. -- cgit v1.2.3