updated webform localization and phone, uuid, term_merge, spambot, performance

This commit is contained in:
Bachir Soussi Chiadmi
2016-11-05 17:14:57 +01:00
parent fdefc824d8
commit 0521608bb7
57 changed files with 3592 additions and 1629 deletions

View File

@@ -1,67 +1,56 @@
<?php
/**
* Implementation of hook_schema().
* @file
* Install and update hooks for Spambot module.
*/
/**
* Implements hook_schema().
*/
function spambot_schema() {
$schema = array();
$schema['node_spambot'] = array(
'description' => t('Node table to track author IP addresses. For use by spambot only.'),
'description' => 'Node table to track author IP addresses. For use by spambot only.',
'fields' => array(
'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
'uid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
'hostname' => array( 'type' => 'varchar', 'length' => 128, 'not null' => FALSE),
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'uid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'hostname' => array(
'type' => 'varchar',
'length' => 128,
'not null' => FALSE,
),
),
'primary key' => array('nid'),
'indexes' => array(
'uid' => array('uid'),
),
);
return $schema;
}
/**
* Implementation of hook_uninstall().
* Implements hook_uninstall().
*/
function spambot_uninstall() {
db_query("DELETE FROM {variable} WHERE name LIKE 'spambot_%'");
db_delete('variable')
->condition('name', 'spambot_%', 'LIKE')
->execute();
}
/**
* Migrate settings from previous version of spambot (6.x-2.0)
* Update variables, create new table 'node_spambot'.
*/
function spambot_update_6300() {
$ret = array();
// In previous versions of spambot, the default message was 'Blacklisted. Now go away!'
// If no custom message was configured, then configure it to 'Blacklisted. Now go away!'
$message = variable_get('spambot_blocked_message', FALSE);
if (!$message) {
variable_set('spambot_blocked_message', t('Blacklisted. Now go away!'));
}
// Previous versions of spambot blacklisted on any of the three criteria
variable_set('spambot_criteria_email', TRUE);
variable_set('spambot_criteria_username', TRUE);
variable_set('spambot_criteria_ip', TRUE);
return $ret;
}
function spambot_update_6301() {
$ret = array();
// Change criteria settings from booleans to numbers
if (variable_set('spambot_criteria_email', TRUE)) {
variable_set('spambot_criteria_email', 1);
}
if (variable_set('spambot_criteria_username', FALSE)) {
variable_set('spambot_criteria_username', 1);
}
if (variable_set('spambot_criteria_ip', FALSE)) {
variable_set('spambot_criteria_ip', 1);
}
return $ret;
}
function spambot_update_7101() {
$messages = array();
@@ -77,24 +66,37 @@ function spambot_update_7101() {
$messages[] = t('Transferred user registration blocked message to new format.');
}
// Create new table node_spambot
// Create new table node_spambot.
if (!db_table_exists('node_spambot')) {
$schema = array();
$schema['node_spambot'] = array(
$node_spambot = array(
'description' => t('Node table to track author IP addresses. For use by spambot only.'),
'fields' => array(
'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
'uid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
'hostname' => array( 'type' => 'varchar', 'length' => 128, 'not null' => FALSE),
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'uid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'hostname' => array(
'type' => 'varchar',
'length' => 128,
'not null' => FALSE,
),
),
'primary key' => array('nid'),
'indexes' => array(
'uid' => array('uid'),
),
);
db_create_table('node_spambot', $schema['node_spambot']);
db_create_table('node_spambot', $node_spambot);
$messages[] = t('Created new table <em>node_spambot</em>.');
}
return join('<br />', $messages);
return implode('<br />', $messages);
}