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
304
Merge Requests
304
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
bf751d9a
Commit
bf751d9a
authored
Oct 01, 2010
by
webchick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#651086
follow-up by carols8f: Fix cache clearing is an ineffective mess.
parent
0223bf1d
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
108 additions
and
51 deletions
+108
-51
includes/common.inc
includes/common.inc
+3
-0
includes/install.core.inc
includes/install.core.inc
+10
-3
includes/module.inc
includes/module.inc
+1
-3
includes/update.inc
includes/update.inc
+3
-0
modules/simpletest/drupal_web_test_case.php
modules/simpletest/drupal_web_test_case.php
+0
-3
modules/simpletest/tests/module_test.module
modules/simpletest/tests/module_test.module
+3
-0
modules/simpletest/tests/upgrade/upgrade.test
modules/simpletest/tests/upgrade/upgrade.test
+0
-3
modules/system/system.admin.inc
modules/system/system.admin.inc
+9
-18
modules/system/system.install
modules/system/system.install
+0
-7
modules/system/system.module
modules/system/system.module
+12
-14
modules/system/system.test
modules/system/system.test
+67
-0
No files found.
includes/common.inc
View file @
bf751d9a
...
...
@@ -6544,6 +6544,9 @@ function drupal_flush_all_caches() {
menu_rebuild
();
node_types_rebuild
();
// Synchronize to catch any actions that were added or removed.
actions_synchronize
();
// Don't clear cache_form - in-progress form submissions may break.
// Ordered so clearing the page cache will always be the last action.
$core
=
array
(
'cache'
,
'cache_filter'
,
'cache_bootstrap'
,
'cache_page'
);
...
...
includes/install.core.inc
View file @
bf751d9a
...
...
@@ -1403,6 +1403,7 @@ function install_profile_modules(&$install_state) {
'operations'
=>
$operations
,
'title'
=>
st
(
'Installing @drupal'
,
array
(
'@drupal'
=>
drupal_install_profile_distribution_name
())),
'error_message'
=>
st
(
'The installation has encountered an error.'
),
'finished'
=>
'_install_profile_modules_finished'
,
);
return
$batch
;
}
...
...
@@ -1527,9 +1528,6 @@ function install_finished(&$install_state) {
// registered by the install profile are registered correctly.
drupal_flush_all_caches
();
// Register actions declared by any modules.
actions_synchronize
();
// Remember the profile which was used.
variable_set
(
'install_profile'
,
drupal_get_profile
());
...
...
@@ -1564,6 +1562,15 @@ function _install_module_batch($module, $module_name, &$context) {
$context
[
'message'
]
=
st
(
'Installed %module module.'
,
array
(
'%module'
=>
$module_name
));
}
/**
* 'Finished' callback for module installation batch.
*/
function
_install_profile_modules_finished
(
$success
,
$results
,
$operations
)
{
// Flush all caches to complete the module installation process. Subsequent
// installation tasks will now have full access to the profile's modules.
drupal_flush_all_caches
();
}
/**
* Checks installation requirements and reports any errors.
*/
...
...
includes/module.inc
View file @
bf751d9a
...
...
@@ -67,7 +67,7 @@ function module_list($refresh = FALSE, $bootstrap = FALSE, $sort = FALSE, $fixed
else
{
// As this is the $refresh case, make sure that system_list() returns
// fresh data.
drupal_static_reset
(
'system_list'
);
system_list_reset
(
);
if
(
$bootstrap
)
{
$list
=
system_list
(
'bootstrap'
);
}
...
...
@@ -391,7 +391,6 @@ function module_enable($module_list, $enable_dependencies = TRUE) {
->
condition
(
'name'
,
$module
)
->
execute
();
// Refresh the module list to include it.
system_list_reset
();
module_list
(
TRUE
);
module_implements
(
''
,
FALSE
,
TRUE
);
_system_update_bootstrap_status
();
...
...
@@ -498,7 +497,6 @@ function module_disable($module_list, $disable_dependents = TRUE) {
if
(
!
empty
(
$invoke_modules
))
{
// Refresh the module list to exclude the disabled modules.
system_list_reset
();
module_list
(
TRUE
);
module_implements
(
''
,
FALSE
,
TRUE
);
// Invoke hook_modules_disabled before disabling modules,
...
...
includes/update.inc
View file @
bf751d9a
...
...
@@ -637,6 +637,9 @@ function update_fix_d7_requirements() {
db_change_field
(
'languages'
,
'javascript'
,
'javascript'
,
array
(
'type'
=>
'varchar'
,
'length'
=>
64
,
'not null'
=>
TRUE
,
'default'
=>
''
));
}
// Rename action description to label.
db_change_field
(
'actions'
,
'description'
,
'label'
,
array
(
'type'
=>
'varchar'
,
'length'
=>
255
,
'not null'
=>
TRUE
,
'default'
=>
'0'
));
variable_set
(
'update_d7_requirements'
,
TRUE
);
}
...
...
modules/simpletest/drupal_web_test_case.php
View file @
bf751d9a
...
...
@@ -1315,9 +1315,6 @@ protected function resetAll() {
drupal_static_reset
();
drupal_flush_all_caches
();
// Register actions declared by any modules.
actions_synchronize
();
// Reload global $conf array and permissions.
$this
->
refreshVariables
();
$this
->
checkPermissions
(
array
(),
TRUE
);
...
...
modules/simpletest/tests/module_test.module
View file @
bf751d9a
...
...
@@ -36,6 +36,9 @@ function module_test_system_info_alter(&$info, $file, $type) {
$info
[
'dependencies'
][]
=
'php'
;
}
}
if
(
$file
->
name
==
'seven'
&&
$type
==
'theme'
)
{
$info
[
'regions'
][
'test_region'
]
=
t
(
'Test region'
);
}
}
/**
...
...
modules/simpletest/tests/upgrade/upgrade.test
View file @
bf751d9a
...
...
@@ -283,9 +283,6 @@ abstract class UpgradePathTestCase extends DrupalWebTestCase {
drupal_static_reset
();
drupal_flush_all_caches
();
// Register actions declared by any modules.
actions_synchronize
();
// Reload global $conf array and permissions.
$this
->
refreshVariables
();
$this
->
checkPermissions
(
array
(),
TRUE
);
...
...
modules/system/system.admin.inc
View file @
bf751d9a
...
...
@@ -1168,6 +1168,7 @@ function system_modules_submit($form, &$form_state) {
if
(
$module
[
'enabled'
])
{
if
(
drupal_get_installed_schema_version
(
$name
)
==
SCHEMA_UNINSTALLED
)
{
$actions
[
'install'
][]
=
$name
;
$actions
[
'enable'
][]
=
$name
;
}
elseif
(
!
module_exists
(
$name
))
{
$actions
[
'enable'
][]
=
$name
;
...
...
@@ -1183,37 +1184,27 @@ function system_modules_submit($form, &$form_state) {
$pre_install_list
=
module_list
();
unset
(
$form_state
[
'storage'
]);
// Reverse the 'enable' list, to order dependencies before dependents.
rsort
(
$actions
[
'enable'
]);
// Installs, enables, and disables modules.
module_enable
(
$actions
[
'enable'
]);
module_disable
(
$actions
[
'disable'
]);
module_enable
(
$actions
[
'install'
]);
module_enable
(
$actions
[
'enable'
],
FALSE
);
module_disable
(
$actions
[
'disable'
],
FALSE
);
// Gets module list after install process, displays message if there are changes.
// Gets module list after install process, flushes caches and displays a
// message if there are changes.
$post_install_list
=
module_list
(
TRUE
);
if
(
$pre_install_list
!=
$post_install_list
)
{
drupal_flush_all_caches
();
drupal_set_message
(
t
(
'The configuration options have been saved.'
));
}
// Clear all caches.
registry_rebuild
();
system_rebuild_theme_data
();
drupal_theme_rebuild
();
node_types_rebuild
();
menu_rebuild
();
cache_clear_all
(
'schema'
,
'cache'
);
entity_info_cache_clear
();
drupal_clear_css_cache
();
drupal_clear_js_cache
();
$form_state
[
'redirect'
]
=
'admin/modules'
;
// Notify locale module about module changes, so translations can be
// imported. This might start a batch, and only return to the redirect
// path after that.
module_invoke
(
'locale'
,
'system_update'
,
$actions
[
'install'
]);
// Synchronize to catch any actions that were added or removed.
actions_synchronize
();
}
/**
...
...
modules/system/system.install
View file @
bf751d9a
...
...
@@ -2245,13 +2245,6 @@ function system_update_7036() {
variable_del
(
'site_offline_message'
);
}
/**
* Rename action description to label.
*/
function
system_update_7037
()
{
db_change_field
(
'actions'
,
'description'
,
'label'
,
array
(
'type'
=>
'varchar'
,
'length'
=>
255
,
'not null'
=>
TRUE
,
'default'
=>
'0'
));
}
/**
* Upgrade the {url_alias} table and create a cache bin for path aliases.
*/
...
...
modules/system/system.module
View file @
bf751d9a
...
...
@@ -2601,23 +2601,21 @@ function system_find_base_themes($themes, $key, $used_keys = array()) {
* An array of regions in the form $region['name'] = 'description'.
*/
function
system_region_list
(
$theme_key
,
$show
=
REGIONS_ALL
)
{
$list
=
&
drupal_static
(
__FUNCTION__
,
array
());
$themes
=
list_themes
();
if
(
!
isset
(
$themes
[
$theme_key
]))
{
return
array
();
}
if
(
empty
(
$list
[
$theme_key
][
$show
]))
{
$themes
=
list_themes
();
if
(
!
isset
(
$themes
[
$theme_key
]))
{
$list
[
$theme_key
][
$show
]
=
array
();
return
$list
[
$theme_key
][
$show
];
}
$info
=
$themes
[
$theme_key
]
->
info
;
// If requested, suppress hidden regions. See block_admin_display_form().
foreach
(
$info
[
'regions'
]
as
$name
=>
$label
)
{
if
(
$show
==
REGIONS_ALL
||
!
isset
(
$info
[
'regions_hidden'
])
||
!
in_array
(
$name
,
$info
[
'regions_hidden'
]))
{
$list
[
$theme_key
][
$show
][
$name
]
=
$label
;
}
$list
=
array
();
$info
=
$themes
[
$theme_key
]
->
info
;
// If requested, suppress hidden regions. See block_admin_display_form().
foreach
(
$info
[
'regions'
]
as
$name
=>
$label
)
{
if
(
$show
==
REGIONS_ALL
||
!
isset
(
$info
[
'regions_hidden'
])
||
!
in_array
(
$name
,
$info
[
'regions_hidden'
]))
{
$list
[
$name
]
=
$label
;
}
}
return
$list
[
$theme_key
][
$show
];
return
$list
;
}
/**
...
...
modules/system/system.test
View file @
bf751d9a
...
...
@@ -1666,6 +1666,73 @@ array_space[a b] = Value';
}
}
/**
* Tests the effectiveness of hook_system_info_alter().
*/
class
SystemInfoAlterTestCase
extends
DrupalWebTestCase
{
public
static
function
getInfo
()
{
return
array
(
'name'
=>
'System info alter'
,
'description'
=>
'Tests the effectiveness of hook_system_info_alter().'
,
'group'
=>
'System'
,
);
}
/**
* Tests that {system}.info is rebuilt after a module that implements
* hook_system_info_alter() is enabled. Also tests if core *_list() functions
* return freshly altered info.
*/
function
testSystemInfoAlter
()
{
// Enable our test module. Flush all caches, which we assert is the only
// thing necessary to use the rebuilt {system}.info.
module_enable
(
array
(
'module_test'
),
FALSE
);
drupal_flush_all_caches
();
$this
->
assertTrue
(
module_exists
(
'module_test'
),
t
(
'Test module is enabled.'
));
$info
=
$this
->
getSystemInfo
(
'seven'
,
'theme'
);
$this
->
assertTrue
(
isset
(
$info
[
'regions'
][
'test_region'
]),
t
(
'Altered theme info was added to {system}.info.'
));
$seven_regions
=
system_region_list
(
'seven'
);
$this
->
assertTrue
(
isset
(
$seven_regions
[
'test_region'
]),
t
(
'Altered theme info was returned by system_region_list().'
));
$system_list_themes
=
system_list
(
'theme'
);
$info
=
$system_list_themes
[
'seven'
]
->
info
;
$this
->
assertTrue
(
isset
(
$info
[
'regions'
][
'test_region'
]),
t
(
'Altered theme info was returned by system_list().'
));
$list_themes
=
list_themes
();
$this
->
assertTrue
(
isset
(
$list_themes
[
'seven'
]
->
info
[
'regions'
][
'test_region'
]),
t
(
'Altered theme info was returned by list_themes().'
));
// Disable the module and verify that {system}.info is rebuilt without it.
module_disable
(
array
(
'module_test'
),
FALSE
);
drupal_flush_all_caches
();
$this
->
assertFalse
(
module_exists
(
'module_test'
),
t
(
'Test module is disabled.'
));
$info
=
$this
->
getSystemInfo
(
'seven'
,
'theme'
);
$this
->
assertFalse
(
isset
(
$info
[
'regions'
][
'test_region'
]),
t
(
'Altered theme info was removed from {system}.info.'
));
$seven_regions
=
system_region_list
(
'seven'
);
$this
->
assertFalse
(
isset
(
$seven_regions
[
'test_region'
]),
t
(
'Altered theme info was not returned by system_region_list().'
));
$system_list_themes
=
system_list
(
'theme'
);
$info
=
$system_list_themes
[
'seven'
]
->
info
;
$this
->
assertFalse
(
isset
(
$info
[
'regions'
][
'test_region'
]),
t
(
'Altered theme info was not returned by system_list().'
));
$list_themes
=
list_themes
();
$this
->
assertFalse
(
isset
(
$list_themes
[
'seven'
]
->
info
[
'regions'
][
'test_region'
]),
t
(
'Altered theme info was not returned by list_themes().'
));
}
/**
* Returns the info array as it is stored in {system}.
*
* @param $name
* The name of the record in {system}.
* @param $type
* The type of record in {system}.
*
* @return
* Array of info, or FALSE if the record is not found.
*/
function
getSystemInfo
(
$name
,
$type
)
{
$raw_info
=
db_query
(
"SELECT info FROM
{
system
}
WHERE name = :name AND type = :type"
,
array
(
':name'
=>
$name
,
':type'
=>
$type
))
->
fetchField
();
return
$raw_info
?
unserialize
(
$raw_info
)
:
FALSE
;
}
}
/**
* Tests for the update system functionality.
*/
...
...
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