updated webform localization and phone, uuid, term_merge, spambot, performance
This commit is contained in:
@@ -31,12 +31,26 @@ function uuid_schema_field_definition() {
|
||||
/**
|
||||
* Implements hook_schema_alter().
|
||||
*/
|
||||
function uuid_schema_alter(&$schema = array()) {
|
||||
$field = uuid_schema_field_definition();
|
||||
foreach (uuid_get_core_entity_info() as $entity_type => $info) {
|
||||
$schema[$info['base table']]['fields'][$info['entity keys']['uuid']] = $field;
|
||||
if (!empty($info['revision table']) && !empty($info['entity keys']['revision uuid'])) {
|
||||
$schema[$info['revision table']]['fields'][$info['entity keys']['revision uuid']] = $field;
|
||||
function uuid_schema_alter(array &$schema) {
|
||||
$field_info = uuid_schema_field_definition();
|
||||
$key_names = array(
|
||||
'base table' => 'uuid',
|
||||
'revision table' => 'revision uuid',
|
||||
);
|
||||
|
||||
foreach (uuid_get_core_entity_info() as $entity_info) {
|
||||
foreach ($key_names as $table_type => $key_name) {
|
||||
if (isset($entity_info[$table_type], $entity_info['entity keys'][$key_name])) {
|
||||
$field_name = $entity_info['entity keys'][$key_name];
|
||||
$properties = array(
|
||||
'fields' => $field_info,
|
||||
'indexes' => array($field_name),
|
||||
);
|
||||
|
||||
foreach ($properties as $property => $value) {
|
||||
$schema[$entity_info[$table_type]][$property][$field_name] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,19 +60,20 @@ function uuid_schema_alter(&$schema = array()) {
|
||||
*/
|
||||
function uuid_install() {
|
||||
_uuid_install_uuid_fields();
|
||||
module_load_include('inc', 'uuid');
|
||||
uuid_sync_all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Install the 'uuid' and 'vuuid' fields into Drupal core entity tables where needed.
|
||||
* Install the uuid and vuuid fields for Drupal core entity tables where needed.
|
||||
*
|
||||
* IMPORTANT: This function is called both at install and update time. If this method
|
||||
* is modified to add additional fields in the future, the update strategy must be
|
||||
* considered. See the comment in uuid_update_7102.
|
||||
* IMPORTANT: This function is called both at install and update time. If this
|
||||
* method is modified to add additional fields in the future, the update
|
||||
* strategy must be considered. See the comment in uuid_update_7102.
|
||||
*/
|
||||
function _uuid_install_uuid_fields() {
|
||||
$field = uuid_schema_field_definition();
|
||||
foreach (uuid_get_core_entity_info() as $entity_type => $info) {
|
||||
foreach (uuid_get_core_entity_info() as $info) {
|
||||
if (!db_field_exists($info['base table'], $info['entity keys']['uuid'])) {
|
||||
db_add_field($info['base table'], $info['entity keys']['uuid'], $field);
|
||||
db_add_index($info['base table'], $info['entity keys']['uuid'], array($info['entity keys']['uuid']));
|
||||
@@ -76,7 +91,7 @@ function _uuid_install_uuid_fields() {
|
||||
* Implements hook_uninstall().
|
||||
*/
|
||||
function uuid_uninstall() {
|
||||
foreach (uuid_get_core_entity_info() as $entity_type => $info) {
|
||||
foreach (uuid_get_core_entity_info() as $info) {
|
||||
if (db_field_exists($info['base table'], $info['entity keys']['uuid'])) {
|
||||
db_drop_field($info['base table'], $info['entity keys']['uuid']);
|
||||
db_drop_index($info['base table'], $info['entity keys']['uuid']);
|
||||
@@ -112,8 +127,7 @@ function uuid_update_6001() {
|
||||
}
|
||||
|
||||
/**
|
||||
* For each of out tables, drop the indexe on the UUID column and add a unique
|
||||
* key on that column.
|
||||
* Make all uuid columns unique keys instead of indexes.
|
||||
*/
|
||||
function uuid_update_6002() {
|
||||
$ret = array();
|
||||
@@ -138,8 +152,7 @@ function uuid_update_6003() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix the column definitions for uuid columns in all tables
|
||||
* to use the more efficient char spec.
|
||||
* Change column definitions for uuid columns to more efficient char spec.
|
||||
*/
|
||||
function uuid_update_6004() {
|
||||
$ret = array();
|
||||
@@ -158,6 +171,8 @@ function uuid_update_6004() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Support deleting node revision.
|
||||
*
|
||||
* Modify existing uuid_node_revisions table to support revision deletion, and
|
||||
* add in as much legacy data as possible.
|
||||
*/
|
||||
@@ -204,15 +219,17 @@ function uuid_update_7100() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear cache for installations that used alpha1. Modules that previously was
|
||||
* enabled in uuid_update_7100() doesn't exist anymore.
|
||||
* Clear cache for installations that used alpha1.
|
||||
*
|
||||
* Modules previously enabled in uuid_update_7100() don't exist any more. We
|
||||
* need to clear the cache so Drupal detects this change.
|
||||
*/
|
||||
function uuid_update_7101() {
|
||||
drupal_flush_all_caches();
|
||||
}
|
||||
|
||||
/**
|
||||
* Insure that the uuid and vuuid fields are added where needed.
|
||||
* Ensure that the uuid and vuuid fields are added where needed.
|
||||
*
|
||||
* Note that update 7102 calls _uuid_install_uuid_fields(), which is an
|
||||
* idempotent function. If _uuid_install_uuid_fields() is changed at some
|
||||
@@ -220,8 +237,8 @@ function uuid_update_7101() {
|
||||
* will have run update 7102, and some will not. A new uuid_update_7103()
|
||||
* function would would therefore be necessary to update all users to
|
||||
* the latest schema. At the same time, uuid_update_7102() could become
|
||||
* an empty function, as it would not be necessary to call _uuid_install_uuid_fields()
|
||||
* twice.
|
||||
* an empty function, as it would not be necessary to call
|
||||
* _uuid_install_uuid_fields() twice.
|
||||
*/
|
||||
function uuid_update_7102() {
|
||||
// If the user have disabled the UUID module during upgrade (as UPGRADE.txt
|
||||
@@ -232,9 +249,11 @@ function uuid_update_7102() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up entities created by uuid_default_entities_example module.
|
||||
*
|
||||
* Modify the labels of all example entities created by the now removed
|
||||
* uuid_default_entities_example.module to make it clear they're examples.
|
||||
* Also remove the administrator role of any example user.
|
||||
* uuid_default_entities_example.module to make it clear they're examples. Also
|
||||
* remove the administrator role of any example user.
|
||||
*/
|
||||
function uuid_update_7103() {
|
||||
// These are UUIDs of all the example entities that might exist after having
|
||||
@@ -249,7 +268,7 @@ function uuid_update_7103() {
|
||||
'7cf875e6-dc15-4404-f190-5a7c3e91d14c',
|
||||
),
|
||||
);
|
||||
// we can't assume taxonomy is enabled
|
||||
// We can't assume taxonomy is enabled.
|
||||
if (isset($info['taxonomy_term'])) {
|
||||
$uuids['taxonomy_term'] = array(
|
||||
'bcb92ce8-2236-e264-65c8-0c163ae716d1',
|
||||
@@ -268,7 +287,7 @@ function uuid_update_7103() {
|
||||
if ($entity_type == 'user' && $rid = array_search('administrator', $entity->roles)) {
|
||||
unset($entity->roles[$rid]);
|
||||
}
|
||||
entity_save($entity);
|
||||
entity_save($entity_type, $entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user