Commit dd2fdd12 authored by Dries's avatar Dries
Browse files

- Patch #40532 by wtanaka: use longblog for data in the cache. Is reported to...

- Patch #40532 by wtanaka: use longblog for data in the cache.  Is reported to fix utf-8 problems and improves consistency with PostgreSQL.
parent ccb3fa02
...@@ -166,7 +166,7 @@ CREATE TABLE boxes ( ...@@ -166,7 +166,7 @@ CREATE TABLE boxes (
CREATE TABLE cache ( CREATE TABLE cache (
cid varchar(255) NOT NULL default '', cid varchar(255) NOT NULL default '',
data longtext, data longblob,
expire int(11) NOT NULL default '0', expire int(11) NOT NULL default '0',
created int(11) NOT NULL default '0', created int(11) NOT NULL default '0',
headers text, headers text,
......
...@@ -1273,3 +1273,10 @@ function system_update_162() { ...@@ -1273,3 +1273,10 @@ function system_update_162() {
return $ret; return $ret;
} }
function system_update_163() {
$ret = array();
if ($GLOBALS['db_type'] == 'mysql') {
$ret[] = update_sql('ALTER TABLE {cache} CHANGE data data LONGBLOB');
}
return $ret;
}
...@@ -6,9 +6,6 @@ ...@@ -6,9 +6,6 @@
* Enables the use of personal contact forms. * Enables the use of personal contact forms.
*/ */
// Users are not allowed to send more than x mails/hour:
define('CONTACT_HOURLY_THRESHOLD', 3);
/** /**
* Implementation of hook_help(). * Implementation of hook_help().
*/ */
...@@ -74,6 +71,13 @@ function contact_settings() { ...@@ -74,6 +71,13 @@ function contact_settings() {
'#default_value' => variable_get('contact_form_information', t('You can leave us a message using the contact form below.')), '#default_value' => variable_get('contact_form_information', t('You can leave us a message using the contact form below.')),
'#description' => t('Information to show on the <a href="%form">contact page</a>. Can be anything from submission guidelines to your postal address or telephone number.', array('%form' => url('contact'))) '#description' => t('Information to show on the <a href="%form">contact page</a>. Can be anything from submission guidelines to your postal address or telephone number.', array('%form' => url('contact')))
); );
$form['contact_hourly_threshold'] = array(
'#type' => 'select',
'#title' => t('Hourly threshold'),
'#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50)),
'#default_value' => variable_get('contact_hourly_threshold', 3),
'#description' => t('The maximum number of contact form submissions a user can perform per hour.'),
);
return $form; return $form;
} }
...@@ -106,8 +110,8 @@ function contact_mail_user() { ...@@ -106,8 +110,8 @@ function contact_mail_user() {
else if (!valid_email_address($user->mail)) { else if (!valid_email_address($user->mail)) {
$output = t('You need to provide a valid e-mail address to contact other users. Please edit your <a href="%url">user information</a>.', array('%url' => url("user/$user->uid/edit"))); $output = t('You need to provide a valid e-mail address to contact other users. Please edit your <a href="%url">user information</a>.', array('%url' => url("user/$user->uid/edit")));
} }
else if (!flood_is_allowed('contact', CONTACT_HOURLY_THRESHOLD)) { else if (!flood_is_allowed('contact', variable_get('contact_hourly_threshold', 3))) {
$output = t("You can't contact more than %number users per hour. Please try again later.", array('%number' => CONTACT_HOURLY_THRESHOLD)); $output = t("You can't contact more than %number users per hour. Please try again later.", array('%number' => variable_get('contact_hourly_threshold', 3)));
} }
else { else {
drupal_set_title($account->name); drupal_set_title($account->name);
...@@ -242,8 +246,8 @@ function contact_admin() { ...@@ -242,8 +246,8 @@ function contact_admin() {
function contact_mail_page() { function contact_mail_page() {
global $user; global $user;
if (!flood_is_allowed('contact', CONTACT_HOURLY_THRESHOLD)) { if (!flood_is_allowed('contact', variable_get('contact_hourly_threshold', 3))) {
$output = t("You can't send more than %number messages per hour. Please try again later.", array('%number' => CONTACT_HOURLY_THRESHOLD)); $output = t("You can't send more than %number messages per hour. Please try again later.", array('%number' => variable_get('contact_hourly_threshold', 3)));
} }
else { else {
if ($user->uid) { if ($user->uid) {
......
...@@ -6,9 +6,6 @@ ...@@ -6,9 +6,6 @@
* Enables the use of personal contact forms. * Enables the use of personal contact forms.
*/ */
// Users are not allowed to send more than x mails/hour:
define('CONTACT_HOURLY_THRESHOLD', 3);
/** /**
* Implementation of hook_help(). * Implementation of hook_help().
*/ */
...@@ -74,6 +71,13 @@ function contact_settings() { ...@@ -74,6 +71,13 @@ function contact_settings() {
'#default_value' => variable_get('contact_form_information', t('You can leave us a message using the contact form below.')), '#default_value' => variable_get('contact_form_information', t('You can leave us a message using the contact form below.')),
'#description' => t('Information to show on the <a href="%form">contact page</a>. Can be anything from submission guidelines to your postal address or telephone number.', array('%form' => url('contact'))) '#description' => t('Information to show on the <a href="%form">contact page</a>. Can be anything from submission guidelines to your postal address or telephone number.', array('%form' => url('contact')))
); );
$form['contact_hourly_threshold'] = array(
'#type' => 'select',
'#title' => t('Hourly threshold'),
'#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50)),
'#default_value' => variable_get('contact_hourly_threshold', 3),
'#description' => t('The maximum number of contact form submissions a user can perform per hour.'),
);
return $form; return $form;
} }
...@@ -106,8 +110,8 @@ function contact_mail_user() { ...@@ -106,8 +110,8 @@ function contact_mail_user() {
else if (!valid_email_address($user->mail)) { else if (!valid_email_address($user->mail)) {
$output = t('You need to provide a valid e-mail address to contact other users. Please edit your <a href="%url">user information</a>.', array('%url' => url("user/$user->uid/edit"))); $output = t('You need to provide a valid e-mail address to contact other users. Please edit your <a href="%url">user information</a>.', array('%url' => url("user/$user->uid/edit")));
} }
else if (!flood_is_allowed('contact', CONTACT_HOURLY_THRESHOLD)) { else if (!flood_is_allowed('contact', variable_get('contact_hourly_threshold', 3))) {
$output = t("You can't contact more than %number users per hour. Please try again later.", array('%number' => CONTACT_HOURLY_THRESHOLD)); $output = t("You can't contact more than %number users per hour. Please try again later.", array('%number' => variable_get('contact_hourly_threshold', 3)));
} }
else { else {
drupal_set_title($account->name); drupal_set_title($account->name);
...@@ -242,8 +246,8 @@ function contact_admin() { ...@@ -242,8 +246,8 @@ function contact_admin() {
function contact_mail_page() { function contact_mail_page() {
global $user; global $user;
if (!flood_is_allowed('contact', CONTACT_HOURLY_THRESHOLD)) { if (!flood_is_allowed('contact', variable_get('contact_hourly_threshold', 3))) {
$output = t("You can't send more than %number messages per hour. Please try again later.", array('%number' => CONTACT_HOURLY_THRESHOLD)); $output = t("You can't send more than %number messages per hour. Please try again later.", array('%number' => variable_get('contact_hourly_threshold', 3)));
} }
else { else {
if ($user->uid) { if ($user->uid) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment