Merge "prop=duplicatefiles does not show duplicates under same name"
[lhc/web/wiklou.git] / includes / GlobalFunctions.php
index f83a31b..708fae6 100644 (file)
@@ -476,7 +476,7 @@ function wfCgiToArray( $query ) {
  * Append a query string to an existing URL, which may or may not already
  * have query string parameters already. If so, they will be combined.
  *
- * @deprecated
+ * @deprecated in 1.20. Use Uri class.
  * @param $url String
  * @param $query Mixed: string or associative array
  * @return string
@@ -968,21 +968,27 @@ function wfDebugLog( $logGroup, $text, $public = true ) {
  * @param $text String: database error message.
  */
 function wfLogDBError( $text ) {
-       global $wgDBerrorLog, $wgDBerrorLogInUTC;
+       global $wgDBerrorLog, $wgDBerrorLogTZ;
+       static $logDBErrorTimeZoneObject = null;
+
        if ( $wgDBerrorLog ) {
                $host = wfHostname();
                $wiki = wfWikiID();
 
-               if( $wgDBerrorLogInUTC ) {
-                       $wikiTimezone = date_default_timezone_get();
-                       date_default_timezone_set( 'UTC' );
+               if ( $wgDBerrorLogTZ && !$logDBErrorTimeZoneObject ) {
+                       $logDBErrorTimeZoneObject = new DateTimeZone( $wgDBerrorLogTZ );
                }
-               $date = date( 'D M j G:i:s T Y' );
-               if( $wgDBerrorLogInUTC ) {
-                       // Restore timezone
-                       date_default_timezone_set( $wikiTimezone );
+
+               // Workaround for https://bugs.php.net/bug.php?id=52063
+               // Can be removed when min PHP > 5.3.2
+               if ( $logDBErrorTimeZoneObject === null ) {
+                       $d = date_create( "now" );
+               } else {
+                       $d = date_create( "now", $logDBErrorTimeZoneObject );
                }
 
+               $date = $d->format( 'D M j G:i:s T Y' );
+
                $text = "$date\t$host\t$wiki\t$text";
                wfErrorLog( $text, $wgDBerrorLog );
        }
@@ -1678,7 +1684,7 @@ function wfMsgExt( $key, $options ) {
  * looked up didn't exist but a XHTML string, this function checks for the
  * nonexistance of messages by checking the MessageCache::get() result directly.
  *
- * @deprecated since 1.18
+ * @deprecated since 1.18. Use Message::isDisabled().
  *
  * @param $key      String: the message key looked up
  * @return Boolean True if the message *doesn't* exist.
@@ -1906,13 +1912,7 @@ function wfFormatStackFrame( $frame ) {
  * @return String
  */
 function wfShowingResults( $offset, $limit ) {
-       global $wgLang;
-       return wfMsgExt(
-               'showingresults',
-               array( 'parseinline' ),
-               $wgLang->formatNum( $limit ),
-               $wgLang->formatNum( $offset + 1 )
-       );
+       return wfMessage( 'showingresults' )->numParams( $limit, $offset + 1 )->parse();
 }
 
 /**
@@ -3372,21 +3372,10 @@ function wfFixSessionID() {
  * @param $sessionId Bool
  */
 function wfSetupSession( $sessionId = false ) {
-       global $wgSessionsInMemcached, $wgCookiePath, $wgCookieDomain,
+       global $wgSessionsInMemcached, $wgSessionsInObjectCache, $wgCookiePath, $wgCookieDomain,
                        $wgCookieSecure, $wgCookieHttpOnly, $wgSessionHandler;
-       if( $wgSessionsInMemcached ) {
-               if ( !defined( 'MW_COMPILED' ) ) {
-                       global $IP;
-                       require_once( "$IP/includes/cache/MemcachedSessions.php" );
-               }
-               session_set_save_handler( 'memsess_open', 'memsess_close', 'memsess_read',
-                       'memsess_write', 'memsess_destroy', 'memsess_gc' );
-
-               // It's necessary to register a shutdown function to call session_write_close(),
-               // because by the time the request shutdown function for the session module is
-               // called, $wgMemc has already been destroyed. Shutdown functions registered
-               // this way are called before object destruction.
-               register_shutdown_function( 'memsess_write_close' );
+       if( $wgSessionsInObjectCache || $wgSessionsInMemcached ) {
+               ObjectCacheSessionHandler::install();
        } elseif( $wgSessionHandler && $wgSessionHandler != ini_get( 'session.save_handler' ) ) {
                # Only set this if $wgSessionHandler isn't null and session.save_handler
                # hasn't already been set to the desired value (that causes errors)
@@ -3980,7 +3969,7 @@ function wfIsBadImage( $name, $contextTitle = false, $blacklist = null ) {
                $badImages = $badImageCache;
        } else { // cache miss
                if ( $blacklist === null ) {
-                       $blacklist = wfMsgForContentNoTrans( 'bad_image_list' ); // site list
+                       $blacklist = wfMessage( 'bad_image_list' )->inContentLanguage()->plain(); // site list
                }
                # Build the list now
                $badImages = array();