Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
290
Merge Requests
290
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
ff6804ed
Commit
ff6804ed
authored
Sep 28, 2012
by
Crell
Committed by
effulgentsia
Oct 01, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Chasing update hook numbers.
parent
bf586d4f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
62 deletions
+62
-62
core/modules/system/system.install
core/modules/system/system.install
+62
-62
No files found.
core/modules/system/system.install
View file @
ff6804ed
...
...
@@ -1971,10 +1971,71 @@ function system_update_8019() {
db_drop_table
(
'registry_file'
);
}
/**
* Conditionally enable the new Ban module.
*/
function
system_update_8020
()
{
$blocked_ips_exists
=
db_query_range
(
'SELECT 1 FROM {blocked_ips}'
,
0
,
1
)
->
fetchField
();
if
(
$blocked_ips_exists
)
{
// Rename the permission name.
db_update
(
'role_permission'
)
->
fields
(
array
(
'permission'
=>
'ban IP addresses'
,
'module'
=>
'ban'
,
))
->
condition
(
'permission'
,
'block IP addresses'
)
->
execute
();
// Rename {blocked_ips} table into {ban_ip}.
db_rename_table
(
'blocked_ips'
,
'ban_ip'
);
// Rename all references to the action callback.
db_update
(
'actions'
)
->
fields
(
array
(
'callback'
=>
'ban_ip_action'
))
->
condition
(
'callback'
,
'system_block_ip_action'
)
->
execute
();
// Rename the action's aid.
db_update
(
'actions'
)
->
fields
(
array
(
'aid'
=>
'ban_ip_action'
))
->
condition
(
'aid'
,
'system_block_ip_action'
)
->
execute
();
// Enable the new Ban module.
update_module_enable
(
array
(
'ban'
));
}
else
{
// Drop old table.
db_drop_table
(
'blocked_ips'
);
}
}
/**
* Enable the Actions module.
*/
function
system_update_8021
()
{
// Enable the module without re-installing the schema.
update_module_enable
(
array
(
'action'
));
// Rename former System module actions.
$map
=
array
(
'system_message_action'
=>
'action_message_action'
,
'system_send_email_action'
=>
'action_send_email_action'
,
'system_goto_action'
=>
'action_goto_action'
,
);
foreach
(
$map
as
$old
=>
$new
)
{
// Rename all references to the action callback.
db_update
(
'actions'
)
->
fields
(
array
(
'callback'
=>
$new
))
->
condition
(
'callback'
,
$old
)
->
execute
();
// Rename the action's aid.
db_update
(
'actions'
)
->
fields
(
array
(
'aid'
=>
$new
))
->
condition
(
'aid'
,
$old
)
->
execute
();
}
}
/*
* Create the new routing table.
*/
function
system_update_802
0
()
{
function
system_update_802
2
()
{
$tables
[
'router'
]
=
array
(
'description'
=>
'Maps paths to various callbacks (access, page and title)'
,
...
...
@@ -2040,67 +2101,6 @@ function system_update_8020() {
$schema
->
createTable
(
'router'
,
$tables
[
'router'
]);
}
/**
* Conditionally enable the new Ban module.
*/
function
system_update_8020
()
{
$blocked_ips_exists
=
db_query_range
(
'SELECT 1 FROM {blocked_ips}'
,
0
,
1
)
->
fetchField
();
if
(
$blocked_ips_exists
)
{
// Rename the permission name.
db_update
(
'role_permission'
)
->
fields
(
array
(
'permission'
=>
'ban IP addresses'
,
'module'
=>
'ban'
,
))
->
condition
(
'permission'
,
'block IP addresses'
)
->
execute
();
// Rename {blocked_ips} table into {ban_ip}.
db_rename_table
(
'blocked_ips'
,
'ban_ip'
);
// Rename all references to the action callback.
db_update
(
'actions'
)
->
fields
(
array
(
'callback'
=>
'ban_ip_action'
))
->
condition
(
'callback'
,
'system_block_ip_action'
)
->
execute
();
// Rename the action's aid.
db_update
(
'actions'
)
->
fields
(
array
(
'aid'
=>
'ban_ip_action'
))
->
condition
(
'aid'
,
'system_block_ip_action'
)
->
execute
();
// Enable the new Ban module.
update_module_enable
(
array
(
'ban'
));
}
else
{
// Drop old table.
db_drop_table
(
'blocked_ips'
);
}
}
/**
* Enable the Actions module.
*/
function
system_update_8021
()
{
// Enable the module without re-installing the schema.
update_module_enable
(
array
(
'action'
));
// Rename former System module actions.
$map
=
array
(
'system_message_action'
=>
'action_message_action'
,
'system_send_email_action'
=>
'action_send_email_action'
,
'system_goto_action'
=>
'action_goto_action'
,
);
foreach
(
$map
as
$old
=>
$new
)
{
// Rename all references to the action callback.
db_update
(
'actions'
)
->
fields
(
array
(
'callback'
=>
$new
))
->
condition
(
'callback'
,
$old
)
->
execute
();
// Rename the action's aid.
db_update
(
'actions'
)
->
fields
(
array
(
'aid'
=>
$new
))
->
condition
(
'aid'
,
$old
)
->
execute
();
}
}
/**
* @} End of "defgroup updates-7.x-to-8.x".
* The next series of updates should start at 9000.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment