Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
E
expire
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
drupal.org
expire
Commits
afb51193
Commit
afb51193
authored
Jun 26, 2013
by
spleshka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added debug mode.
parent
05d6f90a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
0 deletions
+56
-0
expire.admin.inc
expire.admin.inc
+15
-0
expire.module
expire.module
+5
-0
includes/expire.api.inc
includes/expire.api.inc
+36
-0
No files found.
expire.admin.inc
View file @
afb51193
...
...
@@ -57,6 +57,21 @@ function expire_admin_settings_form() {
'#markup'
=>
$modules
?
theme
(
'item_list'
,
array
(
'items'
=>
$modules
))
:
t
(
'There are no implementations.'
),
);
$form
[
'tabs'
][
'status'
][
'debug'
]
=
array
(
'#type'
=>
'fieldset'
,
'#title'
=>
t
(
'Debug'
),
);
$form
[
'tabs'
][
'status'
][
'debug'
][
'expire_debug'
]
=
array
(
'#type'
=>
'radios'
,
'#title'
=>
t
(
'Debug level'
),
'#options'
=>
array
(
EXPIRE_DEBUG_DISABLED
=>
t
(
'Disabled'
),
EXPIRE_DEBUG_WATCHDOG
=>
t
(
'Watchdog'
),
EXPIRE_DEBUG_FULL
=>
t
(
'Watchdog + site message'
),
),
'#default_value'
=>
variable_get
(
'expire_debug'
,
EXPIRE_DEBUG_DISABLED
),
);
// NODE SETTINGS.
$form
[
'tabs'
][
'node'
]
=
array
(
...
...
expire.module
View file @
afb51193
...
...
@@ -36,6 +36,11 @@ define('EXPIRE_USER_CANCEL', 4);
define
(
'EXPIRE_VOTINGAPI_INSERT'
,
1
);
define
(
'EXPIRE_VOTINGAPI_DELETE'
,
2
);
// Debug levels.
define
(
'EXPIRE_DEBUG_DISABLED'
,
0
);
define
(
'EXPIRE_DEBUG_WATCHDOG'
,
1
);
define
(
'EXPIRE_DEBUG_FULL'
,
2
);
// Default values for cache expirations.
define
(
'EXPIRE_NODE_FRONT_PAGE'
,
FALSE
);
define
(
'EXPIRE_NODE_NODE_PAGE'
,
TRUE
);
...
...
includes/expire.api.inc
View file @
afb51193
...
...
@@ -36,6 +36,9 @@ class ExpireAPI {
list
(
$absolute_urls
,
$wildcards
)
=
self
::
convertToAbsoluteUrls
(
$urls
);
}
// Write some debug information.
self
::
debugLog
(
$absolute_urls
,
$wildcards
,
$object_type
);
$status
=
variable_get
(
'expire_status'
,
EXPIRE_STATUS_DISABLED
);
if
(
$status
==
EXPIRE_STATUS_ENABLED_INTERNAL
)
{
self
::
executeInternalExpiration
(
$absolute_urls
,
$wildcards
);
...
...
@@ -227,4 +230,37 @@ class ExpireAPI {
return
array
(
$absolute_urls
,
$wildcards
);
}
/**
* Log debug information.
*
* @param $absolute_urls
* @param $wildcards
* @param $object_type
*/
protected
static
function
debugLog
(
$absolute_urls
,
$wildcards
,
$object_type
)
{
$debug
=
variable_get
(
'expire_debug'
,
EXPIRE_DEBUG_DISABLED
);
if
(
empty
(
$debug
))
{
return
;
}
$output_urls
=
array
();
foreach
(
$absolute_urls
as
$internal_path
=>
$url
)
{
$wildcard
=
!
empty
(
$wildcards
[
$internal_path
])
?
'true'
:
'false'
;
$output_urls
[]
=
t
(
'URL: @url'
,
array
(
'@url'
=>
check_url
(
$url
)));
$output_urls
[]
=
t
(
'Wildcard: @wildcard'
,
array
(
'@wildcard'
=>
$wildcard
));
$output_urls
[]
=
t
(
'Expired object: @type'
,
array
(
'@type'
=>
$object_type
?
$object_type
:
'(none)'
));
$output_urls
[]
=
'--------'
;
}
// Log debug message in watchdog.
$message
=
t
(
'Expiration was executed for the next URLs: !urls'
,
array
(
'!urls'
=>
theme
(
'item_list'
,
array
(
'items'
=>
$output_urls
))));
watchdog
(
'expire'
,
$message
,
array
(),
WATCHDOG_DEBUG
);
// For development might be useful to print info on screen.
if
(
$debug
==
EXPIRE_DEBUG_FULL
)
{
drupal_set_message
(
$message
);
}
}
}
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