Use md5 hashes as request buffer keys

This commit is contained in:
Dmitriy Simushev 2013-02-04 16:03:06 +00:00
parent d4e51d3dfd
commit b96c9d0a2c
2 changed files with 6 additions and 2 deletions

View File

@ -59,7 +59,8 @@ $dbtables = array(
"${mysqlprefix}requestbuffer" => array(
"requestid" => "int NOT NULL auto_increment PRIMARY KEY",
"requestkey" => "varchar(128) NOT NULL",
// Use MD5 hashes as keys
"requestkey" => "char(32) NOT NULL",
"request" => "text NOT NULL"
),

View File

@ -60,7 +60,7 @@ abstract class ClientSideProcessor extends RequestProcessor {
$db = Database::getInstance();
$db->query(
"INSERT INTO {requestbuffer} (request, requestkey) VALUES (:request, :key)",
array(':request' => serialize($request), ':key' => $key)
array(':request' => serialize($request), ':key' => md5($key))
);
}
@ -72,6 +72,9 @@ abstract class ClientSideProcessor extends RequestProcessor {
*/
protected function getRequestsFromBuffer($key) {
$db = Database::getInstance();
$key = md5($key);
// Get requests from database
$requests = $db->query(
"SELECT request FROM {requestbuffer} WHERE requestkey = :key",