Commit 49bb1d9a authored by webchick's avatar webchick

Issue #1788084 by andyceo, sun: Convert actions variable(s) to CMI.

parent c10a2536
......@@ -141,8 +141,9 @@ function actions_do($action_ids, $object = NULL, $context = NULL, $a1 = NULL, $a
// $stack tracks the number of recursive calls.
static $stack;
$stack++;
if ($stack > variable_get('action_max_stack', 35)) {
watchdog('action', 'Stack overflow: too many calls to actions_do(). Aborting to prevent infinite recursion.', array(), WATCHDOG_ERROR);
$recursion_limit = config('action.settings')->get('recursion_limit');
if ($stack > $recursion_limit) {
watchdog('action', 'Stack overflow: recursion limit for actions_do() has been reached. Stack is limited by %limit calls.', array('%limit' => $recursion_limit), WATCHDOG_ERROR);
return;
}
$actions = array();
......
......@@ -48,7 +48,9 @@ function testActionLoop() {
// recursion level should be kept low enough to prevent the xdebug
// infinite recursion protection mechanism from aborting the request.
// See http://drupal.org/node/587634.
variable_set('action_max_stack', 7);
config('action.settings')
->set('recursion_limit', 7)
->save();
$this->triggerActions();
}
......@@ -61,10 +63,11 @@ protected function triggerActions() {
$this->drupalGet('<front>', array('query' => array('trigger_action_on_watchdog' => $this->aid)));
$expected = array();
$expected[] = 'Triggering action loop';
for ($i = 1; $i <= variable_get('action_max_stack', 35); $i++) {
$recursion_limit = config('action.settings')->get('recursion_limit');
for ($i = 1; $i <= $recursion_limit; $i++) {
$expected[] = "Test log #$i";
}
$expected[] = 'Stack overflow: too many calls to actions_do(). Aborting to prevent infinite recursion.';
$expected[] = 'Stack overflow: recursion limit for actions_do() has been reached. Stack is limited by %limit calls.';
$result = db_query("SELECT message FROM {watchdog} WHERE type = 'action_loop_test' OR type = 'action' ORDER BY wid");
$loop_started = FALSE;
......
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