diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2012-08-21 16:49:08 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2012-08-21 16:49:08 +0200 |
commit | d289bc13acc0ab0329cac25742ae22560a80c607 (patch) | |
tree | bfd6d91205e19132d49e254618ad67ce501c8a30 /phpBB/includes/functions.php | |
parent | d828ef93f29eda5fe31a6f8291dd1e5b3cdfd97c (diff) | |
download | forums-d289bc13acc0ab0329cac25742ae22560a80c607.tar forums-d289bc13acc0ab0329cac25742ae22560a80c607.tar.gz forums-d289bc13acc0ab0329cac25742ae22560a80c607.tar.bz2 forums-d289bc13acc0ab0329cac25742ae22560a80c607.tar.xz forums-d289bc13acc0ab0329cac25742ae22560a80c607.zip |
[ticket/10714] Remove dependency injection and use global instead
This avoids loading functions_admin.php globally and was suggested by naderman
PHPBB3-10714
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r-- | phpBB/includes/functions.php | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index b5d0c4d62f..e202273204 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3357,29 +3357,20 @@ function parse_cfg_file($filename, $lines = false) */ function add_log() { - // This is all just an ugly hack to add "Dependency Injection" to a function - // the only real code is the function call which maps this function to a method. - static $static_log = null; + global $phpbb_log; $args = func_get_args(); $log = (isset($args[0])) ? $args[0] : false; - if ($log instanceof phpbb_log_interface) - { - $static_log = $log; - return true; - } - else if ($log === false) + if ($log === false) { return false; } - $tmp_log = $static_log; - // no log class set, create a temporary one ourselves to keep backwards compatability - if ($tmp_log === null) + if ($phpbb_log === null) { - $tmp_log = new phpbb_log(LOG_TABLE); + $phpbb_log = new phpbb_log(LOG_TABLE); } $mode = array_shift($args); @@ -3407,7 +3398,7 @@ function add_log() $user_id = (empty($user->data)) ? ANONYMOUS : $user->data['user_id']; $user_ip = (empty($user->ip)) ? '' : $user->ip; - return $tmp_log->add($mode, $user_id, $user_ip, $log_operation, time(), $additional_data); + return $phpbb_log->add($mode, $user_id, $user_ip, $log_operation, time(), $additional_data); } /** |