uppdated modules

This commit is contained in:
Bachir Soussi Chiadmi
2017-01-22 16:19:36 +01:00
parent 03be8f82aa
commit 8416e3eea1
748 changed files with 32317 additions and 20900 deletions
@@ -8,10 +8,44 @@
// hook_init().
require_once dirname(__FILE__) . '/modules/events.inc';
/**
* Implements hook_module_implements_alter().
*/
function rules_module_implements_alter(&$implementations, $hook) {
// Ensures the invocation of hook_menu_get_item_alter() triggers
// rules_menu_get_item_alter() first so the rules invocation is ready for all
// sub-sequent hook implementations.
if ($hook == 'menu_get_item_alter' && array_key_exists('rules', $implementations)) {
$group = $implementations['rules'];
unset($implementations['rules']);
$implementations = array_merge(array('rules' => $group), $implementations);
}
}
/**
* Implements hook_menu_get_item_alter().
*/
function rules_menu_get_item_alter() {
// Make sure that event invocation is enabled before menu items are loaded.
// But make sure later calls to menu_get_item() won't automatically re-enabled
// the rules invocation.
// Example: modules that implement hook_entity_ENTITY_TYPE_load() might want
// to invoke Rules events in that load hook, which is also invoked for menu
// item loading. Since this can happen even before hook_init() we need to make
// sure that firing Rules events is enabled at that point. A typical use case
// for this is Drupal Commerce with commerce_cart_commerce_order_load().
if (!drupal_static('rules_init', FALSE)) {
rules_event_invocation_enabled(TRUE);
}
}
/**
* Implements hook_init().
*/
function rules_init() {
// See rules_menu_get_item_alter().
$rules_init = &drupal_static(__FUNCTION__, FALSE);
$rules_init = TRUE;
// Enable event invocation once hook_init() was invoked for Rules.
rules_event_invocation_enabled(TRUE);
rules_invoke_event('init');
@@ -352,7 +386,7 @@ function &rules_get_cache($cid = 'data') {
$cache[$cid] = FALSE;
_rules_rebuild_component_cache();
}
elseif (strpos($cid, 'event_') === 0) {
elseif (strpos($cid, 'event_') === 0 || $cid == 'rules_event_whitelist') {
$cache[$cid] = FALSE;
RulesEventSet::rebuildEventCache();
}
@@ -447,7 +481,6 @@ function rules_flush_caches() {
*/
function rules_clear_cache() {
cache_clear_all('*', 'cache_rules', TRUE);
variable_del('rules_event_whitelist');
drupal_static_reset('rules_get_cache');
drupal_static_reset('rules_fetch_data');
drupal_static_reset('rules_config_update_dirty_flag');
@@ -984,17 +1017,16 @@ function rules_invoke_all() {
* @see rules_invoke_event_by_args()
*/
function rules_invoke_event() {
global $conf;
$args = func_get_args();
$event_name = $args[0];
unset($args[0]);
// We maintain a whitelist of configured events to reduces the number of cache
// reads. We access it directly via the global $conf as this is fast without
// having to introduce another static cache. Then, if the whitelist is unset,
// we ignore it so cache rebuilding is triggered.
if (rules_event_invocation_enabled() && (!isset($conf['rules_event_whitelist']) || isset($conf['rules_event_whitelist'][$event_name])) && $event = rules_get_cache('event_' . $event_name)) {
$event->executeByArgs($args);
// reads. If the whitelist is empty we proceed and it is rebuilt.
if (rules_event_invocation_enabled()) {
$whitelist = rules_get_cache('rules_event_whitelist');
if ((empty($whitelist) || isset($whitelist[$event_name])) && $event = rules_get_cache('event_' . $event_name)) {
$event->executeByArgs($args);
}
}
}
@@ -1016,14 +1048,13 @@ function rules_invoke_event() {
* @see rules_invoke_event()
*/
function rules_invoke_event_by_args($event_name, $args = array()) {
global $conf;
// We maintain a whitelist of configured events to reduces the number of cache
// reads. We access it directly via the global $conf as this is fast without
// having to introduce another static cache. Then, if the whitelist is unset,
// we ignore it so cache rebuilding is triggered.
if (rules_event_invocation_enabled() && (!isset($conf['rules_event_whitelist']) || isset($conf['rules_event_whitelist'][$event_name])) && $event = rules_get_cache('event_' . $event_name)) {
$event->executeByArgs($args);
// reads. If the whitelist is empty we proceed and it is rebuilt.
if (rules_event_invocation_enabled()) {
$whitelist = rules_get_cache('rules_event_whitelist');
if ((empty($whitelist) || isset($whitelist[$event_name])) && $event = rules_get_cache('event_' . $event_name)) {
$event->executeByArgs($args);
}
}
}