diff options
author | Cash Costello <cash.costello@gmail.com> | 2012-01-08 09:25:43 -0500 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2012-01-08 09:25:43 -0500 |
commit | 05cfa919e51737d8292a6aa317f9802aee6f33bf (patch) | |
tree | 779318776826aafde4148f89f8059b3078690e90 | |
parent | 3c425c0bd366965923933a3ee2b1bcb74d64046b (diff) | |
download | elgg-05cfa919e51737d8292a6aa317f9802aee6f33bf.tar.gz elgg-05cfa919e51737d8292a6aa317f9802aee6f33bf.tar.bz2 |
Fixes #4278 deprecation notices ignore debug level but do respect whether the admin is logged in
-rw-r--r-- | engine/lib/elgglib.php | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 6f9fb0ded..b044d230f 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -1174,7 +1174,9 @@ function elgg_dump($value, $to_screen = TRUE, $level = 'NOTICE') { * * This function either displays or logs the deprecation message, * depending upon the deprecation policies in {@link CODING.txt}. - * Logged messages are sent with the level of 'WARNING'. + * Logged messages are sent with the level of 'WARNING'. Only admins + * get visual deprecation notices. When non-admins are logged in, the + * notices are sent to PHP's log through elgg_dump(). * * A user-visual message will be displayed if $dep_version is greater * than 1 minor releases lower than the current Elgg version, or at all @@ -1185,11 +1187,12 @@ function elgg_dump($value, $to_screen = TRUE, $level = 'NOTICE') { * * @see CODING.txt * - * @param str $msg Message to log / display. - * @param str $dep_version Human-readable *release* version: 1.7, 1.8, ... - * @param int $backtrace_level How many levels back to display the backtrace. Useful if calling from - * functions that are called from other places (like elgg_view()). Set - * to -1 for a full backtrace. + * @param string $msg Message to log / display. + * @param string $dep_version Human-readable *release* version: 1.7, 1.8, ... + * @param int $backtrace_level How many levels back to display the backtrace. + * Useful if calling from functions that are called + * from other places (like elgg_view()). Set to -1 + * for a full backtrace. * * @return bool * @since 1.7.0 @@ -1198,13 +1201,13 @@ function elgg_deprecated_notice($msg, $dep_version, $backtrace_level = 1) { // if it's a major release behind, visual and logged // if it's a 1 minor release behind, visual and logged // if it's for current minor release, logged. - // bugfixes don't matter because you're not deprecating between them, RIGHT? + // bugfixes don't matter because we are not deprecating between them if (!$dep_version) { - return FALSE; + return false; } - $elgg_version = get_version(TRUE); + $elgg_version = get_version(true); $elgg_version_arr = explode('.', $elgg_version); $elgg_major_version = (int)$elgg_version_arr[0]; $elgg_minor_version = (int)$elgg_version_arr[1]; @@ -1212,16 +1215,16 @@ function elgg_deprecated_notice($msg, $dep_version, $backtrace_level = 1) { $dep_major_version = (int)$dep_version; $dep_minor_version = 10 * ($dep_version - $dep_major_version); - $visual = FALSE; + $visual = false; if (($dep_major_version < $elgg_major_version) || ($dep_minor_version < $elgg_minor_version)) { - $visual = TRUE; + $visual = true; } $msg = "Deprecated in $dep_major_version.$dep_minor_version: $msg"; - if ($visual) { + if ($visual && elgg_is_admin_logged_in()) { register_error($msg); } @@ -1249,9 +1252,9 @@ function elgg_deprecated_notice($msg, $dep_version, $backtrace_level = 1) { $msg .= implode("<br /> -> ", $stack); - elgg_log($msg, 'WARNING'); + elgg_dump($msg, elgg_is_admin_logged_in(), 'WARNING'); - return TRUE; + return true; } /** |