From: Aryeh Gregor Date: Sun, 16 Mar 2008 00:50:14 +0000 (+0000) Subject: Improve on r32014 with a helper function to avoid code duplication/possible inconsist... X-Git-Tag: 1.31.0-rc.0~49074 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=commitdiff_plain;h=c2f8e932d8096a5e75d81eebe6d66d6ccde699d2;p=lhc%2Fweb%2Fwiklou.git Improve on r32014 with a helper function to avoid code duplication/possible inconsistency. Would it be nice to start using this more, or should we just keep all the deprecated functions forever and not whine about it? --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 1a9091052b..71b135f7ad 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2433,3 +2433,11 @@ function wfMaxlagError( $host, $lag, $maxLag ) { echo "Waiting for a database server: $lag seconds lagged\n"; } } + +/** + * Throws an E_USER_NOTICE saying that $function is deprecated + * @param string $function + */ +function wfDeprecated( $function ) { + trigger_error( "Use of $function is deprecated", E_USER_NOTICE ); +} diff --git a/includes/User.php b/includes/User.php index 8e33705e9e..a8bfbe65d3 100644 --- a/includes/User.php +++ b/includes/User.php @@ -699,7 +699,7 @@ class User { * @deprecated use wfSetupSession() */ function SetupSession() { - trigger_error( 'Use of ' . __METHOD__ . ' is deprecated', E_USER_NOTICE ); + wfDeprecated( __METHOD__ ); wfSetupSession(); } @@ -1164,7 +1164,7 @@ class User { * @deprecated use User::newFromId() */ function setID( $v ) { - trigger_error( 'Use of ' . __METHOD__ . ' is deprecated', E_USER_NOTICE ); + wfDeprecated( __METHOD__ ); $this->mId = $v; $this->clearInstanceCache( 'id' ); } @@ -1760,7 +1760,7 @@ class User { * @deprecated */ function isBot() { - trigger_error( 'Use of ' . __METHOD__ . ' is deprecated', E_USER_NOTICE ); + wfDeprecated( __METHOD__ ); return $this->isAllowed( 'bot' ); } @@ -2212,7 +2212,7 @@ class User { * @deprecated */ function setLoaded( $loaded ) { - trigger_error( 'Use of ' . __METHOD__ . ' is deprecated', E_USER_NOTICE ); + wfDeprecated( __METHOD__ ); } /**