diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-06-25 17:47:22 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-06-25 17:47:22 +0000 |
commit | 7e52847ae90984d482ad7af3372a46c0d1435014 (patch) | |
tree | 29f248d79721fb0509a984348a13cddf92b1703b | |
parent | f56b384be0b3e7b56096f3036a3c9d7b731d2862 (diff) | |
download | brdo-7e52847ae90984d482ad7af3372a46c0d1435014.tar.gz brdo-7e52847ae90984d482ad7af3372a46c0d1435014.tar.bz2 |
- Patch #690746 by jbrown, Ognyan Kulev, Crell, MichaelCole, Damien Tournoud: text column type doesn't reliably hold serialized variables.
-rw-r--r-- | includes/update.inc | 2 | ||||
-rw-r--r-- | modules/block/block.install | 20 | ||||
-rw-r--r-- | modules/dblog/dblog.install | 15 | ||||
-rw-r--r-- | modules/field/field.install | 8 | ||||
-rw-r--r-- | modules/filter/filter.install | 20 | ||||
-rw-r--r-- | modules/image/image.install | 5 | ||||
-rw-r--r-- | modules/rdf/rdf.install | 2 | ||||
-rw-r--r-- | modules/simpletest/tests/database_test.install | 2 | ||||
-rw-r--r-- | modules/system/system.install | 111 | ||||
-rw-r--r-- | modules/update/update.install | 20 | ||||
-rw-r--r-- | modules/user/user.install | 17 |
11 files changed, 192 insertions, 30 deletions
diff --git a/includes/update.inc b/includes/update.inc index 4458ccce4..2e29240a2 100644 --- a/includes/update.inc +++ b/includes/update.inc @@ -512,7 +512,7 @@ function update_fix_d7_requirements() { 'description' => 'The queue name.', ), 'data' => array( - 'type' => 'text', + 'type' => 'blob', 'not null' => FALSE, 'size' => 'big', 'serialize' => TRUE, diff --git a/modules/block/block.install b/modules/block/block.install index 8f6863a90..0c0b324c4 100644 --- a/modules/block/block.install +++ b/modules/block/block.install @@ -189,6 +189,11 @@ function block_install() { } /** + * @defgroup updates-6.x-to-7.x Block updates from 6.x to 7.x + * @{ + */ + +/** * Set system.weight to a low value for block module. * * Block should go first so that other modules can alter its output @@ -389,8 +394,19 @@ function block_update_7004() { } /** - * Remove {cache_block}.headers column. + * Recreates cache_block table. + * + * Converts fields that hold serialized variables from text to blob. + * Removes 'headers' column. */ function block_update_7005() { - db_drop_field('cache_block', 'headers'); + $schema = system_schema_cache_7054(); + + db_drop_table('cache_block'); + db_create_table('cache_block', $schema); } + +/** + * @} End of "defgroup updates-6.x-to-7.x" + * The next series of updates should start at 8000. + */ diff --git a/modules/dblog/dblog.install b/modules/dblog/dblog.install index e5390396e..7949c97fa 100644 --- a/modules/dblog/dblog.install +++ b/modules/dblog/dblog.install @@ -38,7 +38,7 @@ function dblog_schema() { 'description' => 'Text of log message to be passed into the t() function.', ), 'variables' => array( - 'type' => 'text', + 'type' => 'blob', 'not null' => TRUE, 'size' => 'big', 'description' => 'Serialized array of variables that match the message string and that is passed into the t() function.', @@ -119,6 +119,19 @@ function dblog_update_7003() { } /** + * Converts fields that store serialized variables from text to blob. + */ +function dblog_update_7004() { + $spec = array( + 'type' => 'blob', + 'not null' => TRUE, + 'size' => 'big', + 'description' => 'Serialized array of variables that match the message string and that is passed into the t() function.', + ); + db_change_field('watchdog', 'variables', 'variables', $spec); +} + +/** * @} End of "defgroup updates-6.x-to-7.x" * The next series of updates should start at 8000. */ diff --git a/modules/field/field.install b/modules/field/field.install index 3d23d2b6a..8a0c5ba4e 100644 --- a/modules/field/field.install +++ b/modules/field/field.install @@ -72,8 +72,8 @@ function field_schema() { 'description' => '@TODO', ), 'data' => array( - 'type' => 'text', - 'size' => 'medium', + 'type' => 'blob', + 'size' => 'big', 'not null' => TRUE, 'serialize' => TRUE, 'description' => 'Serialized data containing the field properties that do not warrant a dedicated column.', @@ -143,8 +143,8 @@ function field_schema() { 'default' => '' ), 'data' => array( - 'type' => 'text', - 'size' => 'medium', + 'type' => 'blob', + 'size' => 'big', 'not null' => TRUE, 'serialize' => TRUE, ), diff --git a/modules/filter/filter.install b/modules/filter/filter.install index ab3c3bdee..0fb14a469 100644 --- a/modules/filter/filter.install +++ b/modules/filter/filter.install @@ -46,7 +46,7 @@ function filter_schema() { 'description' => 'Filter enabled status. (1 = enabled, 0 = disabled)', ), 'settings' => array( - 'type' => 'text', + 'type' => 'blob', 'not null' => FALSE, 'size' => 'big', 'serialize' => TRUE, @@ -423,6 +423,24 @@ function filter_update_7008() { } /** + * Converts fields that store serialized variables from text to blob. + */ +function filter_update_7009() { + $spec = array( + 'type' => 'blob', + 'not null' => FALSE, + 'size' => 'big', + 'serialize' => TRUE, + 'description' => 'A serialized array of name value pairs that store the filter settings for the specific format.', + ); + db_change_field('filter', 'settings', 'settings', $spec); + + $schema = system_schema_cache_7054(); + db_drop_table('cache_filter'); + db_create_table('cache_filter', $schema); +} + +/** * @} End of "defgroup updates-6.x-to-7.x" * The next series of updates should start at 8000. */ diff --git a/modules/image/image.install b/modules/image/image.install index a1d92fff2..0fb19c6e3 100644 --- a/modules/image/image.install +++ b/modules/image/image.install @@ -86,7 +86,7 @@ function image_schema() { ), 'data' => array( 'description' => 'The configuration data for the effect.', - 'type' => 'text', + 'type' => 'blob', 'not null' => TRUE, 'size' => 'big', 'serialize' => TRUE, @@ -168,7 +168,7 @@ function image_update_7000() { ), 'data' => array( 'description' => 'The configuration data for the effect.', - 'type' => 'text', + 'type' => 'blob', 'not null' => TRUE, 'size' => 'big', 'serialize' => TRUE, @@ -183,6 +183,7 @@ function image_update_7000() { 'isid' => array('image_styles' => 'isid'), ), ); + db_create_table('cache_image', $schema['cache_image']); db_create_table('image_styles', $schema['image_styles']); db_create_table('image_effect', $schema['image_effects']); diff --git a/modules/rdf/rdf.install b/modules/rdf/rdf.install index 905c24771..d58105602 100644 --- a/modules/rdf/rdf.install +++ b/modules/rdf/rdf.install @@ -27,7 +27,7 @@ function rdf_schema() { ), 'mapping' => array( 'description' => 'The serialized mapping of the bundle type and fields to RDF terms.', - 'type' => 'text', + 'type' => 'blob', 'not null' => FALSE, 'size' => 'big', 'serialize' => TRUE, diff --git a/modules/simpletest/tests/database_test.install b/modules/simpletest/tests/database_test.install index 98a0c8403..cd0f7a96d 100644 --- a/modules/simpletest/tests/database_test.install +++ b/modules/simpletest/tests/database_test.install @@ -220,7 +220,7 @@ function database_test_schema() { ), 'info' => array( 'description' => "The person's data in serialized form.", - 'type' => 'text', + 'type' => 'blob', 'serialize' => TRUE, ), ), diff --git a/modules/system/system.install b/modules/system/system.install index ec7e14681..95339e112 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -511,7 +511,7 @@ function system_schema() { ), 'value' => array( 'description' => 'The value of the variable.', - 'type' => 'text', + 'type' => 'blob', 'not null' => TRUE, 'size' => 'big', 'translatable' => TRUE, @@ -546,7 +546,7 @@ function system_schema() { ), 'parameters' => array( 'description' => 'Parameters to be passed to the callback function.', - 'type' => 'text', + 'type' => 'blob', 'not null' => TRUE, 'size' => 'big', ), @@ -585,7 +585,7 @@ function system_schema() { ), 'batch' => array( 'description' => 'A serialized array containing the processing data for the batch.', - 'type' => 'text', + 'type' => 'blob', 'not null' => FALSE, 'size' => 'big', ), @@ -913,12 +913,12 @@ function system_schema() { ), 'load_functions' => array( 'description' => 'A serialized array of function names (like node_load) to be called to load an object corresponding to a part of the current path.', - 'type' => 'text', + 'type' => 'blob', 'not null' => TRUE, ), 'to_arg_functions' => array( 'description' => 'A serialized array of function names (like user_uid_optional_to_arg) to be called to replace a part of the router path with another string.', - 'type' => 'text', + 'type' => 'blob', 'not null' => TRUE, ), 'access_callback' => array( @@ -930,7 +930,7 @@ function system_schema() { ), 'access_arguments' => array( 'description' => 'A serialized array of arguments for the access callback.', - 'type' => 'text', + 'type' => 'blob', 'not null' => FALSE, ), 'page_callback' => array( @@ -942,7 +942,7 @@ function system_schema() { ), 'page_arguments' => array( 'description' => 'A serialized array of arguments for the page callback.', - 'type' => 'text', + 'type' => 'blob', 'not null' => FALSE, ), 'delivery_callback' => array( @@ -1112,7 +1112,7 @@ function system_schema() { ), 'options' => array( 'description' => 'A serialized array of options to be passed to the url() or l() function, such as a query string or HTML attributes.', - 'type' => 'text', + 'type' => 'blob', 'not null' => FALSE, 'translatable' => TRUE, ), @@ -1268,7 +1268,7 @@ function system_schema() { 'description' => 'The queue name.', ), 'data' => array( - 'type' => 'text', + 'type' => 'blob', 'not null' => FALSE, 'size' => 'big', 'serialize' => TRUE, @@ -1447,7 +1447,7 @@ function system_schema() { ), 'session' => array( 'description' => 'The serialized contents of $_SESSION, an array of name/value pairs that persists across page requests by this session ID. Drupal loads $_SESSION from here at the start of each request and saves it at the end.', - 'type' => 'text', + 'type' => 'blob', 'not null' => FALSE, 'size' => 'big', ), @@ -1524,7 +1524,7 @@ function system_schema() { ), 'info' => array( 'description' => "A serialized array containing information from the module's .info file; keys can include name, description, package, version, core, dependencies, dependents, and php.", - 'type' => 'text', + 'type' => 'blob', 'not null' => FALSE, ), ), @@ -2454,13 +2454,96 @@ function system_update_7054() { // Update: update_fix_d7_requirements() installs this version for cache_path // already, so we don't include it in this particular update. It should be // included in later updates though. - $cache_tables = array('cache', 'cache_filter', 'cache_form', 'cache_menu', 'cache_page'); - foreach ($cache_tables as $table) { - db_drop_field($table, 'headers'); + $cache_tables = array('cache', 'cache_form', 'cache_menu', 'cache_page'); + $schema = system_schema_cache_7054(); + foreach ($cache_tables as $table => $description) { + db_drop_table($table); + db_create_table($table, $schema); } } /** + * Converts fields that store serialized variables from text to blob. + */ +function system_update_7055() { + $spec = array( + 'description' => 'The value of the variable.', + 'type' => 'blob', + 'not null' => TRUE, + 'size' => 'big', + 'translatable' => TRUE, + ); + db_change_field('variable', 'value', 'value', $spec); + + $spec = array( + 'description' => 'Parameters to be passed to the callback function.', + 'type' => 'blob', + 'not null' => TRUE, + 'size' => 'big', + ); + db_change_field('actions', 'parameters', 'parameters', $spec); + + $spec = array( + 'description' => 'A serialized array containing the processing data for the batch.', + 'type' => 'blob', + 'not null' => FALSE, + 'size' => 'big', + ); + db_change_field('batch', 'batch', 'batch', $spec); + + $spec = array( + 'description' => 'A serialized array of function names (like node_load) to be called to load an object corresponding to a part of the current path.', + 'type' => 'blob', + 'not null' => TRUE, + ); + db_change_field('menu_router', 'load_functions', 'load_functions', $spec); + + $spec = array( + 'description' => 'A serialized array of function names (like user_uid_optional_to_arg) to be called to replace a part of the router path with another string.', + 'type' => 'blob', + 'not null' => TRUE, + ); + db_change_field('menu_router', 'to_arg_functions', 'to_arg_functions', $spec); + + $spec = array( + 'description' => 'A serialized array of arguments for the access callback.', + 'type' => 'blob', + 'not null' => FALSE, + ); + db_change_field('menu_router', 'access_arguments', 'access_arguments', $spec); + + $spec = array( + 'description' => 'A serialized array of arguments for the page callback.', + 'type' => 'blob', + 'not null' => FALSE, + ); + db_change_field('menu_router', 'page_arguments', 'page_arguments', $spec); + + $spec = array( + 'description' => 'A serialized array of options to be passed to the url() or l() function, such as a query string or HTML attributes.', + 'type' => 'blob', + 'not null' => FALSE, + 'translatable' => TRUE, + ); + db_change_field('menu_links', 'options', 'options', $spec); + + $spec = array( + 'description' => 'The serialized contents of $_SESSION, an array of name/value pairs that persists across page requests by this session ID. Drupal loads $_SESSION from here at the start of each request and saves it at the end.', + 'type' => 'blob', + 'not null' => FALSE, + 'size' => 'big', + ); + db_change_field('sessions', 'session', 'session', $spec); + + $spec = array( + 'description' => "A serialized array containing information from the module's .info file; keys can include name, description, package, version, core, dependencies, dependents, and php.", + 'type' => 'blob', + 'not null' => FALSE, + ); + db_change_field('system', 'info', 'info', $spec); +} + +/** * @} End of "defgroup updates-6.x-to-7.x" * The next series of updates should start at 8000. */ diff --git a/modules/update/update.install b/modules/update/update.install index 5bc855847..417f8eeca 100644 --- a/modules/update/update.install +++ b/modules/update/update.install @@ -160,6 +160,11 @@ function _update_requirement_check($project, $type) { } /** + * @defgroup updates-6.x-to-7.x Filter updates from 6.x to 7.x + * @{ + */ + +/** * Create a queue to store tasks for requests to fetch available update data. */ function update_update_7000() { @@ -169,8 +174,19 @@ function update_update_7000() { } /** - * Remove {cache_update}.headers column. + * Recreates cache_update table. + * + * Converts fields that hold serialized variables from text to blob. + * Removes 'headers' column. */ function update_update_7001() { - db_drop_field('cache_update', 'headers'); + $schema = system_schema_cache_7054(); + + db_drop_table('cache_update'); + db_create_table('cache_update', $schema); } + +/** + * @} End of "defgroup updates-6.x-to-7.x" + * The next series of updates should start at 8000. + */ diff --git a/modules/user/user.install b/modules/user/user.install index 0bff646bb..2a2b6da6f 100644 --- a/modules/user/user.install +++ b/modules/user/user.install @@ -219,7 +219,7 @@ function user_schema() { 'description' => 'E-mail address used for initial account creation.', ), 'data' => array( - 'type' => 'text', + 'type' => 'blob', 'not null' => FALSE, 'size' => 'big', 'serialize' => TRUE, @@ -624,6 +624,21 @@ function user_update_7008() { variable_set('user_register', USER_REGISTER_VISITORS); } } + +/** + * Converts fields that store serialized variables from text to blob. + */ +function user_update_7009() { + $spec = array( + 'type' => 'blob', + 'not null' => FALSE, + 'size' => 'big', + 'serialize' => TRUE, + 'description' => 'A serialized array of name value pairs that are related to the user. Any form values posted during user edit are stored and are loaded into the $user object during user_load(). Use of this field is discouraged and it will likely disappear in a future version of Drupal.', + ); + db_change_field('users', 'data', 'data', $spec); +} + /** * @} End of "defgroup user-updates-6.x-to-7.x" * The next series of updates should start at 8000. |