Commit 0a750f24 authored by das-peter's avatar das-peter Committed by fago

Issue #2241979 by das-peter, a.milkovsky, fago: Add a way to prevent exportable rebuild on cron run

parent 724e7193
......@@ -11,7 +11,15 @@ entity CRUD controller, which helps simplifying the creation of new entity types
This is an API module. You only need to enable it if a module depends on it or
you are interested in using it for development.
This README is for interested developers. If you are not interested in
Advanced usage:
---------------
You can optimize cache clearing performance by setting the variable
'entity_rebuild_on_flush' to FALSE. This skips rebuilding of feature
components and exported entities during cache flushing. Instead, it is triggered
by the features module only; e.g., when features are reverted.
The README below is for interested developers. If you are not interested in
developing, you may stop reading now.
--------------------------------------------------------------------------------
......
......@@ -7,6 +7,12 @@
/**
* Returns the configured entity features controller.
*
* @param string $type
* The entity type to get the controller for.
*
* @return EntityDefaultFeaturesController
* The configured entity features controller.
*/
function entity_features_get_controller($type) {
$static = &drupal_static(__FUNCTION__);
......@@ -146,6 +152,8 @@ function entity_features_api() {
}
/**
* Implements hook_features_export_options().
*
* Features component callback.
*/
function entity_features_export_options($a1, $a2 = NULL) {
......@@ -157,6 +165,8 @@ function entity_features_export_options($a1, $a2 = NULL) {
}
/**
* Implements hook_features_export().
*
* Features component callback.
*/
function entity_features_export($data, &$export, $module_name = '', $entity_type) {
......@@ -164,6 +174,8 @@ function entity_features_export($data, &$export, $module_name = '', $entity_type
}
/**
* Implements hook_features_export_render().
*
* Features component callback.
*/
function entity_features_export_render($module, $data, $export = NULL, $entity_type) {
......@@ -171,8 +183,23 @@ function entity_features_export_render($module, $data, $export = NULL, $entity_t
}
/**
* Implements hook_features_revert().
*
* Features component callback.
*/
function entity_features_revert($module = NULL, $entity_type) {
return entity_features_get_controller($entity_type)->revert($module);
}
/**
* Implements hook_features_post_restore().
*
* Rebuild all defaults when a features rebuild is triggered - even the ones not
* handled by features itself.
*/
function entity_features_post_restore($op, $items = array()) {
if ($op == 'rebuild') {
// Use features rebuild to rebuild the features independent exports too.
entity_defaults_rebuild();
}
}
......@@ -13,6 +13,14 @@ function entity_enable() {
entity_entitycache_installed_modules();
}
/**
* Implements hook_uninstall().
*/
function entity_uninstall() {
// Delete variables.
variable_del('entity_rebuild_on_flush');
}
/**
* The entity API modules have been merged into a single module.
*/
......
......@@ -1076,7 +1076,8 @@ function entity_flush_caches() {
// case of enabling or disabling modules we already rebuild defaults in
// entity_modules_enabled() and entity_modules_disabled(), so we do not need
// to do it again.
if (current_path() != 'admin/modules/list/confirm') {
// Also check if rebuilding on cache flush is explicitly disabled.
if (current_path() != 'admin/modules/list/confirm' && variable_get('entity_rebuild_on_flush', TRUE)) {
entity_defaults_rebuild();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment