X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FGlobalFunctions.php;h=3de25e716d0eda80f9c4acabb5bad0f5b6968607;hb=18d478e696f3737991773408024b4f3e9111693b;hp=98bc65fc4996169ea831447a015e8b78cea22631;hpb=410d1617dbb245d351a85eac9391c0b73960e691;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 98bc65fc49..3de25e716d 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -169,6 +169,7 @@ function wfArrayLookup( $a, $b ) { * @param $value Mixed * @param $default Mixed * @param $changed Array to alter + * @throws MWException */ function wfAppendToArrayIfNotDefault( $key, $value, $default, &$changed ) { if ( is_null( $changed ) ) { @@ -1110,6 +1111,7 @@ function wfWarn( $msg, $callerOffset = 1, $level = E_USER_NOTICE ) { * * @param $text String * @param $file String filename + * @throws MWException */ function wfErrorLog( $text, $file ) { if ( substr( $file, 0, 4 ) == 'udp:' ) { @@ -1542,8 +1544,6 @@ function wfMsgGetKey( $key, $useDB = true, $langCode = false, $transform = true /** * Replace message parameter keys on the given formatted output. * - * @deprecated since 1.18 - * * @param $message String * @param $args Array * @return string @@ -1721,6 +1721,7 @@ function wfEmptyMsg( $key ) { * but now throws an exception instead, with similar results. * * @param $msg String: message shown when dying. + * @throws MWException */ function wfDebugDieBacktrace( $msg = '' ) { throw new MWException( $msg ); @@ -2404,7 +2405,6 @@ define( 'TS_ISO_8601_BASIC', 9 ); /** * Get a timestamp string in one of various formats * - * @deprecated * @param $outputtype Mixed: A timestamp in one of the supported formats, the * function will autodetect which format is supplied and act * accordingly. @@ -2412,8 +2412,13 @@ define( 'TS_ISO_8601_BASIC', 9 ); * @return Mixed: String / false The same date in the format specified in $outputtype or false */ function wfTimestamp( $outputtype = TS_UNIX, $ts = 0 ) { - $timestamp = new MWTimestamp( $ts ); - return $timestamp->getTimestamp( $outputtype ); + try { + $timestamp = new MWTimestamp( $ts ); + return $timestamp->getTimestamp( $outputtype ); + } catch( TimestampException $e ) { + wfDebug("wfTimestamp() fed bogus time value: TYPE=$outputtype; VALUE=$ts\n"); + return false; + } } /** @@ -2510,6 +2515,7 @@ function wfTempDir() { * @param $dir String: full path to directory to create * @param $mode Integer: chmod value to use, default is $wgDirectoryMode * @param $caller String: optional caller param for debugging. + * @throws MWException * @return bool */ function wfMkdirParents( $dir, $mode = null, $caller = null ) { @@ -3020,6 +3026,7 @@ function wfDiff( $before, $after, $params = '-u' ) { * * @param $req_ver Mixed: the version to check, can be a string, an integer, or * a float + * @throws MWException */ function wfUsePHP( $req_ver ) { $php_ver = PHP_VERSION; @@ -3041,6 +3048,7 @@ function wfUsePHP( $req_ver ) { * * @param $req_ver Mixed: the version to check, can be a string, an integer, or * a float + * @throws MWException */ function wfUseMW( $req_ver ) { global $wgVersion; @@ -3549,16 +3557,6 @@ function wfBoolToStr( $value ) { return $value ? 'true' : 'false'; } -/** - * Load an extension messages file - * - * @deprecated since 1.16, warnings in 1.18, remove in 1.20 - * @codeCoverageIgnore - */ -function wfLoadExtensionMessages() { - wfDeprecated( __FUNCTION__, '1.16' ); -} - /** * Get a platform-independent path to the null file, e.g. /dev/null *