updated modules
views friendly_register serial address_field i18n
This commit is contained in:
@@ -1,24 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Install, update and uninstall functions for the Serial module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_uninstall().
|
||||
*/
|
||||
function serial_uninstall() {
|
||||
/*
|
||||
* Schema tables are now dropped automatically. However, if any work needs
|
||||
* to be done before this, do it here.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_field_schema().
|
||||
*/
|
||||
function serial_field_schema($field) {
|
||||
$columns = array();
|
||||
|
||||
switch ($field['type']) {
|
||||
case 'serial':
|
||||
$columns['value'] = array(
|
||||
@@ -31,9 +22,8 @@ function serial_field_schema($field) {
|
||||
);
|
||||
break;
|
||||
}
|
||||
return array(
|
||||
'columns' => $columns
|
||||
);
|
||||
|
||||
return array('columns' => $columns);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,45 +32,40 @@ function serial_field_schema($field) {
|
||||
function serial_schema() {
|
||||
// Get the standard schema:
|
||||
module_load_include('inc', 'serial');
|
||||
$table_schema = _serial_get_table_schema();
|
||||
|
||||
// Build the schema by iteration over all the serial field instances:
|
||||
$table_schema = _serial_get_table_schema();
|
||||
$schema = array();
|
||||
$result = _serial_get_all_fields();
|
||||
foreach ($result as $field) {
|
||||
$table = _serial_get_table_name($field->bundle, $field->field_name);
|
||||
$schema[$table] = $table_schema;
|
||||
|
||||
foreach (_serial_get_all_fields() as $field) {
|
||||
$schema[_serial_get_table_name($field->bundle, $field->field_name)] = $table_schema;
|
||||
}
|
||||
|
||||
// Return the schema of all the assistant tables (one per serial field instance):
|
||||
// Return the schema of all the assistant tables (one per field instance).
|
||||
return $schema;
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgrade path.
|
||||
*
|
||||
* Switches from nids to uniqid.
|
||||
* Switches from nids to uniqids.
|
||||
*/
|
||||
function serial_update_7130() {
|
||||
// Get the new field schema.
|
||||
module_load_include('inc', 'serial');
|
||||
|
||||
$table_schema = _serial_get_table_schema();
|
||||
$uniqid_schema = $table_schema['fields']['uniqid'];
|
||||
|
||||
// Update the schema of old assistant tables.
|
||||
$result = _serial_get_all_fields();
|
||||
foreach ($result as $field) {
|
||||
foreach (_serial_get_all_fields() as $field) {
|
||||
// Empty the table.
|
||||
$table = _serial_get_table_name($field->bundle, $field->field_name);
|
||||
db_delete($table)->execute();
|
||||
|
||||
// Drop nid field and key
|
||||
// Drop nid field and key.
|
||||
db_drop_field($table, 'nid');
|
||||
db_drop_unique_key($table, 'nid');
|
||||
|
||||
// Add uniqid field and key
|
||||
db_add_field($table, 'uniqid', $uniqid_schema);
|
||||
// Add uniqid field and key.
|
||||
db_add_field($table, 'uniqid', $table_schema['fields']['uniqid']);
|
||||
db_add_unique_key($table, 'uniqid', array('uniqid'));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user