summaryrefslogtreecommitdiff
path: root/inc/infoutils.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2014-05-18 20:12:53 +0200
committerAndreas Gohr <andi@splitbrain.org>2014-05-18 20:12:53 +0200
commit60bf39dd81584414d4cb6f8cf568330d1a843a93 (patch)
tree7757ea89895043d56e570501773f9bad9ff1b342 /inc/infoutils.php
parent2e0c0440007c357cac9fbd8bed1a8b5ac9cab2a6 (diff)
parent1419a485e3ac0c507ef073f0b816bd41f7e4a5cd (diff)
downloadrpg-60bf39dd81584414d4cb6f8cf568330d1a843a93.tar.gz
rpg-60bf39dd81584414d4cb6f8cf568330d1a843a93.tar.bz2
Merge pull request #693 from splitbrain/logdeprecated
log deprecated function calls FS#2399
Diffstat (limited to 'inc/infoutils.php')
-rw-r--r--inc/infoutils.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/inc/infoutils.php b/inc/infoutils.php
index 4faaee8ef..db856141f 100644
--- a/inc/infoutils.php
+++ b/inc/infoutils.php
@@ -394,6 +394,32 @@ function dbglog($msg,$header=''){
}
/**
+ * Log accesses to deprecated fucntions to the debug log
+ *
+ * @param string $alternative The function or method that should be used instead
+ */
+function dbg_deprecated($alternative = '') {
+ global $conf;
+ if(!$conf['allowdebug']) return;
+
+ $backtrace = debug_backtrace();
+ array_shift($backtrace);
+ $self = array_shift($backtrace);
+ $call = array_shift($backtrace);
+
+ $called = trim($self['class'].'::'.$self['function'].'()', ':');
+ $caller = trim($call['class'].'::'.$call['function'].'()', ':');
+
+ $msg = $called.' is deprecated. It was called from ';
+ $msg .= $caller.' in '.$call['file'].':'.$call['line'];
+ if($alternative) {
+ $msg .= ' '.$alternative.' should be used instead!';
+ }
+
+ dbglog($msg);
+}
+
+/**
* Print a reversed, prettyprinted backtrace
*
* @author Gary Owen <gary_owen@bigfoot.com>