Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3485117
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3485117
Commits
3771dec3
Commit
3771dec3
authored
14 years ago
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
#685486
by scor: Fixed filter_update_7003() doesn't work for contrib modules.
parent
706d87c3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/filter/filter.install
+27
-50
27 additions, 50 deletions
modules/filter/filter.install
with
27 additions
and
50 deletions
modules/filter/filter.install
+
27
−
50
View file @
3771dec3
...
...
@@ -220,6 +220,13 @@ function filter_update_7002() {
* Remove hardcoded numeric deltas from all filters in core.
*/
function
filter_update_7003
()
{
// Duplicates the filter table since core cannot take care of the potential
// contributed module filters.
db_rename_table
(
'filter'
,
'd6_upgrade_filter'
);
// Creates the Drupal 7 filter table.
$schema
=
filter_schema
();
db_create_table
(
'filter'
,
$schema
[
'filter'
]);
// Get an array of the renamed filter deltas, organized by module.
$renamed_deltas
=
array
(
'filter'
=>
array
(
...
...
@@ -234,33 +241,28 @@ function filter_update_7003() {
),
);
// The unique key on (filter, module, delta) is not necessary anymore,
// as filter_update_7004() will add a primary key on (filter, name).
db_drop_unique_key
(
'filter'
,
'fmd'
);
// Rename field 'delta' to 'name'.
db_change_field
(
'filter'
,
'delta'
,
'name'
,
array
(
'type'
=>
'varchar'
,
'length'
=>
32
,
'not null'
=>
TRUE
,
'default'
=>
''
,
'description'
=>
'Name of the filter being referenced.'
,
),
array
(
'indexes'
=>
array
(
'list'
=>
array
(
'weight'
,
'module'
,
'name'
),
),
)
);
// Loop through each filter and make changes to the core filter table.
// Loop through each filter and make changes to the core filter table by
// each record from the old to the new table.
foreach
(
$renamed_deltas
as
$module
=>
$deltas
)
{
foreach
(
$deltas
as
$old_delta
=>
$new_delta
)
{
db_update
(
'filter'
)
->
fields
(
array
(
'name'
=>
$new_delta
))
foreach
(
$deltas
as
$old_delta
=>
$new_name
)
{
$query
=
db_select
(
'd6_upgrade_filter'
);
$query
->
fields
(
'd6_upgrade_filter'
,
array
(
'format'
,
'weight'
));
$query
->
condition
(
'module'
,
$module
);
$query
->
condition
(
'delta'
,
$old_delta
);
$result
=
$query
->
execute
();
foreach
(
$result
as
$record
)
{
db_insert
(
'filter'
)
->
fields
(
array
(
'format'
=>
$record
->
format
,
'module'
=>
$module
,
'name'
=>
$new_name
,
'weight'
=>
$record
->
weight
,
))
->
execute
();
}
db_delete
(
'd6_upgrade_filter'
)
->
condition
(
'module'
,
$module
)
->
condition
(
'
name
'
,
$old_delta
)
->
condition
(
'
delta
'
,
$old_delta
)
->
execute
();
}
}
...
...
@@ -268,33 +270,8 @@ function filter_update_7003() {
/**
* Move filter settings storage into {filter} table.
*
* - Remove {filter}.fid.
* - Add (format, name) as primary key for {filter}.
* - Add {filter}.status.
* - Add {filter}.settings.
*/
function
filter_update_7004
()
{
db_drop_field
(
'filter'
,
'fid'
);
db_add_primary_key
(
'filter'
,
array
(
'format'
,
'name'
));
db_add_field
(
'filter'
,
'status'
,
array
(
'type'
=>
'int'
,
'not null'
=>
TRUE
,
'default'
=>
0
,
'description'
=>
'Filter enabled status. (1 = enabled, 0 = disabled)'
,
)
);
db_add_field
(
'filter'
,
'settings'
,
array
(
'type'
=>
'text'
,
'not null'
=>
FALSE
,
'size'
=>
'big'
,
'serialize'
=>
TRUE
,
'description'
=>
'A serialized array of name value pairs that store the filter settings for the specific format.'
,
)
);
// Enable all existing filters ({filter} contained only enabled previously).
db_update
(
'filter'
)
->
fields
(
array
(
'status'
=>
'1'
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment