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
306
Merge Requests
306
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
cf561875
Commit
cf561875
authored
Aug 22, 2009
by
webchick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#296322
follow-up. It's extremely helpful when I remember to commit ALL files. :P
parent
4c028a19
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
121 additions
and
0 deletions
+121
-0
modules/simpletest/tests/actions_loop_test.info
modules/simpletest/tests/actions_loop_test.info
+8
-0
modules/simpletest/tests/actions_loop_test.install
modules/simpletest/tests/actions_loop_test.install
+12
-0
modules/simpletest/tests/actions_loop_test.module
modules/simpletest/tests/actions_loop_test.module
+101
-0
No files found.
modules/simpletest/tests/actions_loop_test.info
0 → 100644
View file @
cf561875
;
$
Id
$
name
=
Actions
loop
test
description
=
Support
module
for
action
loop
testing
.
package
=
Testing
version
=
VERSION
core
=
7.
x
files
[]
=
actions_loop_test
.
module
hidden
=
TRUE
modules/simpletest/tests/actions_loop_test.install
0 → 100644
View file @
cf561875
<?php
// $Id$
/**
* Implementation of hook_install().
*/
function
actions_loop_test_install
()
{
db_update
(
'system'
)
->
fields
(
array
(
'weight'
=>
1
))
->
condition
(
'name'
,
'actions_loop_test'
)
->
execute
();
}
modules/simpletest/tests/actions_loop_test.module
0 → 100644
View file @
cf561875
<?php
// $Id$
/**
* Implement hook_hook_info().
*/
function
actions_loop_test_hook_info
()
{
return
array
(
'actions_loop_test'
=>
array
(
'watchdog'
=>
array
(
'run'
=>
array
(
'runs when'
=>
t
(
'When a message is logged'
),
),
),
),
);
}
/**
* Implement hook_watchdog().
*/
function
actions_loop_test_watchdog
(
array
$log_entry
)
{
// If the triggering actions are not explicitly enabled, abort.
if
(
empty
(
$_GET
[
'trigger_actions_on_watchdog'
]))
{
return
;
}
// Get all the action ids assigned to the trigger on the watchdog hook's
// "run" event.
$aids
=
_trigger_get_hook_aids
(
'watchdog'
,
'run'
);
// We can pass in any applicable information in $context. There isn't much in
// this case, but we'll pass in the hook name and the operation name as the
// bare minimum.
$context
=
array
(
'hook'
=>
'watchdog'
,
'op'
=>
'run'
,
);
// Fire the actions on the associated object ($log_entry) and the context
// variable.
actions_do
(
array_keys
(
$aids
),
$log_entry
,
$context
);
}
/**
* Implement hook_init().
*/
function
actions_loop_test_init
()
{
if
(
!
empty
(
$_GET
[
'trigger_actions_on_watchdog'
]))
{
watchdog_skip_semaphore
(
'actions_loop_test'
,
'Triggering action loop'
);
}
}
/**
* Implement hook_action_info().
*/
function
actions_loop_test_action_info
()
{
return
array
(
'actions_loop_test_log'
=>
array
(
'description'
=>
t
(
'Write a message to the log.'
),
'type'
=>
'system'
,
'configurable'
=>
FALSE
,
'hooks'
=>
array
(
'any'
=>
TRUE
,
)
),
);
}
/**
* Write a message to the log.
*/
function
actions_loop_test_log
()
{
$count
=
&
drupal_static
(
__FUNCTION__
,
0
);
$count
++
;
watchdog_skip_semaphore
(
'actions_loop_test'
,
"Test log #
$count
"
);
}
/**
* Replacement of the watchdog() function that eliminates the use of semaphores
* so that we can test the abortion of an action loop.
*/
function
watchdog_skip_semaphore
(
$type
,
$message
,
$variables
=
array
(),
$severity
=
WATCHDOG_NOTICE
,
$link
=
NULL
)
{
global
$user
,
$base_root
;
// Prepare the fields to be logged
$log_entry
=
array
(
'type'
=>
$type
,
'message'
=>
$message
,
'variables'
=>
$variables
,
'severity'
=>
$severity
,
'link'
=>
$link
,
'user'
=>
$user
,
'request_uri'
=>
$base_root
.
request_uri
(),
'referer'
=>
$_SERVER
[
'HTTP_REFERER'
],
'ip'
=>
ip_address
(),
'timestamp'
=>
REQUEST_TIME
,
);
// Call the logging hooks to log/process the message
foreach
(
module_implements
(
'watchdog'
)
as
$module
)
{
module_invoke
(
$module
,
'watchdog'
,
$log_entry
);
}
}
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